forked from sandialabs/seacas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmake-travis.sh
executable file
·164 lines (142 loc) · 4.79 KB
/
cmake-travis.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
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
#! /usr/bin/env bash
BUILDDIR=${1:-build}
mkdir $BUILDDIR && cd $BUILDDIR
### Set to ON for parallel compile; otherwise OFF for serial (default)
MPI="${MPI:-OFF}"
echo "MPI set to ${MPI}"
### Switch for Debug or Release build:
BUILD_TYPE="${BUILD_TYPE:-RELEASE}"
### 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.
ACCESS=$(cd ..; pwd)
### 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=ON
### Set to ON to enable the building of a thread-safe version of the Exodus and IOSS libraries.
THREADSAFE=${THREADSAFE:-OFF}
### The SEACAS code will install in ${INSTALL_PATH}/bin, ${INSTALL_PATH}/lib, and ${INSTALL_PATH}/include.
INSTALL_PATH=${ACCESS}
### 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=${ACCESS}
PNETCDF_PATH=${ACCESS}
MATIO_PATH=${ACCESS}
HDF5_PATH=${ACCESS}
CGNS_PATH=${ACCESS}
FAODEL_PATH=${ACCESS}
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_FAODEL=$(check_enable "${FAODEL_PATH}/include/faodel/faodelConfig.h")
### Define to NO to *enable* exodus deprecated functions
OMIT_DEPRECATED_CODE="NO"
### Set to ON to use Kokkos in the Ioss library; otherwise OFF (default)
KOKKOS=${KOKKOS:-OFF}
CUDA_PATH=${CUDA_ROOT} #Set this to the appropriate path
### Set to ON for CUDA compile; otherwise OFF (default) (only used if KOKKOS=ON
CUDA=${CUDA:-OFF}
if [ "${MPI}" == "ON" ]
then
MPI_EXEC=$(which mpiexec)
MPI_BIN=$(dirname "${MPI_EXEC}")
CXX=mpicxx
CC=mpicc
FC=mpif77
fi
if [ "$KOKKOS" == "ON" ]
then
if [ "$CUDA" == "ON" ]
then
export "OMPI_CXX=${SEACAS_SRC_DIR}/packages/kokkos/config/nvcc_wrapper"
export CUDA_MANAGED_FORCE_DEVICE_ALLOC=1
KOKKOS_SYMBOLS="-D Seacas_ENABLE_Kokkos:BOOL=ON \
-D TPL_ENABLE_CUDA:Bool=ON \
-D CUDA_TOOLKIT_ROOT_DIR:PATH=${CUDA_PATH} \
-D Kokkos_ENABLE_Pthread:BOOL=OFF"
else
export OMPI_CXX=$(which gcc)
unset CUDA_MANAGED_FORCE_DEVICE_ALLOC
KOKKOS_SYMBOLS="-D Seacas_ENABLE_Kokkos:BOOL=ON \
-D Seacas_ENABLE_OpenMP:Bool=ON \
-D Kokkos_ENABLE_Pthread:BOOL=OFF"
fi
else
KOKKOS_SYMBOLS="-D Seacas_ENABLE_Kokkos:BOOL=OFF"
fi
if [ "HAVE_FAODEL" == "ON" ]
then
DW_SYMBOLS="-DTPL_ENABLE_FAODEL:BOOL=${HAVE_FAODEL} \
-DFAODEL_LIBRARY_DIRS:PATH=${FAODEL_PATH}/lib \
-DFAODEL_INCLUDE_DIRS:PATH=${FAODEL_PATH}/include"
fi
rm -f CMakeCache.txt
###------------------------------------------------------------------------
cmake \
-D CMAKE_CXX_COMPILER:FILEPATH=${CXX} \
-D CMAKE_C_COMPILER:FILEPATH=${CC} \
-D CMAKE_Fortran_COMPILER:FILEPATH=${FC} \
-D CMAKE_CXX_FLAGS="-Wall -Wunused -pedantic" \
-D CMAKE_C_FLAGS="-Wall -Wunused -pedantic" \
-D CMAKE_MACOSX_RPATH:BOOL=ON \
-D CMAKE_INSTALL_RPATH:PATH=${INSTALL_PATH}/lib \
-D BUILD_SHARED_LIBS:BOOL=OFF \
-D CMAKE_BUILD_TYPE=${BUILD_TYPE} \
-D Seacas_ENABLE_ALL_PACKAGES:BOOL=ON \
-D Seacas_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON \
-D Seacas_ENABLE_SECONDARY_TESTED_CODE:BOOL=ON \
-D Seacas_ENABLE_TESTS=ON \
-D CMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} \
-D Seacas_SKIP_FORTRANCINTERFACE_VERIFY_TEST:BOOL=ON \
-D Seacas_HIDE_DEPRECATED_CODE:BOOL=${OMIT_DEPRECATED_CODE} \
\
-D TPL_ENABLE_Netcdf:BOOL=${HAVE_NETCDF} \
-D TPL_ENABLE_Matio:BOOL=${HAVE_MATIO} \
-D TPL_ENABLE_CGNS:BOOL=${HAVE_CGNS} \
-D TPL_ENABLE_MPI:BOOL=${MPI} \
-D TPL_ENABLE_Pamgen:BOOL=OFF \
-D TPL_ENABLE_Pthread:BOOL=${THREADSAFE} \
-D SEACASExodus_ENABLE_THREADSAFE:BOOL=${THREADSAFE} \
-D SEACASIoss_ENABLE_THREADSAFE:BOOL=${THREADSAFE} \
-D TPL_X11_INCLUDE_DIRS:PATH=/opt/local/include \
-D TPL_ENABLE_X11:BOOL=${HAVE_X11} \
\
${KOKKOS_SYMBOLS} \
${DW_SYMBOLS} \
\
-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 PNetCDF_ROOT:PATH=${PNETCDF_PATH} \
\
$EXTRA_ARGS \
..
echo ""
echo " ACCESS: ${ACCESS}"
echo " CC: ${CC}"
echo " CXX: ${CXX}"
echo " FC: ${FC}"
echo " MPI: ${MPI}"
echo " THREADSAFE: ${THREADSAFE}"
echo "HAVE_NETCDF: ${HAVE_NETCDF}"
echo " HAVE_MATIO: ${HAVE_MATIO}"
echo " HAVE_CGNS: ${HAVE_CGNS}"
echo " KOKKOS: ${KOKKOS}"
echo ""
make -j2
cd ${ACCESS}