# Build dependencies:
# This script builds the dependencies required for BornAgain.
# It is used in the Dockerfile and will executed once,
# when the Docker image is built.

REPO_DIR=/home/repo/
MLZ_REPOS="libcerf libheinz libformfactor"
for repo in ${MLZ_REPOS}; do
    dest="${REPO_DIR}/${repo}"
    echo "# Setup '${repo}' in ${dest}..."
    git clone -b main --single-branch --depth 1 https://jugit.fz-juelich.de/mlz/${repo}.git ${dest}
    cd $dest
    cmake -B ./build -DCMAKE_BUILD_TYPE=Release
    cmake --build ./build -j`nproc`
    cmake --install ./build
    echo "DONE."
done
