TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
nda is a compiled library.
You can either
To use nda in your own C++
code, you simply have to include the relevant header files. For example:
If you use CMake to build your source code, you can fetch the h5 directly from the Github repository using CMake's FetchContent module:
This will link automatically to all of nda's dependencies, except for the HDF5 C library. If you need to use some of the HDF5 C library features, you can simply link to it via h5::hdf5
.
Note that the above will also build goolgetest and the unit tests for nda. To disable this, you can put set(Build_Tests OFF CACHE BOOL "" FORCE)
before fetching the content or by specifying -DBuild_Tests=OFF
on the command line.
If you have already installed nda on your system by following the instructions from the Installation page, you can also make use of CMake's find_package command. This has the advantage that you don't need to download anything, i.e. no internet connection is required. Furthermore, you only need to build the library once and can use it in multiple independent projects.
Let's assume that nda has been installed to path_to_install_dir
. Then linking your project to nda with CMake is as easy as
In case, CMake cannot find the package, you might have to tell it where to look for the nda-config.cmake
file by setting the variable nda_DIR
to path_to_install_dir/lib/cmake/nda
or by sourcing the provided ndavars.sh
before running CMake:
You can also integrate nda into your CMake project by placing the entire source tree in a subdirectory and call add_subdirectory()
:
Here, it is assumed that the nda source tree is in a subdirectory deps/nda
relative to your CMakeLists.txt
file.