forked from feelpp/feelpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·404 lines (381 loc) · 13.9 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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
#!/bin/sh
usage()
{
msg=$1
if [ -n "$msg" ]; then
echo "Error: $msg"
fi
cat <<EOT
$0 [options...]
Options:
-b, --build build type: Debug, Release, RelWithDebInfo
-d, --debug debug mode
-rd, --relwithdebinfo relwithdebinfo mode
-r, --release release mode
--std=c++xx c++ standard c++17,c++14, c++2a (default: c++17)
--stdlib=libxx c++ standard library libstdc++, libc++ (default: libstdc++)
--max-order=x maximum polynomial order to instantiate(default: 3)
--cxxflags override cxxflags
--cmakeflags add extra cmake flags
--prefix=PATH define install path
--root=PATH define root path
--enable-pch enable precompiled headers (default)
--disable-pch disable precompiled headers
--enable-python=<python executable> enable python
--enable-cling enable cling
--disable-cling disable cling (default)
--disable-asan disable asan
--disable=<module> space separated list of <module>s to disable : --disable="ipopt nlopt"
--enable-toolboxes enable Feel++ toolboxes and PyFeel++ toolboxes
--disable-toolboxes disable Feel++ toolboxes and PyFeel++ toolboxes (by default)
--enable-mor enable Feel++ mor and PyFeel++ mor
--disable-mor disable Feel++ mor and PyFeel++ mor (by default)
-v, --verbose enable verbose output
-h, --help help page
--<package>-dir=PACKAGE_PATH define <package> install directory
--disable-<package> disable <package>
--generator=GENERATOR cmake generator
EOT
}
_HAS_ERROR=no
_WANT_HELP=no
PROJECT_INSTALL_PREFIX=$(dirname `pwd`)/install-$(basename `pwd`)
PROJECT_STD_CPP=17
PROJECT_MAX_ORDER=3
PROJECTSRCROOT=`dirname $0`
GENERATOR="Unix Makefiles"
# If an environment variable PWD exists, use first that one because it is
# preferable than the command `pwd` which does not take into account linls and
# may show NFS mountpoints (on some platforms)
if [ "X${BUILDROOT}" = "X" ]; then
if [ "X${PWD}" = "X" ]; then
BUILDROOT=`pwd`
else
BUILDROOT=${PWD}
fi
fi
BUILDTYPE=Release
_WANT_PCH=no
_WANT_PYTHON=yes
_WANT_ASAN=no
_WANT_CLING=yes
_WANT_VERBOSE=no
_WANT_DEBUG=no
_WANT_ASAN=no
_WANT_RELWITHDEBINFO=no
_WANT_OG=no
_WANT_CHECK=no
_HAS_CONFIG=no
_WANT_DEV_WARNINGS=
_WANT_NUMERICS=TRUE
_WANT_LOCAL_CONFIG=no
_WANT_DISABLE=""
_WANT_TOOLBOXES=no
_WANT_MOR=no
CXXFLAGS=
CMAKEFLAGS=
ENABLE_NUMA=TRUE
ENABLE_CUDA=TRUE
PROJECT_STDLIB_CPP=stdc++
THISCOMMAND="$0 $@"
while [ -n "$1" ]; do
case $1 in
--build=*)
BUILDTYPE=`echo $1 | sed "s,^--build=\(.*\),\1,"`
export BUILDTYPE
;;
--generator=*)
GENERATOR=`echo $1 | sed "s,^--generator=\(.*\),\1,"`
export GENERATOR
;;
--prefix=*)
PROJECT_INSTALL_PREFIX=`echo $1 | sed "s,^--prefix=\(.*\),\1,"`
export PROJECT_INSTALL_PREFIX
;;
--root=*)
temp=`echo $1 | sed "s,^--root=\(.*\),\1,"`
if [ "x$temp" != "xfeelpp" ]; then
PROJECTSRCROOT=$temp
fi
export PROJECTSRCROOT
;;
--mpi-dir=*)
MPI_ROOT=`echo $1 | sed "s,^--mpi-dir=\(.*\),\1,"`
export MPI_ROOT
;;
--tbb-dir=*)
TBB_ROOT=`echo $1 | sed "s,^--tbb-dir=\(.*\),\1,"`
export MPI_ROOT
;;
--mkl-dir=*)
MKL_ROOT=`echo $1 | sed "s,^--mkl-dir=\(.*\),\1,"`
export MKL_ROOT
;;
--numa-dir=*)
NUMA_ROOT=`echo $1 | sed "s,^--numa-dir=\(.*\),\1,"`
export NUMA_ROOT
;;
--disable-numa)
ENABLE_NUMA=FALSE
;;
--cuda-dir=*)
CUDA_ROOT=`echo $1 | sed "s,^--cuda-dir=\(.*\),\1,"`
export CUDA_ROOT
;;
--disable-cuda)
ENABLE_CUDA=FALSE
;;
--boost-dir=*)
BOOST_ROOT=`echo $1 | sed "s,^--boost-dir=\(.*\),\1,"`
export BOOST_ROOT
;;
--eigen3-dir=*)
EIGEN3_ROOT=`echo $1 | sed "s,^--eigen3-dir=\(.*\),\1,"`
export EIGEN3_ROOT
;;
--gmsh-dir=*)
GMSH_DIR=`echo $1 | sed "s,^--gmsh-dir=\(.*\),\1,"`
export GMSH_DIR
;;
--petsc-dir=*)
PETSC_DIR=`echo $1 | sed "s,^--petsc-dir=\(.*\),\1,"`
export PETSC_DIR
;;
--debug|-d)
BUILDTYPE=Debug
_WANT_CHECK=yes
;;
--relwithdebinfo|-rd)
BUILDTYPE=Relwithdebinfo
;;
--check)
_WANT_CHECK=yes
;;
--verbose|-v)
_WANT_VERBOSE=yes
;;
--release|-r)
BUILDTYPE=Release
;;
--enable-pch)
_WANT_PCH=yes
;;
--disable-pch)
_WANT_PCH=no
;;
--enable-python)
_WANT_PYTHON=yes
;;
--enable-python=*)
PYTHON_EXECUTABLE=`echo $1 | sed "s,^--enable-python=\(.*\),\1,"`
export PYTHON_EXECUTABLE
_WANT_PYTHON=yes
;;
--disable-python)
_WANT_PYTHON=no
;;
--enable-cling)
_WANT_CLING=yes
;;
--disable-cling)
_WANT_CLING=no
;;
--disable-asan)
_WANT_ASAN=no
;;
--enable-asan)
_WANT_ASAN=yes
;;
--disable=*)
_WANT_DISABLE=`echo $1 | sed "s,^--disable=\(.*\),\1,"`
export _WANT_DISABLE
;;
--enable-toolboxes)
_WANT_TOOLBOXES=yes
;;
--disable-toolboxes)
_WANT_TOOLBOXES=no
;;
--enable-mor)
_WANT_MOR=yes
;;
--disable-mor)
_WANT_MOR=no
;;
--max-order=*)
PROJECT_MAX_ORDER=`echo $1 | sed "s,^--max-order=\(.*\),\1,"`
echo "using max polynomial order instantiate $PROJECT_MAX_ORDER..."
export PROJECT_MAX_ORDER
;;
--std=c++*)
PROJECT_STD_CPP=`echo $1 | sed "s,^--std=c++\(.*\),\1,"`
echo "using c++$PROJECT_STD_CPP..."
export PROJECT_STD_CPP
;;
--stdlib=lib*)
PROJECT_STDLIB_CPP=`echo $1 | sed "s,^--stdlib=lib\(.*\),\1,"`
echo "using lib$PROJECT_STDLIB_CPP..."
export PROJECT_STDLIB_CPP
;;
--enable-opt)
CXXFLAGS="-march=native -mavx -mfma -msse4.2 -msse4.1 -mssse3 -msse3 -msse2"
;;
--enable-bench)
CXXFLAGS="-march=native -mavx -mfma -msse4.2 -msse4.1 -mssse3 -msse3 -msse2 -fno-omit-frame-pointer"
;;
--cxxflags=*)
CXXFLAGS=`echo $1 | sed "s,^--cxxflags=\(.*\),\1,"`
;;
--cmakeflags=*)
CMAKEFLAGS=`echo $1 | sed "s,^--cmakeflags=\(.*\),\1,"`
;;
--local-config)
_WANT_LOCAL_CONFIG=yes
LOCAL_CONFIG_DIR=CMake.local
;;
--no-projects|--no-research)
_DISABLE_RESEARCH=yes
;;
-Wno-dev)
_WANT_DEV_WARNINGS="-Wno-dev"
;;
-h | -help | --help | -?)
_WANT_HELP=yes
usage
exit 0
;;
*)
echo $1: param�tre inconnu
_WANT_HELP=yes;
_HAS_ERROR=yes
usage
exit 0
;;
esac
shift
done
cat <<EOT >reconfigure
#!/bin/sh
echo "Execute: CC=\"$CC\" CXX=\"$CXX\" $THISCOMMAND"
CC="$CC" CXX="$CXX" $THISCOMMAND
EOT
`chmod +x reconfigure`
# switch to ifp config when hostname is irlin*
if [ "${_WANT_LOCAL_CONFIG}" = "yes" ] ; then
CMAKE_FIND_DIR=${LOCAL_CONFIG_DIR}
else
CMAKE_FIND_DIR=CMake
fi
echo BUILDROOT=${BUILDROOT}
echo INSTALL_PREFIX=${PROJECT_INSTALL_PREFIX}
echo CMAKE_FIND_DIR=${CMAKE_FIND_DIR}
echo CMAKEFLAGS=${CMAKEFLAGS}
echo CXX=${CXX}
echo CC=${CC}
echo "# Do not edit" > cmake.configure
if [ "X${PROJECT_INSTALL_PREFIX}" != "X" ]; then
echo "SET(CMAKE_INSTALL_PREFIX \"${PROJECT_INSTALL_PREFIX}\" CACHE PATH \"Installation directory\" FORCE)" >> cmake.configure
echo "SET(CMAKE_SKIP_RPATH ON)" >> cmake.configure
fi
echo "SET(BUILDROOT ${BUILDROOT} CACHE PATH \"Compilation directory\")" >> cmake.configure
echo "SET(CMAKE_INSTALL_PREFIX \"${PROJECT_INSTALL_PREFIX}\" CACHE PATH \"Installation directory\" FORCE)" >> cmake.configure
echo "SET(CMAKE_EXPORT_COMPILE_COMMANDS ON)" >> cmake.configure
echo "SET(FEELPP_STD_CPP \"$PROJECT_STD_CPP\" CACHE PATH \"Feel++ c++ standard c++17, c++14 or c++2a\")" >> cmake.configure
echo "SET(FEELPP_STDLIB_CPP \"$PROJECT_STDLIB_CPP\" CACHE PATH \"Feel++ c++ standard library stdc++ or c++\")" >> cmake.configure
echo "SET(FEELPP_INSTANTIATION_ORDER_MAX \"$PROJECT_MAX_ORDER\" CACHE PATH \"Feel++ maximum polynomial order instantiation\")" >> cmake.configure
echo "SET(PROJECT_ROOT ${PROJECTSRCROOT} CACHE PATH \"Project root\")" >> cmake.configure
echo "SET(ARCH \"`arch`\" CACHE STRING \"Project ARCH\" FORCE)" >> cmake.configure
if [ "X${MKL_ROOT}" != "X" ]; then
echo "set(MKL_INCLUDE_PATH \"${MKL_ROOT}/include\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
echo "set(MKL_LIBRARY_PATH \"${MKL_ROOT}/lib/em64t\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
fi
if [ "X${EIGEN3_ROOT}" != "X" ]; then
echo "set(EIGEN3_INCLUDE_PATH \"${EIGEN3_ROOT}/include/eigen3\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
fi
if [ "X${CUDA_ROOT}" != "X" ]; then
echo "set(CUDA_INCLUDE_PATH \"${CUDA_ROOT}/cuda/include\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
echo "set(CUDA_LIBRARY_PATH \"${CUDA_ROOT}/cuda/lib64\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
fi
if [ "X${TBB_ROOT}" != "X" ]; then
echo "set(TBB_INCLUDE_PATH \"${TBB_ROOT}/include\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
echo "set(TBB_LIBRARY_PATH \"${TBB_ROOT}/lib\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
fi
if [ "X${BOOST_ROOT}" != "X" ]; then
echo "set(BOOST_INCLUDE_PATH \"${BOOST_ROOT}/include\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
echo "set(BOOST_LIBRARY_PATH \"${BOOST_ROOT}/lib\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
fi
if [ "X${NUMA_ROOT}" != "X" ]; then
echo "set(NUMA_INCLUDE_PATH \"${NUMA_ROOT}/include\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
echo "set(NUMA_LIBRARY_PATH \"${NUMA_ROOT}/lib64\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
fi
echo "SET(ENABLE_NUMA ${ENABLE_NUMA} CACHE BOOL \"Project enable numa\" FORCE)" >> cmake.configure
echo "SET(ENABLE_CUDA ${ENABLE_CUDA} CACHE BOOL \"Project enable cuda\" FORCE)" >> cmake.configure
if [ "X${GMSH_DIR}" != "X" ]; then
echo "set(GMSH_INCLUDE_DIR \"${GMSH_DIR}/include\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
echo "set(GMSH_LIBRARY_PATH \"${GMSH_DIR}/lib\" CACHE PATH \"root directory\" FORCE)" >> cmake.configure
fi
if [ "X${_DISABLE_RESEARCH}" != "X" ]; then
echo "option(FEELPP_ENABLE_RESEARCH OFF CACHE PATH \"enable research projects\" FORCE)" >> cmake.configure
fi
# PCH
if [ "X${_WANT_PCH}" = "Xyes" ]; then
echo "set(FEELPP_ENABLE_PCH ON CACHE PATH \"enable pch \" FORCE)" >> cmake.configure
echo "set(FEELPP_ENABLE_PCH_APPLICATIONS ON CACHE PATH \"enable pch \" FORCE)" >> cmake.configure
else
echo "set(FEELPP_ENABLE_PCH OFF CACHE PATH \"disable pch \" FORCE)" >> cmake.configure
echo "set(FEELPP_ENABLE_PCH_APPLICATIONS OFF CACHE PATH \"disable pch \" FORCE)" >> cmake.configure
fi
# PYTHON
if [ "X${_WANT_PYTHON}" = "Xyes" ]; then
echo "set(FEELPP_ENABLE_PYTHON_WRAPPING ON CACHE PATH \"enable python wrapping \" FORCE)" >> cmake.configure
echo "set(FEELPP_ENABLE_PYTHON ON CACHE PATH \"enable python \" FORCE)" >> cmake.configure
if [ "X${PYTHON_EXECUTABLE}" != "X" ]; then
CMAKEFLAGS="${CMAKEFLAGS} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}"
fi
else
echo "set(FEELPP_ENABLE_PYTHON_WRAPPING OFF CACHE PATH \"disable python wrapping \" FORCE)" >> cmake.configure
echo "set(FEELPP_ENABLE_PYTHON OFF CACHE PATH \"disable python \" FORCE)" >> cmake.configure
fi
# ASAN
if [ "X${_WANT_ASAN}" = "Xno" ]; then
echo "set(FEELPP_ENABLE_ASAN OFF CACHE PATH \"disable asan \" FORCE)" >> cmake.configure
else
echo "set(FEELPP_ENABLE_ASAN ON CACHE PATH \"enable asan \" FORCE)" >> cmake.configure
fi
# CLING
if [ "X${_WANT_CLING}" = "Xyes" ]; then
echo "set(FEELPP_ENABLE_CLING ON CACHE PATH \"enable cling \" FORCE)" >> cmake.configure
else
echo "set(FEELPP_ENABLE_CLING OFF CACHE PATH \"disable cling \" FORCE)" >> cmake.configure
fi
# TOOLBOXES
if [ "X${_WANT_TOOLBOXES}" = "Xyes" ]; then
echo "set(FEELPP_ENABLE_TOOLBOXES ON CACHE PATH \"enable Feel++ toolboxes \" FORCE)" >> cmake.configure
else
echo "set(FEELPP_ENABLE_TOOLBOXES OFF CACHE PATH \"disable Feel++ toolboxes \" FORCE)" >> cmake.configure
fi
# MOR
if [ "X${_WANT_MOR}" = "Xyes" ]; then
echo "set(FEELPP_ENABLE_MOR ON CACHE PATH \"enable Feel++ mor \" FORCE)" >> cmake.configure
else
echo "set(FEELPP_ENABLE_MOR OFF CACHE PATH \"disable Feel++ mor \" FORCE)" >> cmake.configure
fi
if [ "X${CXXFLAGS}" != "X" ]; then
echo "set(CMAKE_CXX_FLAGS_RELEASE \"${CXXFLAGS}\" CACHE STRING \"cxx flags\" FORCE)" >> cmake.configure
echo "set(CMAKE_CXX_FLAGS_DEBUG \"${CXXFLAGS}\" CACHE STRING \"cxxflags \" FORCE)" >> cmake.configure
fi
# Disable modules
if [ "X${_WANT_DISABLE}" != "X" ]; then
for _feature in ${_WANT_DISABLE}; do
feature=$(echo ${_feature} | tr [a-z] [A-Z])
echo "set(FEELPP_ENABLE_${feature} OFF CACHE PATH \"disable ${feature} \" FORCE)" >> cmake.configure
done
fi
#if [ "X${_WANT_OG}" != "X" ]; then
#echo "set( CMAKE_CXX_FLAGS_RELEASE \"-Og -DNDEBUG\" CACHE PATH \"CXX Release Flags \" FORCE)" >> cmake.configure
#fi
if [ -f CMakeCache.txt ]; then
/bin/rm CMakeCache.txt
fi
echo "cmake -Ccmake.configure -G "${GENERATOR}" -DCMAKE_VERBOSE_MAKEFILE:BOOL=${_WANT_VERBOSE} -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} ${CMAKEFLAGS} TRUE ${PROJECTSRCROOT}"
cmake -Ccmake.configure -G "${GENERATOR}" -DCMAKE_VERBOSE_MAKEFILE:BOOL=${_WANT_VERBOSE} -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} ${CMAKEFLAGS} TRUE ${PROJECTSRCROOT}