| 1 |
#!/bin/sh |
| 2 |
# ---------------------------------------------------------------------------- |
| 3 |
# Generic script for building Trilinos and Sundance on Linux machines with |
| 4 |
# configurations similar to gibbon.math.ttu.edu |
| 5 |
# |
| 6 |
# Run this script as |
| 7 |
# <kevin@gibbon> ./gibbon-linux-sundance [flags] |
| 8 |
# where the possible flags are listed by running |
| 9 |
# <kevin@gibbon> ./gibbon-linux-sundance --help |
| 10 |
# |
| 11 |
# This isn't meant as a completely general configuration script; rather, it |
| 12 |
# allows streamlined setting of the several options I most commonly vary in |
| 13 |
# my own work. You'll probably want to tweak this script for your own system |
| 14 |
# and your own selection of packages. In particular, I've assumed we're |
| 15 |
# always building Sundance and that the directory layout is identical to |
| 16 |
# that on my development machines gibbon and chimera. |
| 17 |
# |
| 18 |
# 22 March 2009 |
| 19 |
# Kevin Long ([email protected]) |
| 20 |
# |
| 21 |
#----------------------------------------------------------------------------- |
| 22 |
|
| 23 |
# Decide whether to build the SEACAS mesh IO package. |
| 24 |
# Default is yes. |
| 25 |
# |
| 26 |
ENABLE_SEACAS=ON |
| 27 |
# Decide whether to build Stokhos. Default is yes. |
| 28 |
ENABLE_STOKHOS=ON |
| 29 |
# Decide whether to build Zoltan mesh partitioning. Default is yes. |
| 30 |
ENABLE_ZOLTAN=ON |
| 31 |
|
| 32 |
|
| 33 |
# ---------------------------------------------------------------------------- |
| 34 |
# Set the fortran library name. On older Linux systems this will |
| 35 |
# need to be changed to -lg2c. |
| 36 |
# |
| 37 |
FORTRAN_LIBS="-lgfortran" |
| 38 |
|
| 39 |
|
| 40 |
# ---------------------------------------------------------------------------- |
| 41 |
# Set variables that control the type of build |
| 42 |
# |
| 43 |
# |
| 44 |
# Whether to build PySundance |
| 45 |
PY_SUNDANCE=OFF |
| 46 |
# Whether to build shared libraries. Default=no. |
| 47 |
BUILD_SHARED=ON |
| 48 |
# Whether to build with MPI. Default=yes. |
| 49 |
ENABLE_MPI=ON |
| 50 |
# Whether to build optimized or debug. Default=debug. Set to RELEASE or leave |
| 51 |
# blank to enable an optimized build. |
| 52 |
BUILD_TYPE=DEBUG |
| 53 |
# Whether to enable runtime checking of STL calls. Default=no. |
| 54 |
# Do NOT enable this feature unless you know what you're doing, because if any |
| 55 |
# other libraries were built without it the combination of enabled and |
| 56 |
# disabled STL checking in a single executable will cause serious problems, |
| 57 |
# i.e., segfaults in random places. |
| 58 |
CHECK_STL=OFF |
| 59 |
# Whether to enable a paranoid level of compiler warnings. This can cause |
| 60 |
# problems with Python. Default: on. |
| 61 |
PARANOID_COMPILER=ON |
| 62 |
# Whether to do explicit template instantiation |
| 63 |
EXPLICIT_TEMPLATES=ON |
| 64 |
# Ordinal type (should normally be int) |
| 65 |
ORDINAL_TYPE=int |
| 66 |
# ---------------------------------------------------------------------------- |
| 67 |
# Verbosity of configuration |
| 68 |
VERBOSE_CONFIGURE=OFF |
| 69 |
|
| 70 |
EXTRA_C_FLAGS= |
| 71 |
EXTRA_CXX_FLAGS= |
| 72 |
|
| 73 |
|
| 74 |
# ---------------------------------------------------------------------------- |
| 75 |
# Set variables controlling which third-party libraries are available and |
| 76 |
# should be linked in. |
| 77 |
# |
| 78 |
# Whether the exodus mesh database libraries are available. Default=yes. |
| 79 |
ENABLE_NETCDF=ON |
| 80 |
|
| 81 |
# ---------------------------------------------------------------------------- |
| 82 |
# Specify directories for the Trilinos source and Trilnos data, and for |
| 83 |
# the installation of this build. |
| 84 |
|
| 85 |
# Set the installation path |
| 86 |
INSTALL_PREFIX=$PWD |
| 87 |
|
| 88 |
# --------------------------------------------------------------------------- |
| 89 |
# |
| 90 |
# At this point, all variables have been assigned default values. We now |
| 91 |
# parse the command line to see if any values are overridden. |
| 92 |
# |
| 93 |
# --------------------------------------------------------------------------- |
| 94 |
# Argument parsing logic. |
| 95 |
TEMP=`getopt -o x --long python,help,mpi,serial,shared,static,dryrun,verbose,check-stl,debug,opt,stohkos,no-stokhos,lib64,explicit,no-explicit,lax,ordinal:,src:,data:,prefix:,extra-cflags:,extra-cxxflags: -- "$@"` |
| 96 |
|
| 97 |
eval set -- "$TEMP" |
| 98 |
|
| 99 |
while true ; do |
| 100 |
case "$1" in |
| 101 |
--python) PY_SUNDANCE=ON; |
| 102 |
PARANOID_COMPILER=OFF; |
| 103 |
PYTHON_INC_STRING="-I${PYTHON_INC_PATH}"; |
| 104 |
shift ;; |
| 105 |
--mpi) ENABLE_MPI=ON; shift ;; |
| 106 |
--serial) ENABLE_MPI=OFF; shift ;; |
| 107 |
--dryrun) ECHO=echo; shift;; |
| 108 |
--verbose) VERBOSE_CONFIGURE=ON; shift;; |
| 109 |
--shared) BUILD_SHARED=ON; shift;; |
| 110 |
--static) BUILD_SHARED=OFF; shift;; |
| 111 |
--check-stl) CHECK_STL=ON; shift;; |
| 112 |
--debug) BUILD_TYPE=DEBUG; shift;; |
| 113 |
--opt) BUILD_TYPE=RELEASE; |
| 114 |
OPT_STR="-finline-functions -funroll-loops"; shift;; |
| 115 |
--lax) PARANOID_COMPILER=OFF; shift;; |
| 116 |
--lib64) LIB_PATH="${COMPILER_ROOT}/lib;${COMPILER_ROOT}/lib64"; shift;; |
| 117 |
--explicit) EXPLICIT_TEMPLATES=ON; shift;; |
| 118 |
--no-explicit) EXPLICIT_TEMPLATES=OFF; shift;; |
| 119 |
--stokhos) ENABLE_STOKHOS=ON; shift;; |
| 120 |
--no-stokhos) ENABLE_STOKHOS=OFF; shift;; |
| 121 |
--src) |
| 122 |
TRILINOS_SRC_DIR="$2"; shift 2;; |
| 123 |
--extra-cxxflags) |
| 124 |
EXTRA_CXX_FLAGS="$2"; shift 2;; |
| 125 |
--extra-cflags) |
| 126 |
EXTRA_C_FLAGS="$2"; shift 2;; |
| 127 |
--extra-fflags) |
| 128 |
EXTRA_F_FLAGS="$2"; shift 2;; |
| 129 |
--data) |
| 130 |
TRILINOS_DATA_DIR="$2"; shift 2;; |
| 131 |
--ordinal) |
| 132 |
ORDINAL_TYPE="$2"; shift 2;; |
| 133 |
--prefix) |
| 134 |
INSTALL_PREFIX="$2"; shift 2;; |
| 135 |
--help) |
| 136 |
echo "Command-line arguments:" |
| 137 |
echo "--help help" |
| 138 |
echo "--dryrun print the command that would be used" |
| 139 |
echo "--python enables PySundance" |
| 140 |
echo "--verbose enable verbose configuration (default: off)" |
| 141 |
echo "--mpi enable MPI (default: on)" |
| 142 |
echo "--serial turn off MPI" |
| 143 |
echo "--shared build shared libraries (default: off)" |
| 144 |
echo "--static build static libraries (default: on)" |
| 145 |
echo "--check-stl turn on STL runtime checking (expert use only)" |
| 146 |
echo "--debug turn on debugging features (default: on)" |
| 147 |
echo "--opt turn on optimized compilation (default: off)" |
| 148 |
echo "--lax turn off paranoid compiler flags (necessary for python wrappers)" |
| 149 |
echo "--lib64 include lib64 in search path (default: off)" |
| 150 |
echo "--explicit enable explicit template instantiation (default: on)" |
| 151 |
echo "--src <srcdir> set location of Trilinos sources (default: \${HOME}/Code/Trilinos)" |
| 152 |
echo "--extra-cxxflags <f> extra C++ flags (default: none)" |
| 153 |
echo "--extra-cflags <f> extra C flags (default: none)" |
| 154 |
echo "--extra-fflags <f> extra Fortran flags (default: none)" |
| 155 |
echo "--ordinal <str> ordinal type (default: int)" |
| 156 |
echo "--data <dir> set location of Trilinos data (default: \${HOME}/Code/TrilinosData)" |
| 157 |
echo "--prefix <dir> set installation directory (default: \${PWD})" |
| 158 |
echo " "; |
| 159 |
exit 0; |
| 160 |
shift |
| 161 |
;; |
| 162 |
--) shift; break;; |
| 163 |
esac |
| 164 |
done |
| 165 |
|
| 166 |
# --------------------------------------------------------------------------- |
| 167 |
# |
| 168 |
# Now run cmake!! |
| 169 |
# |
| 170 |
# --------------------------------------------------------------------------- |
| 171 |
|
| 172 |
${ECHO} cmake \ |
| 173 |
-D CMAKE_BUILD_TYPE:STRING=${BUILD_TYPE} \ |
| 174 |
-D BUILD_SHARED_LIBS:BOOL=${BUILD_SHARED} \ |
| 175 |
-D CMAKE_SYSTEM_LIBRARY_PATH:FILEPATH="${LIB_PATH}" \ |
| 176 |
-D CMAKE_SYSTEM_INCLUDE_PATH:FILEPATH="${INC_PATH}" \ |
| 177 |
-D CMAKE_CXX_FLAGS:STRING="${PYTHON_INC_STRING} ${OPT_STR} ${EXTRA_CXX_FLAGS}" \ |
| 178 |
-D CMAKE_C_FLAGS:STRING="${PYTHON_INC_STRING} ${EXTRA_C_FLAGS}" \ |
| 179 |
-D CMAKE_Fortran_FLAGS:STRING="${EXTRA_F_FLAGS}" \ |
| 180 |
-D TPL_ENABLE_MPI:BOOL=${ENABLE_MPI} \ |
| 181 |
-D TPL_ENABLE_Netcdf:BOOL=${ENABLE_NETCDF} \ |
| 182 |
-D TPL_HDF5_LIBRARIES:STRING="/usr/lib/libhdf5.so" \ |
| 183 |
-D Trilinos_EXTRA_LINK_FLAGS:STRING=${FORTRAN_LIBS} \ |
| 184 |
-D Trilinos_ENABLE_SHADOW_WARNINGS:BOOL=OFF \ |
| 185 |
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \ |
| 186 |
-D Trilinos_ENABLE_SECONDARY_STABLE_CODE:BOOL=ON \ |
| 187 |
-D Trilinos_ENABLE_STRONG_CXX_COMPILE_WARNINGS:BOOL=${PARANOID_COMPILER} \ |
| 188 |
-D Trilinos_ENABLE_CHECKED_STL:BOOL=${CHECK_STL} \ |
| 189 |
-D Trilinos_ENABLE_TESTS:BOOL=OFF \ |
| 190 |
-D Trilinos_ENABLE_EXAMPLES:BOOL=OFF \ |
| 191 |
-D Trilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=${EXPLICIT_TEMPLATES} \ |
| 192 |
-D Trilinos_ENABLE_Sundance:BOOL=ON \ |
| 193 |
-D Trilinos_ENABLE_SEACAS:BOOL=${ENABLE_SEACAS} \ |
| 194 |
-D Trilinos_ENABLE_Sacado:BOOL=${ENABLE_SACADO} \ |
| 195 |
-D Trilinos_ENABLE_Stokhos:BOOL=${ENABLE_STOKHOS} \ |
| 196 |
-D Trilinos_ENABLE_Zoltan:BOOL=${ENABLE_ZOLTAN} \ |
| 197 |
-D Sundance_ENABLE_TESTS:BOOL=ON \ |
| 198 |
-D Sundance_ENABLE_EXAMPLES:BOOL=ON \ |
| 199 |
-D Stokhos_ENABLE_TESTS:BOOL=OFF \ |
| 200 |
-D Zoltan_ENABLE_TESTS:BOOL=OFF \ |
| 201 |
-D SEACAS_ENABLE_TESTS:BOOL=OFF \ |
| 202 |
-D EpetraExt_USING_HDF5:BOOL=OFF \ |
| 203 |
-D Trilinos_ENABLE_SEACASNemslice:BOOL=ON \ |
| 204 |
-D Trilinos_ENABLE_SEACASEpu:BOOL=OFF \ |
| 205 |
-D Stokhos_ENABLE_EXAMPLES:BOOL=OFF \ |
| 206 |
-D Sundance_ENABLE_Python:BOOL=${PY_SUNDANCE} \ |
| 207 |
-D Sundance_ENABLE_SEACAS:BOOL=${ENABLE_SEACAS} \ |
| 208 |
-D Teuchos_ORDINAL_TYPE:STRING=${ORDINAL_TYPE} \ |
| 209 |
-D Trilinos_DATA_DIR:FILEPATH="${TRILINOS_DATA_DIR}" \ |
| 210 |
-D NOX_ENABLE_LOCA:BOOL=OFF \ |
| 211 |
-D CMAKE_INSTALL_PREFIX:PATH=${INSTALL_PREFIX} \ |
| 212 |
${TRILINOS_SRC_DIR} |
| 213 |
|