Build and install under Linux or macOS

Build and install libheinz, libformfactor, and BornAgain in that order. Use the same installation prefix for the two support libraries so that CMake can find them when configuring BornAgain.

Each project uses CMake. Create an out-of-source build directory inside each source directory. Run the following commands separately for libheinz and libformfactor:

INSTALL_PREFIX=/path/to/install
mkdir build
cd build
cmake .. -GNinja \
  -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" \
  -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX"
ninja
ctest -j8 --output-on-failure
ninja install

Return to the BornAgain source directory. For development, include the developer options in the CMake command:

mkdir build
cd build
cmake .. -GNinja \
  -DPython3_EXECUTABLE=/path/to/venv/bin/python \
  -DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" \
  -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX"
ninja
ctest -j8 --output-on-failure
ninja ba_wheel
ninja install

CMAKE_PREFIX_PATH can contain a semicolon-separated list when dependencies are installed under several prefixes. See Run tests for further CTest commands and developer checks.

The wheel is written below build/py/wheel/. To install it with uv, run:

uv pip install --python /path/to/venv/bin/python \
  path/to/bornagain-wheel.whl

or use the environment’s Python interpreter:

/path/to/venv/bin/python -m pip install path/to/bornagain-wheel.whl

Installing the wheel is optional for development because the test suite uses the package directly from the build tree.