- Ensure you have an environment with CMake and compilers available (see requirements.txt)
- Dependencies:
- HDF5 (Required)
- gemmi (Required)
- Eigen (Optional, downloaded if missing)
- nlohmann/json (Optional, downloaded if missing)
- {fmt} (Optional, downloaded if missing)
- GoogleTest (Optional, downloaded if missing)
mkdir build
cd build
cmake ..
You can then build with make, and run a test with ./tests/test_crystal.
You can enable debugging printout by setting the DX2_DEBUG environment
variable before running.
See https://google.github.io/googletest/primer.html. The tests subdirectory
has an example test.
You can run test executables directly, run ctest, or run make test (or
via your preferred build tool).
In which case the normal CMake package finding should work:
find_package(DX2)If you want to integrate dx2 development into your current project, you can check dx2 out into a subfolder (or submodule) of your build, and include it with:
add_subdirectory(path/to/dx2)If you don't need to develop dx2 but just want to use it, you can get CMake to automatically download and include it in your project with:
include(FetchContent)
FetchContent_Declare(
dx2
GIT_REPOSITORY [email protected]:dials/dx2.git
GIT_TAG main
FIND_PACKAGE_ARGS
)
FetchContent_MakeAvailable(dx2)
...
# Example adding to a target
target_link_libraries(my-target PUBLIC dx2)Caution
This is linking directly to the main branch. This is bad practice as it
makes it non-trivial to ensure updates, but while the project is in the
incubation stages we don't have a public release tag to base it on.