-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_quit.sh
More file actions
executable file
·71 lines (64 loc) · 2.54 KB
/
Copy pathbuild_quit.sh
File metadata and controls
executable file
·71 lines (64 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Build QUIT + dependencies from source on ARM64/aarch64 (DGX Spark)
# Tested on Ubuntu 24.04, aarch64, GCC 13.3
#
# Prerequisites (all available via apt on Ubuntu 24.04):
# cmake (>=3.29 via pip), build-essential, libeigen3-dev, zlib1g-dev,
# libceres-dev, nlohmann-json3-dev, libargs-dev
#
# Usage: bash build_quit.sh
set -euo pipefail
PREFIX="${HOME}/.local"
NPROC=$(nproc)
# 1. CMake >= 3.29 (system cmake 3.28 is too old)
pip install cmake --upgrade 2>/dev/null
# 2. libfmt 11 (system has libfmt 9, QUIT needs 11)
if [ ! -f "${PREFIX}/lib/libfmt.a" ]; then
echo "=== Building libfmt 11 ==="
cd /tmp && rm -rf fmt
git clone --depth 1 --branch 11.0.0 https://github.com/fmtlib/fmt.git
cd fmt && mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DFMT_TEST=OFF
make -j${NPROC} && make install
fi
# 3. args cmake config (libargs-dev has no cmake integration)
mkdir -p "${PREFIX}/share/cmake/args"
cat > "${PREFIX}/share/cmake/args/argsConfig.cmake" << 'CMEOF'
add_library(taywee_args INTERFACE)
target_include_directories(taywee_args INTERFACE /usr/include)
add_library(taywee::args ALIAS taywee_args)
set(args_FOUND TRUE)
CMEOF
# 4. ITK 5.4 from source (with system Eigen to avoid version conflicts)
ITK_SRC="${HOME}/dev/ITK"
ITK_BUILD="${HOME}/dev/ITK-build"
if [ ! -f "${PREFIX}/lib/cmake/ITK-5.4/ITKConfig.cmake" ]; then
echo "=== Building ITK 5.4 ==="
[ -d "${ITK_SRC}/.git" ] || git clone --depth 1 --branch v5.4.2 \
https://github.com/InsightSoftwareConsortium/ITK.git "${ITK_SRC}"
mkdir -p "${ITK_BUILD}" && cd "${ITK_BUILD}"
cmake "${ITK_SRC}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF \
-DITK_USE_SYSTEM_EIGEN=ON
make -j${NPROC} && make install
fi
# 5. QUIT
echo "=== Building QUIT ==="
QUIT_SRC="${HOME}/dev/QUIT"
[ -d "${QUIT_SRC}/.git" ] || git clone --depth 1 \
https://github.com/spinicist/QUIT.git "${QUIT_SRC}"
mkdir -p "${QUIT_SRC}/build" && cd "${QUIT_SRC}/build" && rm -rf *
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${PREFIX}" \
-DCMAKE_PREFIX_PATH="${PREFIX};${PREFIX}/lib/cmake;${PREFIX}/share/cmake" \
-DITK_DIR="${PREFIX}/lib/cmake/ITK-5.4" \
-Dfmt_DIR="${PREFIX}/lib/cmake/fmt"
make -j${NPROC} && make install
echo ""
echo "=== QUIT installed ==="
echo "Binary: ${PREFIX}/bin/qi"
echo "Add to shell: export LD_LIBRARY_PATH=${PREFIX}/lib:\$LD_LIBRARY_PATH"
${PREFIX}/bin/qi --version 2>/dev/null || ${PREFIX}/bin/qi --help 2>&1 | head -3