webapps / hmc /reference /scripts /build-ants.sh
gdevenyi's picture
hmc: NiFreeze 3bcfb00 and QSIPrep 26.1.1 SHORELine reference runs on ds005577 sub-107 (part 9)
a4ba047 verified
Raw History Blame Contribute Delete
1.64 kB
#!/usr/bin/env bash
# Native ANTs build at the commit of the repository's ANTs WASM (SuperBuild, Release, Ninja).
# The top-level ninja runs one external project at a time; each inner build uses 4 jobs.
# Only ITK, the ANTs configure step, and the antsRegistration and antsApplyTransforms
# targets are built (not the other core apps).
set -euo pipefail
export TMPDIR=/var/tmp/dwi-tmp
export CMAKE_BUILD_PARALLEL_LEVEL=4
# CMake 4 removed compatibility with cmake_minimum_required < 3.5 (ITK externals).
export CMAKE_POLICY_VERSION_MINIMUM=3.5
SRC=/var/tmp/dwi-hmc/ants/src
BUILD=/var/tmp/dwi-hmc/ants/build
mkdir -p "$BUILD"
# GCC 16's libstdc++ no longer includes <cstdint> transitively; ITK 5.4.3 headers
# (itkFloatingPointExceptions.h) rely on it. Force-include stdint.h (C header, so the C++98 HDF5 units also compile); no numeric effect.
# GCC 16 defaults to C23, where K&R "()" prototypes take no arguments (MINC ParseArgv.c); use gnu17 for C.
cmake -G Ninja -S "$SRC" -B "$BUILD" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
"-DCMAKE_CXX_FLAGS=-include stdint.h" \
"-DCMAKE_C_FLAGS=-std=gnu17" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DRUN_SHORT_TESTS=OFF \
-DRUN_LONG_TESTS=OFF \
-DBUILD_ALL_ANTS_APPS=OFF \
-DITK_BUILD_MINC_SUPPORT=OFF \
-DUSE_VTK=OFF \
-DCMAKE_INSTALL_PREFIX=/var/tmp/dwi-hmc/ants/install
ninja -C "$BUILD" -j1 ITKv5
ninja -C "$BUILD" -j1 ANTS-prefix/src/ANTS-stamp/ANTS-configure
ninja -C "$BUILD/ANTS-build" -j4 antsRegistration antsApplyTransforms
find "$BUILD/ANTS-build" -type f \( -name antsRegistration -o -name antsApplyTransforms \) -perm -u+x