conda env create -f dev/conda.yml
- Build for debubbing & testing:
cmake -S . -B build-test -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=On;
cmake --build build-test --verbose;
ctest --test-dir build-test;
- Build for release with debugging symbols:
cmake -S. -B build-release-debug -DCMAKE_BUILD_TYPE=RelWithDebInfo;
cmake --build build-release-debug --verbose;
- Build for release:
cmake -S. -B build-release -DCMAKE_BUILD_TYPE=Release;
cmake --build build-release --verbose;
For debugging and testing, it is recommended to build using the LLVM toolchain provided by Homebrew as Apple LLVM does not include sanitizers for debugging memory leaks.
To do so:
- Install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install LLVM:
brew install llvm
- configure build using the homebrew cmake toolchain:
cmake -S . -B build-test -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE="darwin/homebrew-llvm.cmake" -DBUILD_TESTING=On;
- build as usual:
cmake --build build-test --verbose;
- test using ASAN and LSAN options
ASAN_OPTIONS=detect_leaks=1 LSAN_OPTIONS="suppressions=../darwin/darwin.lsan" ctest --test-dir ./build-test/ --output-on-failure