-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure
executable file
·259 lines (228 loc) · 8.46 KB
/
configure
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#!/bin/bash
echo Command line: ./configure $@
# save config command to log
echo Command line: ./configure $@ > config.log
# NOTE: this is a simple script wrapper around the cmake command line tools, for
# those used to the autotools configure script conventions
# also, cmake has rather lame command-line args so this is generally quite useful
# for the lazy typers as well.
# save these for later!
orig_args=$@
# get rid of any "clean" args!
orig_args="${orig_args//--clean}"
orig_args="${orig_args//-clean}"
orig_args="${orig_args//clean}"
echo "Running simple configure script wrapper around cmake build system!"
echo "args are:"
echo " --enable-debug (or --debug) enable debug, non-optimized build"
echo " --enable-release (or --release) enable release, maximum optimized build (-O3 on gcc)"
echo " --prefix=<path> set the install prefix to path"
echo " --suffix=<name> add an extra custom suffix on the end of build files"
echo " --enable-mpi (or --mpi) enable MPI distributed memory parallel build"
echo " --clean clean existing cmake cache etc first: start fresh"
echo " --build-dir=<name> provide a custom build directory name (else auto)."
echo " --generator=<name> use given code generator (-G in cmake, which also works)"
echo " --verbose-build (or --verbose or -v) turn on verbose make output: for make probs"
echo " --not-native don't define -march=native for compilation, which is otherwise the default -- only needed for making packages that will run more broadly"
echo " --emer-mac-arch-bits=NN set up for 32-bit or 64-bit compilation"
echo " --qt5 configure for Qt5 -- must set QTDIR enviro var to qt install dir (e.g., /usr/local/Qt5.2.0/5.2.0/clang_64)"
echo " --qt3d configure for Qt3D instead of Coin3D / Quarter"
echo " --qt4 configure for Qt4 -- either qt5 or 4 must be explicitly set, just to be sure you got the right one"
echo " --webkit for qt5 with version >= 5.6, use WebKit instead of WebEngine"
echo " --noweb do not use either webkit or webengine -- e.g., for clusters"
echo " --c++11 enable c++11 support, using e.g., -std=c++11 flag"
echo " --sanitize enable advanced sanitization on clang: -fsanitize=address"
echo " (requires recent / latest clang version)"
echo " --enable-cuda (or --cuda) enable NVIDIA CUDA support (add after other options) -- sets suffix to _cuda"
echo " --enable-hpcprof (or --hpcprof) enable hpctoolkit profiling control with root.MonControl method"
echo " --flags=\"your own flags\" include your own custom flags"
echo " "
echo " (note: -- before args is optional, and - works too!)"
echo " "
cmake_cmd=""
build_dir="build"
extra_suffix=""
not_native=""
qt_version=""
while [ $# -gt 0 ]
do
preq=${1%%=*} # get part before =
# echo $preq
case $preq
in
--help | -help | help)
exit 0
;;
--suffix | -suffix | suffix)
extra_suffix=${1##*=} # get part after =
cmake_cmd="$cmake_cmd -DEXTRA_SUFFIX=$extra_suffix"
build_dir="${build_dir}${extra_suffix}"
shift 1
;;
--debug | --enable-debug | debug | enable-debug | -debug | -enable-debug | d | -d)
debug=true
cmake_cmd="$cmake_cmd -DCMAKE_BUILD_TYPE=Debug"
build_dir="${build_dir}_dbg"
shift 1
;;
--release | --enable-release | release | enable-release | -release | -enable-release | r | -r)
cmake_cmd="$cmake_cmd -DCMAKE_BUILD_TYPE=Release"
shift 1
;;
--prefix | -prefix | prefix | p | -p)
prefix=${1##*=} # get part after =
cmake_cmd="$cmake_cmd -DCMAKE_INSTALL_PREFIX=$prefix"
shift 1
;;
--enable-mpi | --mpi | mpi | enable-mpi | -mpi | -enable-mpi)
mpi=true
cmake_cmd="$cmake_cmd -DMPI_BUILD=true"
build_dir="${build_dir}_mpi"
shift 1
;;
--enable-cuda | --cuda | cuda | enable-cuda | -cuda | -enable-cuda)
cuda=true
extra_suffix="_cuda"
cmake_cmd="$cmake_cmd -DCUDA_BUILD=true -DEXTRA_SUFFIX=$extra_suffix"
build_dir="${build_dir}_cuda"
shift 1
;;
--enable-hpcprof | --hpcprof | hpcprof | enable-hpcprof | -hpcprof | -enable-hpcprof)
hpcprof=true
cmake_cmd="$cmake_cmd -DHPCPROF_BUILD=true"
shift 1
;;
--clean | -clean | clean | -c)
clean=true
shift 1
;;
--verbose-build | --verbose | verbose | -v | v | -verbose | verbose-build | -verbose-build)
verbose_build=true
shift 1
;;
# configure scripts generated by autotools use --build for a different
# purpose (to indicate architecture). Don't allow such shortcuts here,
# because they interfere with the MOTU scripts.
--build-dir | -build-dir | build-dir) # | build | --build | -build)
build_dir=${1##*=} # get part after =
shift 1
;;
--generator | -generator | generator | --gen | -gen | gen | -G)
gen_name="${1##*=}" # get part after =
generator="-G ${gen_name}"
cmake_cmd="$cmake_cmd $generator"
gen_down=`echo "$gen_name" | tr '[:upper:]' '[:lower:]'`
gen_short="${gen_down:0:2}"
build_dir="${build_dir}_${gen_short}"
shift 1
;;
# needed for MOTU
--includedir | --mandir | --infodir | --sysconfdir | --localstatedir | --libexecdir | --disable-maintainer-mode | --disable-dependency-tracking)
shift 1
;;
--not-native | -not-native | not-native)
not_native="not-native"
cmake_cmd="$cmake_cmd -DNOT_NATIVE=not-native"
shift 1
;;
--emer-mac-arch-bits)
cmake_cmd="$cmake_cmd -DEMER_MAC_ARCH_BITS=${1##*=}"
shift 1
;;
--qt5 | -qt5 | qt5)
cmake_cmd="$cmake_cmd -DQT_USE_5=ON -DQTDIR=$QTDIR"
qt_version="qt5"
shift 1
;;
--qt4 | -qt4 | qt4)
cmake_cmd="$cmake_cmd -DQT_USE_4=ON -DQTDIR=$QTDIR"
qt_version="qt4"
shift 1
;;
--qt3d | -qt3d | qt3d)
cmake_cmd="$cmake_cmd -DQT_USE_3D=ON"
shift 1
;;
--sanitize | -sanitize | sanitize)
sanitize="sanitize"
cmake_cmd="$cmake_cmd -DSANITIZE=ON"
shift 1
;;
--webkit | -webkit | webkit)
webkit="webkit"
cmake_cmd="$cmake_cmd -DUSE_QT_WEBKIT=ON"
shift 1
;;
--noweb | -noweb | noweb)
noweb="noweb"
cmake_cmd="$cmake_cmd -DUSE_QT_NOWEB=ON"
shift 1
;;
--c++11 | -c++11 | c++11)
cmake_cmd="$cmake_cmd -DCMAKE_CXX_FLAGS=-std=c++11"
c11="c++11"
shift 1
;;
--flags | -flags | flags)
flgs="${1#*=}" # get part after =
# echo $flgs
cmake_cmd="$cmake_cmd -DCMAKE_CXX_FLAGS=\"$flgs\""
shift 1
;;
*)
echo "Invalid argument -- please see above list"
shift 1
;;
esac
done
if [[ "$qt_version" == "" ]]; then
echo "ERROR: you must specify either qt5 or qt4 -- pretty soon it will default to qt5, but right now there is enough ambiguity that you must specify which one explicitly."
exit 1
fi
if [[ $verbose_build == "true" ]]; then
cmake_cmd="$cmake_cmd -DCMAKE_VERBOSE_MAKEFILE=ON"
else
cmake_cmd="$cmake_cmd -DCMAKE_VERBOSE_MAKEFILE=OFF"
fi
# Support building in trunk by passing in pwd keyword
# $(pwd) didn't work for out of source builds
if [[ "$build_dir" == "pwd" ]];
then
# Don't run cmake in your home directory..
# Also don't try to make or go to the build dir, we are already there
cmake_cmd="$(echo $cmake_cmd | sed 's/\.\.\///')"
else
mkdir -p "$build_dir"
cd "$build_dir" || exit 1
fi
echo " "
echo "####################################################"
echo "configure script settings:"
echo " debug: $debug"
echo " prefix: $prefix"
echo " suffix: $extra_suffix"
echo " mpi: $mpi"
echo " cuda: $cuda"
echo " hpcprof: $hpcprof"
echo " clean: $clean"
echo " build-dir: $build_dir"
echo " qt-version: $qt_version, webkit: $webkit noweb: $noweb"
echo " generator: $generator"
echo " verbose: $verbose_build"
echo " sanitize: $sanitize"
echo " c11: $c11"
echo " flags: $flgs"
echo " "
echo " cmake command: cmake ../ $cmake_cmd"
echo " "
if [[ $clean == "true" ]]; then
echo "NOTE: Cleaning files now!"
/bin/rm -rf *
fi
echo ${orig_args} > configure.opts
cmake ../ $cmake_cmd
echo " "
echo "####################################################"
echo "Now you must type: cd $build_dir; make; make install"
echo "to actually build and install the software"
echo " "