Skip to content

Commit e21128e

Browse files
authored
doc: Consolidate build options in one place (#1360)
1 parent 4ca27af commit e21128e

9 files changed

Lines changed: 106 additions & 39 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ target_compile_features(xsimd INTERFACE cxx_std_14)
4646
# developed or is vendored.
4747
# Otherwise (if an install is performed), this will be handled in the user
4848
# cmake script (xsimdConfig.cmake).
49-
if(ENABLE_XTL_COMPLEX)
49+
if(ENABLE_XTL_COMPLEX OR XSIMD_ENABLE_XTL_COMPLEX)
5050
find_package(xtl 0.8.0 REQUIRED)
5151
target_link_libraries(xsimd INTERFACE $<BUILD_INTERFACE:xtl>)
5252
target_compile_definitions(xsimd INTERFACE

docs/source/api/arch.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
The full license is in the file LICENSE, distributed with this software.
66
7+
.. _arch-manipulation:
78
Architecture Manipulation
89
=========================
910

@@ -12,13 +13,15 @@ The mentioned types are primarily used as template parameters for :ref:`batch
1213
<xsimd-batch-ref>`, and when interacting with :cpp:func:`xsimd::dispatch()`.
1314

1415
The best available architecture is available at compile time through
15-
``xsimd::best_arch`` which also happens to be ``xsimd::default_arch``.
16+
``xsimd::best_arch`` which is what ``xsimd::default_arch`` defaults to unless otherwise
17+
configured.
1618

1719
.. doxygengroup:: architectures
1820
:project: xsimd
1921
:members:
2022

2123

24+
.. _emulated-mode:
2225
Emulated Mode
2326
-------------
2427

docs/source/api/instr_macros.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
}
2727
</style>
2828

29+
.. _instr-set-macros:
2930
Instruction Set Macros
3031
======================
3132

@@ -35,11 +36,3 @@ can be used to filter arch-specific code.
3536
.. doxygengroup:: xsimd_config_macro
3637
:project: xsimd
3738
:content-only:
38-
39-
Changing Default Architecture
40-
*****************************
41-
42-
You can change the default instruction set used by xsimd (when none is provided
43-
explicitly) by setting the ``XSIMD_DEFAULT_ARCH`` macro to, say, ``xsimd::avx2``.
44-
A common usage is to set it to ``xsimd::unsupported`` as a way to detect
45-
instantiation of batches with the default architecture.

docs/source/api/xsimd_batch_complex.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,3 @@ Operations Specific to Batches of Complex Numbers
1717
.. doxygengroup:: batch_complex
1818
:project: xsimd
1919
:content-only:
20-
21-
XTL Complex Support
22-
-------------------
23-
24-
If the preprocessor token ``XSIMD_ENABLE_XTL_COMPLEX`` is defined, ``xsimd``
25-
provides constructors of ``xsimd::batch< std::complex< T >, A >`` from
26-
``xtl::xcomplex``, similar to those for ``std::complex``. This requires `XTL`_
27-
to be installed.
28-
29-
.. _XTL: https://github.com/xtensor-stack/xtl

docs/source/build.rst

Whitespace-only changes.

docs/source/build_options.rst

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. Copyright (c) 2016, xsimd contributors
2+
3+
Distributed under the terms of the BSD 3-Clause License.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
8+
Build Options
9+
=============
10+
11+
Some macros can be set to configure the behaviour of xsimd at compulte time.
12+
13+
Changing Default Architecture
14+
-----------------------------
15+
16+
You can change the default instruction set used by xsimd (when none is provided
17+
explicitly) by setting the ``XSIMD_DEFAULT_ARCH`` macro to, say, ``xsimd::avx2``.
18+
A common usage is to set it to ``xsimd::unsupported`` as a way to detect
19+
instantiation of batches with the default architecture.
20+
21+
This will change the value of ``xsimd::default_arch`` used as default template parameter for
22+
:ref:`batch <xsimd-batch-ref>`.
23+
See :ref:`arch-manipulation` for all available architectures.
24+
25+
In CMake, this can be done with the following.
26+
27+
.. code:: cmake
28+
29+
target_add_compile_definitions(myproject PRIVATE XSIMD_DEFAULT_ARCH=xsimd::avx2)
30+
31+
32+
Enabling emulated architecture
33+
------------------------------
34+
35+
When the compiler macro ``XSIMD_WITH_EMULATED`` is set to ``1``, xsimd also
36+
exhibits an emulated architecture.
37+
38+
See :ref:`emulated-mode` for all available architectures.
39+
40+
In CMake, this can be done with the following.
41+
42+
.. code:: cmake
43+
44+
target_add_compile_definitions(myproject PRIVATE XSIMD_WITH_EMULATED=1)
45+
46+
47+
Enabling complex support with ``xtl``
48+
-------------------------------------
49+
50+
If the preprocessor token ``XSIMD_ENABLE_XTL_COMPLEX`` is defined, ``xsimd``
51+
provides constructors of ``xsimd::batch<std::complex<T>, A>`` from
52+
``xtl::xcomplex``, similar to those for ``std::complex``.
53+
This requires the `xtl <https://github.com/xtensor-stack/xtl>`_ library to be installed
54+
and in the project include directories.
55+
56+
In CMake, this can be done with an option before the package search (xsimd 14.3 onwards).
57+
It will link the ``xtl`` library as well as adding the macro definition to ``xsimd`` interface.
58+
59+
.. code:: cmake
60+
61+
option(XSIMD_ENABLE_XTL_COMPLEX "Enable xtl complex support" ON)
62+
find_package(xsimd REQUIRED)

docs/source/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313

1414
html_theme = "sphinx_rtd_theme"
1515
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
16+
html_theme_options = {
17+
'collapse_navigation': False,
18+
'navigation_depth': 4,
19+
}
1620

1721
def setup(app):
1822
app.add_css_file("main_stylesheet.css")

docs/source/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.. image:: xsimd.svg
88
:alt: xsimd
99

10-
C++ wrappers for SIMD intrinsics.
10+
C++14 wrappers for SIMD intrinsics.
1111

1212
Introduction
1313
------------
@@ -95,6 +95,7 @@ This software is licensed under the BSD-3-Clause license. See the LICENSE file f
9595
:maxdepth: 2
9696

9797
installation
98+
build_options
9899

99100
.. toctree::
100101
:caption: USAGE

docs/source/installation.rst

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
Installation
2323
============
2424

25+
Getting the library
26+
-------------------
27+
2528
`xsimd` is a header-only library, so installing it is just a matter of copying the ``include/xsimd`` directory.
2629

2730
However we provide standardized means to install it, with package managers or with cmake.
@@ -30,46 +33,57 @@ Besides the `xsimd` headers, all these methods place the ``cmake`` project confi
3033
.. image:: conda.svg
3134

3235
Using the conda-forge Package
33-
-----------------------------
36+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3437

3538
A package for `xsimd` is available for the `mamba <https://mamba.readthedocs.io>`_ (or `conda <https://conda.io>`_) package manager.
3639

37-
.. code::
40+
.. code:: bash
3841
3942
mamba install -c conda-forge xsimd
4043
4144
.. image:: spack.svg
4245

4346
Using the Spack Package
44-
-----------------------
47+
~~~~~~~~~~~~~~~~~~~~~~~
4548

4649
A package for `xsimd` is available on the `Spack <https://spack.io>`_ package manager.
4750

48-
.. code::
51+
.. code:: bash
4952
5053
spack install xsimd
5154
spack load xsimd
5255
5356
.. image:: cmake.svg
5457

5558
From Source with cmake
56-
----------------------
59+
~~~~~~~~~~~~~~~~~~~~~~
60+
61+
You can install `xsimd` from source with `Cmake <https://cmake.org/>`_. From the source directory:
62+
63+
.. code:: bash
64+
65+
cmake -B build/ -D CMAKE_INSTALL_PREFIX=/path/to/install/dir
66+
cmake --build build/
67+
cmake --install build/
68+
69+
You may need to customize the default `CMake <https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html>`_, for instance for picking ``nmake`` on Windows platforms:
70+
71+
.. code:: bash
5772
58-
You can install `xsimd` from source with `cmake <https://cmake.org/>`_. On Unix platforms, from the source directory:
73+
cmake -B build/ -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=/path/to/install/dir
74+
cmake --build build/
75+
cmake --install build/
5976
60-
.. code::
6177
62-
mkdir build
63-
cd build
64-
cmake -DCMAKE_INSTALL_PREFIX=/path/to/prefix ..
65-
make install
78+
Using the library inside CMake
79+
------------------------------
6680

67-
On Windows platforms, from the source directory:
81+
Inside the user's ``CMakelists.txt``, the user can add xsimd to their build with the ``xsimd``
82+
target.
83+
When using CMake this way, this will set add the xsimd headers in the compiler options, as well
84+
as forward other xsimd requirements (minimum C++ version for instance).
6885

69-
.. code::
86+
.. code:: cmake
7087
71-
mkdir build
72-
cd build
73-
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=/path/to/prefix ..
74-
nmake
75-
nmake install
88+
find_package(xsimd REQUIRED)
89+
target_link_libraries(myproject PRIVATE xsimd)

0 commit comments

Comments
 (0)