forked from sandialabs/seacas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmake-config
executable file
·467 lines (416 loc) · 14.4 KB
/
cmake-config
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
#! /usr/bin/env bash
if [ "${TRAVIS}" == "true" ]
then
BUILDDIR=${1:-build}
mkdir $BUILDDIR && cd $BUILDDIR
else
EXTRA_ARGS=$@
fi
### The following assumes you are building in a subdirectory of ACCESS Root
### If not, then define "ACCESS" to point to the root of the SEACAS source code.
if [ "$ACCESS" == "" ]
then
ACCESS=$(cd ..; pwd)
fi
### The SEACAS code will install in ${INSTALL_PATH}/bin, ${INSTALL_PATH}/lib, and ${INSTALL_PATH}/include.
INSTALL_PATH=${INSTALL_PATH:-${ACCESS}}
### Possible subset of what is built ---
APPLICATIONS=${APPLICATIONS:-ON}
LEGACY=${LEGACY:-ON}
FORTRAN=${FORTRAN:-ON}
ZOLTAN=${ZOLTAN:-ON}
### Python Version...
PYTHON_VER=${PYTHON_VER:-"3.0"}
### Set to ON for parallel compile; otherwise OFF for serial (default)
if [ "${MPI}" = "" ]
then
netcdf_parallel=$($INSTALL_PATH/bin/nc-config --has-parallel)
if [ "${netcdf_parallel}" == "yes" ]
then
MPI=ON
else
MPI=OFF
fi
fi
echo "MPI set to ${MPI}"
if [ "${MPI}" == "OFF" ]
then
### Change this to point to the compilers you want to use
## Travis build (and others) set this to EXTERNAL to set
## CXX, CC, and FC externally.
COMPILER=${COMPILER:-gnu}
if [ "$COMPILER" == "gnu" ]
then
CXX=g++
CC=gcc
FC=gfortran
CFLAGS="-Wall -Wunused -pedantic -std=c11"
CXXFLAGS="-Wall -Wunused -pedantic"
fi
if [ "$COMPILER" == "gnumacport" ]
then
VER=${VER:-5}
CXX=g++-mp-${VER}
CC=gcc-mp-${VER}
FC=gfortran-mp-${VER}
CFLAGS="-Wall -Wunused -pedantic -std=c11"
CXXFLAGS="-Wall -Wunused -pedantic"
fi
if [ "$COMPILER" == "clang" ]
then
CXX=/opt/local/bin/clang++-mp-8.0
CC=clang-mp-8.0
FC=gfortran-mp-7
CFLAGS="-Wall -Wunused -pedantic"
CXXFLAGS="-Wall -Wunused -pedantic"
fi
if [ "$COMPILER" == "intel" ]
then
CXX=icpc
CC=icc
FC=ifort
CFLAGS="-Wall -Wunused"
CXXFLAGS="-Wall -Wunused"
fi
# When building: "scan-build make -j8"
if [ "$COMPILER" == "analyzer" ]
then
CXX=/opt/local/libexec/llvm-9.0/libexec/c++-analyzer
CC=/opt/local/libexec/llvm-9.0/libexec/ccc-analyzer
FC=gfortran
CFLAGS="-Wall -Wunused"
CXXFLAGS="-Wall -Wunused"
FORTRAN="OFF"
fi
if [ "$COMPILER" == "ibm" ]
then
CXX=xlC
CC=xlc
FC=xlf
fi
fi
if [ "${APPLICATIONS}" == "ON" ] && [ "${LEGACY}" == "ON" ]
then
SUBSET_OPTIONS="-DSEACASProj_ENABLE_ALL_PACKAGES:BOOL=ON \
-DSEACASProj_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON \
-DSEACASProj_ENABLE_SEACASSlice:BOOL=ON \
-DSEACASProj_ENABLE_SECONDARY_TESTED_CODE:BOOL=ON"
else
SUBSET_OPTIONS="-DSEACASProj_ENABLE_ALL_PACKAGES:BOOL=OFF \
-DSEACASProj_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \
-DSEACASProj_ENABLE_SECONDARY_TESTED_CODE:BOOL=OFF \
-DSEACASProj_ENABLE_SEACASIoss:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExodus:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExodus_for:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExoIIv2for32:BOOL=ON"
if [ "${APPLICATIONS}" == "ON" ]
then
SUBSET_OPTIONS="${SUBSET_OPTIONS} \
-DSEACASProj_ENABLE_SEACASAprepro:BOOL=ON \
-DSEACASProj_ENABLE_SEACASAprepro_lib:BOOL=ON \
-DSEACASProj_ENABLE_SEACASConjoin:BOOL=ON \
-DSEACASProj_ENABLE_SEACASEjoin:BOOL=ON \
-DSEACASProj_ENABLE_SEACASEpu:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExo2mat:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExo_format:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExodiff:BOOL=ON \
-DSEACASProj_ENABLE_SEACASMat2exo:BOOL=ON \
-DSEACASProj_ENABLE_SEACASNemslice:BOOL=ON \
-DSEACASProj_ENABLE_SEACASNemspread:BOOL=ON"
if [ "${FORTRAN}" == "ON" ]
then
SUBSET_OPTIONS="${SUBSET_OPTIONS} \
-DSEACASProj_ENABLE_SEACASExplore:BOOL=ON \
-DSEACASProj_ENABLE_SEACASGrepos:BOOL=ON"
fi
elif [ "${LEGACY}" == "ON" ] && [ "${FORTRAN}" == "ON" ]
then
SUBSET_OPTIONS="${SUBSET_OPTIONS} \
-DSEACASProj_ENABLE_SEACASAlgebra:BOOL=ON \
-DSEACASProj_ENABLE_SEACASBlot:BOOL=ON \
-DSEACASProj_ENABLE_SEACASEx1ex2v2:BOOL=ON \
-DSEACASProj_ENABLE_SEACASEx2ex1v2:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExomatlab:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExotec2:BOOL=ON \
-DSEACASProj_ENABLE_SEACASExotxt:BOOL=ON \
-DSEACASProj_ENABLE_SEACASFastq:BOOL=ON \
-DSEACASProj_ENABLE_SEACASGen3D:BOOL=ON \
-DSEACASProj_ENABLE_SEACASGenshell:BOOL=ON \
-DSEACASProj_ENABLE_SEACASGjoin:BOOL=ON \
-DSEACASProj_ENABLE_SEACASMapvar:BOOL=ON \
-DSEACASProj_ENABLE_SEACASMapvar-kd:BOOL=ON \
-DSEACASProj_ENABLE_SEACASNemesis:BOOL=ON \
-DSEACASProj_ENABLE_SEACASTxtexo:BOOL=ON"
fi
fi
GENERATOR=${GENERATOR:-"Unix Makefiles"}
# If using an XLF compiler on an IBM system, may need to add the following:
# -DCMAKE_Fortran_FLAGS="-qfixed=72" \
# -DCMAKE_EXE_LINKER_FLAGS:STRING="-lxl -lxlopt"
SHARED="${SHARED:-ON}"
### Switch for Debug or Release build:
### Check that both `DEBUG` and `BUILD_TYPE` are not set
if [ ! -z ${DEBUG+x} ] && [ ! -z ${BUILD_TYPE+x} ]
then
echo "ERROR: Both DEBUG and BUILD_TYPE are set. Only one is allowed."
exit
fi
BUILD_TYPE="${BUILD_TYPE:-RELEASE}"
if [ ! -z ${DEBUG+x} ]
then
if [ "${DEBUG}" == "ON" ] || [ "${DEBUG}" == "YES" ]
then
BUILD_TYPE="DEBUG"
elif [ "${DEBUG}" == "OFF" ] || [ "${DEBUG}" == "NO" ]
then
BUILD_TYPE="RELEASE"
else
echo "ERROR: Invalid value for DEBUG ('$DEBUG'). Must be 'ON', 'OFF', 'YES', 'NO'."
exit
fi
fi
### If you do not have the X11 developer package on your system
### which provides X11/Xlib.h and the libX11, then change the "ON"
### below to "OFF". It will disable blot and fastq
HAVE_X11=${X11:-ON}
### Set to ON to enable the building of a thread-safe version of the Exodus and IOSS libraries.
THREADSAFE=${THREADSAFE:-OFF}
if [ "$THREADSAFE" == "ON" ] ; then
THREAD_SAFE_OPT="-DSEACASProj_EXTRA_LINK_FLAGS=-lpthread"
fi
### TPLs --
### Make sure these point to the locations to find the libraries and includes in lib and include
### subdirectories of the specified paths.
### For example, netcdf.h should be in ${NETCDF_PATH}/include
NETCDF_PATH=${INSTALL_PATH}
PNETCDF_PATH=${INSTALL_PATH}
MATIO_PATH=${INSTALL_PATH}
HDF5_PATH=${INSTALL_PATH}
CGNS_PATH=${INSTALL_PATH}
DATAWAREHOUSE_PATH=${INSTALL_PATH}
ADIOS2_PATH=${INSTALL_PATH}
GTEST_PATH=${INSTALL_PATH}
KOKKOS_PATH=${INSTALL_PATH}
METIS_PATH=${INSTALL_PATH}
PARMETIS_PATH=${INSTALL_PATH}
function check_enable()
{
local path=$1
if [ -e "${path}" ]
then
echo "ON"
else
echo "OFF"
fi
}
HAVE_NETCDF=$(check_enable "${NETCDF_PATH}/include/netcdf.h")
HAVE_MATIO=$(check_enable "${MATIO_PATH}/include/matio.h")
HAVE_CGNS=$(check_enable "${CGNS_PATH}/include/cgnslib.h")
HAVE_DATAWAREHOUSE=OFF
HAVE_ADIOS2=$(check_enable "${ADIOS2_PATH}/include/adios2.h")
HAVE_GTEST=$(check_enable "${GTEST_PATH}/include/gtest/gtest.h")
HAVE_KOKKOS=$(check_enable "${KOKKOS_PATH}/include/Kokkos_Core.hpp")
HAVE_METIS=$(check_enable "${METIS_PATH}/include/metis.h")
HAVE_PARMETIS=$(check_enable "${METIS_PATH}/include/parmetis.h")
### DataWarp (Burst Buffer)
### I use the following for mutrino (10/16/2018):
### module load datawarp
### -D TPL_ENABLE_DataWarp:BOOL=ON \
### -D DataWarp_LIBRARY_DIRS:PATH=/opt/cray/datawarp/2.1.16-6.0.5.1_2.61__g238b34d.ari/lib \
### -D DataWarp_INCLUDE_DIRS:PATH=/opt/cray/datawarp/2.1.16-6.0.5.1_2.61__g238b34d.ari/include \
### Define to NO to *enable* exodus deprecated functions
OMIT_DEPRECATED=${OMIT_DEPRECATED:-NO}
# BUG needs to work with cray too.
if [ "${MPI}" == "ON" ] && [ "${CRAY}" == "ON" ]
then
MPI_EXEC=$(which srun)
MPI_SYMBOLS="-D MPI_EXEC=${MPI_EXEC} -D MPI_EXEC_NUMPROCS_FLAG=-n"
CXX=CC
CC=cc
FC=ftn
MPI_BIN=$(dirname $(which ${CC}))
SHARED=OFF
elif [ "${MPI}" == "ON" ]
then
if [ "${USE_SRUN}" == "ON" ]
then
MPI_EXEC=$(which srun)
MPI_SYMBOLS="-D MPI_EXEC=${MPI_EXEC} -D MPI_EXEC_NUMPROCS_FLAG=-N"
MPI_BIN=$(dirname "${MPI_EXEC}")
else
MPI_EXEC=$(which mpiexec)
MPI_SYMBOLS="-D MPI_EXEC=${MPI_EXEC}"
MPI_BIN=$(dirname "${MPI_EXEC}")
fi
CXX=mpicxx
CC=mpicc
FC=mpif77
fi
OS=$(uname -s)
if [ "$SHARED" == "ON" ]
then
if [ "$OS" == "Darwin" ] ; then
LD_EXT="dylib"
else
LD_EXT="so"
fi
else
LD_EXT="a"
fi
if [ "${HAVE_KOKKOS}" == "ON" ]
then
KOKKOS_SYMBOLS="-DKOKKOS_SRC_PATH:PATH=${INSTALL_PATH}/TPL/kokkos/kokkos \
-DTPL_Kokkos_LIBRARY_DIRS:PATH=${KOKKOS_PATH}/lib \
-DTPL_Kokkos_INCLUDE_DIRS:PATH=${KOKKOS_PATH}/include \
-DTPL_Kokkos_LIBRARIES=${KOKKOS_PATH}/lib/libkokkos.${LD_EXT}"
fi
if [ "${HAVE_DATAWAREHOUSE}" == "ON" ]
then
DW_SYMBOLS="-DTPL_ENABLE_DATAWAREHOUSE:BOOL=${HAVE_DATAWAREHOUSE} \
-DDataWarehouse_LIBRARY_DIRS:PATH=${DATAWAREHOUSE_PATH}/lib \
-DDataWarehouse_INCLUDE_DIRS:PATH=${DATAWAREHOUSE_PATH}/include"
fi
if [ "$OS" == "Darwin" ] ; then
DARWIN_OPT="-D CMAKE_MACOSX_RPATH:BOOL=ON -D TPL_X11_INCLUDE_DIRS:PATH=/opt/X11/include"
else
DARWIN_OPT=""
fi
# Only run doxygen if me and on master branch...
DOXYGEN=${DOXYGEN:-OFF}
if [[ "$DOXYGEN" == "OFF" && "$OS" == "Darwin" && "$MPI" == "OFF" ]] ; then
branch=$(git branch |grep \* |cut -c3-)
USER=$(id -nu)
if [ "$USER" == "gdsjaar" ] && [ "$branch" == "master" ]; then
DOXYGEN=ON
fi
fi
FC=${FC:-gfortran}
EXTRA_WARNINGS=${EXTRA_WARNINGS:-NO}
SANITIZER=${SANITIZER:-NO}
if [ "$SANITIZER" != "NO" ] ; then
### To use the clang sanitizers:
#sanitizer=address #: AddressSanitizer, a memory error detector.
#sanitizer=integer #: Enables checks for undefined or suspicious integer behavior.
#sanitizer=thread #: ThreadSanitizer, a data race detector.
#sanitizer=memory #: MemorySanitizer, experimental detector of uninitialized reads.
#sanitizer=undefined #: Fast and compatible undefined behavior checker.
#sanitizer=dataflow #: DataFlowSanitizer, a general data flow analysis.
#sanitizer=cfi #: control flow integrity checks. Requires -flto.
#sanitizer=safe-stack #: safe stack protection against stack-based memory corruption errors.
SANITIZE="-fsanitize=${SANITIZER} -fno-omit-frame-pointer -fPIC"
fi
### You can add these below if you want more verbosity...
#-D CMAKE_VERBOSE_MAKEFILE:BOOL=ON \
#-D SEACASProj_VERBOSE_CONFIGURE=ON \
### You can add these below to regenerate the flex and bison files for
### aprepro and aprepro_lib May have to touch aprepro.l aprepro.y
### aprepro.ll and aprepro.yy to have them regenerate
#-D GENERATE_FLEX_FILES=ON \
#-D GENERATE_BISON_FILES=ON \
if [ "$EXTRA_WARNINGS" == "YES" ] ; then
### Additional gcc warnings:
if [ "$COMPILER" == "gnu" ]
then
COMMON_WARNING_FLAGS="\
-Wshadow -Wabsolute-value -Waddress -Waliasing -Wpedantic\
"
C_WARNING_FLAGS="${COMMON_WARNING_FLAGS}"
CXX_WARNING_FLAGS="${COMMON_WARNING_FLAGS} -Wnull-dereference -Wzero-as-null-pointer-constant -Wuseless-cast -Weffc++ -Wsuggest-override"
# -Wuseless-cast
# -Wold-style-cast
# -Wdouble-promotion
fi
if [ "$COMPILER" == "clang" ]
then
C_WARNING_FLAGS="-Weverything -Wno-missing-prototypes -Wno-sign-conversion -Wno-reserved-id-macro"
CXX_WARNING_FLAGS="-Weverything -Wno-c++98-compat -Wno-old-style-cast -Wno-sign-conversion -Wno-reserved-id-macro"
fi
fi
rm -f CMakeCache.txt
###------------------------------------------------------------------------
cmake -G "${GENERATOR}" \
-D CMAKE_CXX_COMPILER:FILEPATH=${CXX} \
-D CMAKE_C_COMPILER:FILEPATH=${CC} \
-D CMAKE_Fortran_COMPILER:FILEPATH=${FC} \
-D CMAKE_CXX_FLAGS="${CXXFLAGS} ${CXX_WARNING_FLAGS} ${SANITIZE}" \
-D CMAKE_C_FLAGS="${CFLAGS} ${C_WARNING_FLAGS} ${SANITIZE}" \
-D CMAKE_Fortran_FLAGS="${FFLAGS} ${F77_WARNING_FLAGS} ${SANITIZE}" \
-D SEACASProj_ENABLE_STRONG_C_COMPILE_WARNINGS=${EXTRA_WARNINGS} \
-D SEACASProj_ENABLE_STRONG_CXX_COMPILE_WARNINGS=${EXTRA_WARNINGS} \
-D CMAKE_INSTALL_RPATH:PATH=${INSTALL_PATH}/lib \
-D BUILD_SHARED_LIBS:BOOL=${SHARED} \
-D CMAKE_BUILD_TYPE=${BUILD_TYPE} \
${SUBSET_OPTIONS} \
-D SEACASProj_ENABLE_Zoltan:BOOL=${ZOLTAN} \
-D SEACASProj_ENABLE_TESTS=ON \
-D CMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} \
-D SEACASProj_SKIP_FORTRANCINTERFACE_VERIFY_TEST:BOOL=ON \
-D SEACASProj_HIDE_DEPRECATED_CODE:BOOL=${OMIT_DEPRECATED_CODE} \
-D SEACASProj_ENABLE_DOXYGEN:BOOL=${DOXYGEN} \
-D SEACASProj_ENABLE_Fortran=${FORTRAN} \
\
-D TPL_ENABLE_Netcdf:BOOL=${HAVE_NETCDF} \
-D TPL_ENABLE_Matio:BOOL=${HAVE_MATIO} \
-D TPL_ENABLE_CGNS:BOOL=${HAVE_CGNS} \
-D TPL_ENABLE_ADIOS2:BOOL=${HAVE_ADIOS2} \
-D TPL_ENABLE_gtest:BOOL=${HAVE_GTEST} \
-D TPL_ENABLE_Kokkos:BOOL=${HAVE_KOKKOS} \
-D TPL_ENABLE_METIS:BOOL=${HAVE_METIS} \
-D TPL_ENABLE_ParMETIS:BOOL=${HAVE_PARMETIS} \
-D TPL_ENABLE_MPI:BOOL=${MPI} \
-D TPL_ENABLE_Pamgen:BOOL=OFF \
-D TPL_ENABLE_Pthread:BOOL=${THREADSAFE} \
${THREAD_SAFE_OPT} \
-D TPL_ENABLE_X11:BOOL=${HAVE_X11} \
\
-D SEACASExodus_ENABLE_THREADSAFE:BOOL=${THREADSAFE} \
-D SEACASIoss_ENABLE_THREADSAFE:BOOL=${THREADSAFE} \
\
${KOKKOS_SYMBOLS} \
${MPI_SYMBOLS} \
${DW_SYMBOLS} \
${DARWIN_OPT} \
\
-D MPI_BIN_DIR:PATH=${MPI_BIN} \
-D NetCDF_ROOT:PATH=${NETCDF_PATH} \
-D HDF5_ROOT:PATH=${HDF5_PATH} \
-D HDF5_NO_SYSTEM_PATHS=ON \
-D CGNS_ROOT:PATH=${CGNS_PATH} \
-D Matio_ROOT:PATH=${MATIO_PATH} \
-D Metis_ROOT:PATH=${METIS_PATH} \
-D ParMETIS_ROOT:PATH=${PARMETIS_PATH} \
-D PNetCDF_ROOT:PATH=${PNETCDF_PATH} \
-D PythonInterp_FIND_VERSION:STRING=${PYTHON_VER} \
\
$EXTRA_ARGS \
${ACCESS}
echo ""
echo " OS: ${OS}"
echo " ACCESS: ${ACCESS}"
echo "INSTALL_PATH: ${INSTALL_PATH}"
echo " "
echo " CC: ${CC}"
echo " CXX: ${CXX}"
echo " FC: ${FC}"
echo " MPI: ${MPI}"
echo " SHARED: ${SHARED}"
echo " BUILD_TYPE: ${BUILD_TYPE}"
echo " THREADSAFE: ${THREADSAFE}"
echo " PYTHON_VER: ${PYTHON_VER}"
echo " "
echo " NETCDF: ${HAVE_NETCDF}"
echo " MATIO: ${HAVE_MATIO}"
echo " CGNS: ${HAVE_CGNS}"
echo " KOKKOS: ${HAVE_KOKKOS}"
echo " ZOLTAN: ${ZOLTAN}"
echo " ADIOS2: ${HAVE_ADIOS2}"
echo " METIS: ${HAVE_METIS}"
echo " PARMETIS: ${HAVE_PARMETIS}"
echo " GTEST: ${HAVE_GTEST}"
echo " DOXYGEN: ${DOXYGEN}"
echo ""
if [ "${TRAVIS}" == "true" ]
then
make -j2
cd ${ACCESS}
fi