You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-3Lines changed: 24 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,14 +30,33 @@ For details on Pybind11 and Armadillo refer to their respective documentation [1
30
30
31
31
## Installation
32
32
CARMA is a header only library that relies on two other header only libraries, Armadillo and Pybind11.
33
+
It can be integrated in a CMake build using `ADD_SUBDIRECTORY(<path_to_carma>)` or installation which provides an interface library target `carma::carma` that has been linked with Python, Numpy, Pybind11 and Armadillo. See [build configuration](https://carma.readthedocs.io/en/stable/building.html) for details.
34
+
35
+
It can be installed using:
36
+
```bash
37
+
mkdir build
38
+
cd build
39
+
# optionally with -DCMAKE_INSTALL_PREFIX:PATH=<path/to/desired/location>
40
+
cmake -DCARMA_INSTALL_LIB=ON ..
41
+
cmake --build . --config Release --target install
42
+
```
43
+
44
+
You can than include it in a project using:
33
45
34
-
CARMA can be integrated in a CMake build using `ADD_SUBDIRECTORY(<path_to_carma>)` which provides an interface library target `carma`
35
-
that has been linked with Python, Numpy, Pybind11 and Armadillo. For Pybind11 and or Armadillo we create target(s) based on user settable version, see [build configuration](https://carma.readthedocs.io/en/stable/building.html), when they are not defined.
Alternatively you can forgo installing CARMA and directly use it as CMake subdirectory.
54
+
For Pybind11 and or Armadillo we create target(s) based on user settable version, see [build configuration](https://carma.readthedocs.io/en/stable/building.html), when they are not defined.
Copy file name to clipboardExpand all lines: docs/source/building.rst
+66-7Lines changed: 66 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,29 +14,88 @@ CARMA v0.5 requires a compiler with support for C++14 and supports:
14
14
* Pybind11 v2.6.0 -- v2.6.2
15
15
* Armadillo >= 10.5.2
16
16
17
-
CARMA target
18
-
------------
17
+
CMake build
18
+
-----------
19
19
20
20
CARMA provides a CMake configuration that can be used to integrate into existing builds.
21
-
It is advised to use :bash:`ADD_SUBDIRECTORY`, this provides an interface target, ``carma``, that can be linked to your target.
21
+
You can either use it directly or install it first. To edit the configuration please see
22
+
23
+
It is advised to use the ``carma::carma`` interface target that can be linked to your target.
22
24
This target pre-compiles the ``cnalloc.h`` header containing wrappers around Numpy's (de)allocator that are then picked up by Armadillo.
23
25
By pre-compiling the header we can ensure that the ``ARMA_ALIEN_MEM_ALLOC`` and ``ARMA_ALIEN_MEM_FREE`` definitions exist when including Armadillo
24
26
regardless of the include order.
25
27
26
28
.. warning:: if you are not using CARMA's cmake target you have to ensure that you include CARMA before Armadillo. Not doing so results in a compile error.
27
29
30
+
Installation
31
+
************
32
+
33
+
Make sure to change the configuration if desired before installing CARMA.
The ``REQUIRED`` state is propagated to the dependencies of CARMA.
53
+
54
+
Variables
55
+
^^^^^^^^^
56
+
57
+
The :bash:`FIND_PACKAGE` call sets the following variables
58
+
59
+
- ``carma_FOUND`` -- true if CARMA was found
60
+
- ``carma_INCLUDE_DIR`` -- the path to CARMA's include directory
61
+
- ``carma_INCLUDE_DIRS`` -- the paths to CARMA's include directory and the paths to the include directories of the dependencies.
62
+
63
+
Components
64
+
^^^^^^^^^^
65
+
66
+
When including carma using :bash:`FIND_PACKAGE` two targets are created:
67
+
68
+
- ``carma::carma``
69
+
70
+
``carma::carma`` has been linked with Python, Numpy, Pybind11 and Armadillo and pre-compiles the ``cnalloc.h`` header which means that there is no required order to includes or carma and armadillo. If you only want this component you can use :bash:`FIND_PACKAGE(carma CONFIG REQUIRED COMPONENTS carma)`
71
+
72
+
- ``carma::headers``
73
+
74
+
If you want to have a header-only target that is not linked with the dependencies and does not pre-compile ``cnalloc.h``. You must than make sure to link it to it's dependencies and make sure to always include carma before armadillo.
75
+
If you only want this component you can use :bash:`FIND_PACKAGE(carma CONFIG REQUIRED COMPONENTS headers)`
76
+
77
+
Subdirectory
78
+
************
79
+
80
+
Alternatively, you can use CARMA without installing it by using:
If neither is set, CARMA will provide the ``armadillo`` target at build time and store a clone of armadillo in ``carma/extern/armadillo-code``. The Armadillo version, by default ``10.5.2``, can be set using:
98
+
When using the subdirectory build, if neither is set, CARMA will provide the ``armadillo`` target at build time and store a clone of armadillo in ``carma/extern/armadillo-code``. The Armadillo version, by default ``10.5.2``, can be set using:
40
99
41
100
.. code-block:: bash
42
101
@@ -52,7 +111,7 @@ Users can provide a specific Pybind11 version by making sure the target ``pybind
If neither is set, CARMA will provide the ``pybind11`` target at build time and store a clone in ``carma/extern/pybind11``. The Pybind11 version, by default ``v2.6.2`` can be set using:
114
+
When using the subdirectory build, if neither is set, CARMA will provide the ``pybind11`` target at build time and store a clone in ``carma/extern/pybind11``. The Pybind11 version, by default ``v2.6.2`` can be set using:
0 commit comments