From 35c6706b3c13fed05870a4d433ea67a114a94f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Fr=C3=B6jdh?= Date: Mon, 18 Nov 2024 14:39:46 +0100 Subject: [PATCH] docs --- CMakeLists.txt | 1 + docs/src/Consume.rst | 19 +++++++++++++++ docs/src/Installation.rst | 51 +++++++++++++++++++++------------------ docs/src/_install.rst | 23 ++++++++++++++++++ docs/src/index.rst | 3 ++- 5 files changed, 73 insertions(+), 24 deletions(-) create mode 100644 docs/src/Consume.rst create mode 100644 docs/src/_install.rst diff --git a/CMakeLists.txt b/CMakeLists.txt index 8294f00..dded128 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,7 @@ if (AARE_FETCH_FMT) USES_TERMINAL_DOWNLOAD TRUE ) set(FMT_INSTALL ON CACHE BOOL "") + set(FMT_CMAKE_DIR "") FetchContent_MakeAvailable(fmt) set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON) install(TARGETS fmt diff --git a/docs/src/Consume.rst b/docs/src/Consume.rst new file mode 100644 index 0000000..d62ba60 --- /dev/null +++ b/docs/src/Consume.rst @@ -0,0 +1,19 @@ +Use from C++ +======================== + +There are a few different way to use aare in your C++ project. Which one you choose +depends on how you intend to work with the library and how you manage your dependencies. + + +Install and use cmake with find_package(aare) +------------------------------------------------- + +https://github.com/slsdetectorgroup/aare-examples + +.. include:: _install.rst + + +Use as a submodule +------------------- + +Coming soon... \ No newline at end of file diff --git a/docs/src/Installation.rst b/docs/src/Installation.rst index 250310f..4e2e706 100644 --- a/docs/src/Installation.rst +++ b/docs/src/Installation.rst @@ -1,8 +1,17 @@ +**************** Installation -=============== +**************** + +.. attention :: + + - https://cliutils.gitlab.io/modern-cmake/README.html conda/mamaba -~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~ + +This is the recommended way to install aare. Using a package manager makes it easy to +switch between versions and is (one of) the most convenient way to install up to date +dependencies on older distributions. .. note :: @@ -16,8 +25,11 @@ conda/mamaba conda install aare=2024.11.11.dev0 -c slsdetectorgroup -cmake (development install) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +cmake build (development install) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you are working on aare or want to test our a version that doesn't yet have +a conda package. Build using cmake and then run from the build folder. .. code-block:: bash @@ -32,30 +44,23 @@ cmake (development install) make -j4 - # add the build folder to your PYTHONPATH + # add the build folder to your PYTHONPATH and then you should be able to + # import aare in python -cmake install and use in your C++ project -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +cmake build + install and use in your C++ project +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. code-block:: bash +.. warning :: - #build and install aare - git clone git@github.com:slsdetectorgroup/aare.git --branch=v1 #or using http... - mkdir build - cd build - - #configure using cmake - cmake ../aare -DCMAKE_INSTALL_PREFIX=/where/to/put/aare - - #build (replace 4 with the number of threads you want to use) - make -j4 - - #install - make install + When building aare with default settings we also include fmt and nlohmann_json. + Installation to a custom location is highly recommended. - #Now configure your project - cmake .. -DCMAKE_PREFIX_PATH=SOME_PATH +.. note :: + + It is also possible to install aare with conda and then use in your C++ project. + +.. include:: _install.rst cmake options diff --git a/docs/src/_install.rst b/docs/src/_install.rst new file mode 100644 index 0000000..2c453bd --- /dev/null +++ b/docs/src/_install.rst @@ -0,0 +1,23 @@ +.. code-block:: bash + + #build and install aare + git clone git@github.com:slsdetectorgroup/aare.git --branch=developer #or using http... + mkdir build + cd build + + #configure using cmake + cmake ../aare -DCMAKE_INSTALL_PREFIX=/where/to/put/aare + + #build (replace 4 with the number of threads you want to use) + make -j4 + + #install + make install + + #Go to your project + cd /your/project/source + + #Now configure your project + mkdir build + cd build + cmake .. -DCMAKE_PREFIX_PATH=SOME_PATH \ No newline at end of file diff --git a/docs/src/index.rst b/docs/src/index.rst index 577c721..3b1e85c 100644 --- a/docs/src/index.rst +++ b/docs/src/index.rst @@ -8,10 +8,11 @@ AARE .. toctree:: :caption: Installation - :maxdepth: 1 + :maxdepth: 3 Installation Requirements + Consume