-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathinstallANTs.sh
executable file
·133 lines (90 loc) · 2.89 KB
/
installANTs.sh
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
antsBuildInstructions="https://github.com/ANTsX/ANTs/wiki/Compiling-ANTs-on-Linux-and-Mac-OS"
# Number of threads used by make
buildThreads=4
echo "
This script will download ANTs, build and install under the current directory.
Developer tools including compilers, git and cmake must be installed.
This script will attempt to build with $buildThreads threads. If your processor, RAM
or swap space are limited, try building with a single thread.
If you encounter errors, please see the installation instructions at
$antsBuildInstructions
Build will proceed in 8 seconds
"
sleep 8
workingDir=${PWD}
# Clone the repo
git clone https://github.com/ANTsX/ANTs.git
# If you want to build a particular release, do so here
# cd ANTs
# git checkout v2.3.1
# cd -
# Where to build, should be an empty directory
buildDir=${workingDir}/build
installDir=${workingDir}/install
mkdir $buildDir $installDir
cd $buildDir
# USE_VTK must be turned on to build antsSurf
#
# CMake may incorrectly detect the CPU architecture on Apple Silicon machines
# This is reported in the logs as "Arch detected: 'x86_64'"
# If you see this and the subsequent error "unknown target CPU",
# add -DCMAKE_OSX_ARCHITECTURES=arm64 to the call below
cmake \
-DCMAKE_INSTALL_PREFIX=$installDir \
-DBUILD_SHARED_LIBS=OFF \
-DUSE_VTK=OFF \
-DBUILD_TESTING=OFF \
-DRUN_LONG_TESTS=OFF \
-DRUN_SHORT_TESTS=OFF \
${workingDir}/ANTs 2>&1 | tee cmake.log
if [[ $? -ne 0 ]]; then
echo "ANTs SuperBuild configuration failed. Please review documentation at
$antsBuildInstructions
If opening an issue, please attach
${buildDir}/cmake.log
${buildDir}/CMakeCache.txt
${buildDir}/CMakeFiles/CMakeError.log
${buildDir}/CMakeFiles/CMakeOutput.log
"
exit 1
fi
make -j $buildThreads 2>&1 | tee build.log
if [[ ! -f "CMakeFiles/ANTS-complete" ]]; then
echo "ANTs compilation failed. Please review documentation at
$antsBuildInstructions
If opening an issue, please attach
${buildDir}/build.log
${buildDir}/cmake.log
${buildDir}/CMakeCache.txt
${buildDir}/CMakeFiles/CMakeError.log
${buildDir}/CMakeFiles/CMakeOutput.log
"
exit 1
fi
cd ANTS-build
make install 2>&1 | tee install.log
antsRegExe="${installDir}/bin/antsRegistration"
if [[ ! -f ${antsRegExe} ]]; then
echo "Installation failed. Please review documentation at
$antsBuildInstructions
If opening an issue, please attach
${buildDir}/build.log
${buildDir}/cmake.log
${buildDir}/CMakeCache.txt
${buildDir}/ANTS-build/install.log
${buildDir}/CMakeFiles/CMakeError.log
${buildDir}/CMakeFiles/CMakeOutput.log
and mention that you used this script with build command:
make -j $buildThreads
"
exit 1
fi
echo "Installation complete, running ${antsRegExe}"
${antsRegExe} --version
echo "
Binaries and scripts are located in
$installDir
Please see post installation instructions at
$antsBuildInstructions
"