| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
echo "go" |
| 4 |
# ---------------------------------------------------------------------------- |
| 5 |
# Set the location of the compilers and libraries. On a simple out-of-the-box |
| 6 |
# Linux system, COMPILER_ROOT will probably be someplace like /usr/local. |
| 7 |
# On Kevin's TTU machines, there are multiple compiler versions located |
| 8 |
# in directories /usr/local/${COMPILER_VERSION}, e.g., /usr/local/gcc-4.3.2. |
| 9 |
# If your system isn't organized this way, you can copy this script |
| 10 |
# and modify as per your system. |
| 11 |
# |
| 12 |
GCC_VERSION=4.4.1 |
| 13 |
COMPILER_VERSION=gcc-${GCC_VERSION} |
| 14 |
COMPILER_ROOT=/usr/local |
| 15 |
BIN_PATH=${COMPILER_ROOT}/bin |
| 16 |
LIB_PATH=${COMPILER_ROOT}/lib |
| 17 |
INC_PATH=${COMPILER_ROOT}/include |
| 18 |
# Location of Python.h. Not needed unless you're building the |
| 19 |
# python wrappers. |
| 20 |
PYTHON_INC_PATH=${INC_PATH}/python2.6 |
| 21 |
|
| 22 |
# ---------------------------------------------------------------------------- |
| 23 |
# Specify directories for the Trilinos source and Trilnos data, and for |
| 24 |
# the installation of this build. |
| 25 |
|
| 26 |
# Set the installation path |
| 27 |
INSTALL_PREFIX=$PWD |
| 28 |
|
| 29 |
# Set the path to the Trilinos source distribution |
| 30 |
#TRILINOS_SRC_DIR=${HOME}/Software/Trilinos |
| 31 |
TRILINOS_SRC_DIR=${HOME}/Code/Trilinos |
| 32 |
|
| 33 |
# Set the path to the Trilinos data files. Some of the Sundance tests require |
| 34 |
# large mesh files stored in TrilinosData. If the TrilinosData directory |
| 35 |
# cannot be found, these tests will be disabled. |
| 36 |
#TRILINOS_DATA_DIR=${HOME}/Software/TrilinosData |
| 37 |
TRILINOS_DATA_DIR=${HOME}/Code/TrilinosData |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#source ${HOME}/Software/Trilinos/sampleScripts/krlong-linux-common |
| 42 |
#source ./krlong-linux-common |
| 43 |
|
| 44 |
|
| 45 |
# Decide whether to build Stokhos. Default is yes. |
| 46 |
#ENABLE_STOKHOS=ON |
| 47 |
ENABLE_STOKHOS=OFF |
| 48 |
ENABLE_MOOCHO=OFF |
| 49 |
|
| 50 |
|
| 51 |
# ---------------------------------------------------------------------------- |
| 52 |
# Set the fortran library name. On older Linux systems this will |
| 53 |
# need to be changed to -lg2c. |
| 54 |
# |
| 55 |
FORTRAN_LIBS="-lgfortran" |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
# ---------------------------------------------------------------------------- |
| 60 |
# Set variables that control the type of build |
| 61 |
# |
| 62 |
# |
| 63 |
# Whether to build PySundance |
| 64 |
PY_SUNDANCE=OFF |
| 65 |
# Whether to build shared libraries. Default=no. |
| 66 |
BUILD_SHARED=ON |
| 67 |
# Whether to build with MPI. Default=yes. |
| 68 |
ENABLE_MPI=OFF |
| 69 |
# Whether to build optimized or debug. Default=debug. Set to RELEASE or leave |
| 70 |
# blank to enable an optimized build. |
| 71 |
BUILD_TYPE=DEBUG |
| 72 |
# Whether to enable runtime checking of STL calls. Default=no. |
| 73 |
# Do NOT enable this feature unless you know what you're doing, because if any |
| 74 |
# other libraries were built without it the combination of enabled and |
| 75 |
# disabled STL checking in a single executable will cause serious problems, |
| 76 |
# i.e., segfaults in random places. |
| 77 |
CHECK_STL=OFF |
| 78 |
# Whether to enable a paranoid level of compiler warnings. This can cause |
| 79 |
# problems with Python. Default: on. |
| 80 |
PARANOID_COMPILER=ON |
| 81 |
# Whether to do explicit template instantiation |
| 82 |
EXPLICIT_TEMPLATES=ON |
| 83 |
# Ordinal type (should normally be int) |
| 84 |
ORDINAL=long |
| 85 |
# ---------------------------------------------------------------------------- |
| 86 |
# Verbosity of configuration |
| 87 |
VERBOSE_CONFIGURE=OFF |
| 88 |
|
| 89 |
EXTRA_C_FLAGS= |
| 90 |
EXTRA_CXX_FLAGS= |
| 91 |
|
| 92 |
|
| 93 |
# ---------------------------------------------------------------------------- |
| 94 |
# Set variables controlling which third-party libraries are available and |
| 95 |
# should be linked in. |
| 96 |
# |
| 97 |
# Whether the exodus mesh database libraries are available. Default=yes. |
| 98 |
HAVE_EXODUS=OFF |
| 99 |
|
| 100 |
# ---------------------------------------------------------------------------- |
| 101 |
# Specify directories for the Trilinos source and Trilnos data, and for |
| 102 |
# the installation of this build. |
| 103 |
|
| 104 |
# Set the installation path |
| 105 |
INSTALL_PREFIX=$PWD |
| 106 |
|
| 107 |
# --------------------------------------------------------------------------- |
| 108 |
# |
| 109 |
# At this point, all variables have been assigned default values. We now |
| 110 |
# parse the command line to see if any values are overridden. |
| 111 |
# |
| 112 |
# --------------------------------------------------------------------------- |
| 113 |
# Argument parsing logic. |
| 114 |
#TEMP=`getopt -o x --long python,help,mpi,serial,shared,static,dryrun,verbose,check-stl,debug,opt,exodus,no-exodus,g77,lib64,meros,explicit,no-explicit,lax,ordinal:,src:,data:,prefix:,extra-cflags:,extra-cxxflags: -- "$@"` |
| 115 |
TEMP="$@ --" |
| 116 |
|
| 117 |
echo "Before eval, \$@ is $@" |
| 118 |
|
| 119 |
eval set -- "$TEMP" |
| 120 |
|
| 121 |
echo "Args before while loop: $@" |
| 122 |
while true ; do |
| 123 |
case "$1" in |
| 124 |
--python) PY_SUNDANCE=ON; |
| 125 |
PARANOID_COMPILER=OFF; |
| 126 |
PYTHON_INC_STRING="-I${PYTHON_INC_PATH}"; |
| 127 |
echo "did the python thing" |
| 128 |
shift ;; |
| 129 |
--mpi) ENABLE_MPI=ON; shift ;; |
| 130 |
--serial) ENABLE_MPI=OFF; shift ;; |
| 131 |
--dryrun) ECHO=echo; shift;; |
| 132 |
--verbose) VERBOSE_CONFIGURE=ON; shift;; |
| 133 |
--shared) BUILD_SHARED=ON; shift;; |
| 134 |
--static) BUILD_SHARED=OFF; shift;; |
| 135 |
--check-stl) CHECK_STL=ON; shift;; |
| 136 |
--debug) BUILD_TYPE=DEBUG; shift;; |
| 137 |
--opt) BUILD_TYPE=RELEASE; |
| 138 |
OPT_STR="-finline-functions -funroll-loops"; shift;; |
| 139 |
--lax) PARANOID_COMPILER=OFF; shift;; |
| 140 |
--g77) FORTRAN_LIBS="-lg2c"; shift;; |
| 141 |
--lib64) LIB_PATH="${COMPILER_ROOT}/lib;${COMPILER_ROOT}/lib64"; shift;; |
| 142 |
--exodus) HAVE_EXODUS=ON; shift;; |
| 143 |
--no-exodus) HAVE_EXODUS=OFF; shift;; |
| 144 |
--meros) ENABLE_MEROS=ON; shift;; |
| 145 |
--explicit) EXPLICIT_TEMPLATES=ON; shift;; |
| 146 |
--no-explicit) EXPLICIT_TEMPLATES=OFF; shift;; |
| 147 |
--src) |
| 148 |
TRILINOS_SRC_DIR="$2"; shift 2;; |
| 149 |
--extra-cxxflags) |
| 150 |
EXTRA_CXX_FLAGS="$2"; shift 2;; |
| 151 |
--extra-cflags) |
| 152 |
EXTRA_C_FLAGS="$2"; shift 2;; |
| 153 |
--extra-fflags) |
| 154 |
EXTRA_F_FLAGS="$2"; shift 2;; |
| 155 |
--data) |
| 156 |
TRILINOS_DATA_DIR="$2"; shift 2;; |
| 157 |
--ordinal) |
| 158 |
ORDINAL="$2"; shift 2;; |
| 159 |
--prefix) |
| 160 |
INSTALL_PREFIX="$2"; shift 2;; |
| 161 |
--help) |
| 162 |
echo "Command-line arguments:" |
| 163 |
echo "--help help" |
| 164 |
echo "--dryrun print the command that would be used" |
| 165 |
echo "--python enables PySundance" |
| 166 |
echo "--verbose enable verbose configuration (default: off)" |
| 167 |
echo "--mpi enable MPI (default: on)" |
| 168 |
echo "--serial turn off MPI" |
| 169 |
echo "--shared build shared libraries (default: off)" |
| 170 |
echo "--static build static libraries (default: on)" |
| 171 |
echo "--check-stl turn on STL runtime checking (expert use only)" |
| 172 |
echo "--debug turn on debugging features (default: on)" |
| 173 |
echo "--opt turn on optimized compilation (default: off)" |
| 174 |
echo "--lax turn off paranoid compiler flags (necessary for python wrappers)" |
| 175 |
echo "--g77 use g77 instead of gfortran (default: off)" |
| 176 |
echo "--lib64 include lib64 in search path (default: off)" |
| 177 |
echo "--exodus enable ExodusII readers (requires ExodusII libraries. Default: on)" |
| 178 |
echo "--no-exodus disable ExodusII readers" |
| 179 |
echo "--meros enable Meros block preconditioners (default: off)" |
| 180 |
echo "--explicit enable explicit template instantiation (default: on)" |
| 181 |
echo "--src <srcdir> set location of Trilinos sources (default: \${HOME}/Code/Trilinos)" |
| 182 |
echo "--extra-cxxflags <f> extra C++ flags (default: none)" |
| 183 |
echo "--extra-cflags <f> extra C flags (default: none)" |
| 184 |
echo "--extra-fflags <f> extra Fortran flags (default: none)" |
| 185 |
echo "--ordinal <str> ordinal type (default: int)" |
| 186 |
echo "--data <dir> set location of Trilinos data (default: \${HOME}/Code/TrilinosData)" |
| 187 |
echo "--prefix <dir> set installation directory (default: \${PWD})" |
| 188 |
echo " "; |
| 189 |
exit 0; |
| 190 |
shift |
| 191 |
;; |
| 192 |
--) shift; break;; |
| 193 |
esac |
| 194 |
done |
| 195 |
|
| 196 |
echo "Remaining arguments: $@" |
| 197 |
|
| 198 |
# --------------------------------------------------------------------------- |
| 199 |
# |
| 200 |
# Now run cmake!! |
| 201 |
# |
| 202 |
# --------------------------------------------------------------------------- |
| 203 |
|
| 204 |
${ECHO} cmake \ |
| 205 |
-D CMAKE_BUILD_TYPE:STRING=${BUILD_TYPE} \ |
| 206 |
-D BUILD_SHARED_LIBS:BOOL=${BUILD_SHARED} \ |
| 207 |
-D CMAKE_SYSTEM_LIBRARY_PATH:FILEPATH="${LIB_PATH}" \ |
| 208 |
-D CMAKE_SYSTEM_INCLUDE_PATH:FILEPATH="${INC_PATH}" \ |
| 209 |
-D CMAKE_CXX_FLAGS:STRING="${PYTHON_INC_STRING} ${OPT_STRING} ${EXTRA_CXX_FLAGS}" \ |
| 210 |
-D CMAKE_C_FLAGS:STRING="${PYTHON_INC_STRING} ${EXTRA_C_FLAGS}" \ |
| 211 |
-D CMAKE_Fortran_FLAGS:STRING="${EXTRA_F_FLAGS}" \ |
| 212 |
-D TPL_ENABLE_ExodusII:BOOL=${HAVE_EXODUS} \ |
| 213 |
-D TPL_ENABLE_MPI:BOOL=${ENABLE_MPI} \ |
| 214 |
-D BLAS_LIBRARY_DIRS:FILEPATH=${LIB_PATH} \ |
| 215 |
-D LAPACK_LIBRARY_DIRS:FILEPATH=${LIB_PATH} \ |
| 216 |
-D Trilinos_EXTRA_LINK_FLAGS:STRING=${FORTRAN_LIBS} \ |
| 217 |
-D Trilinos_ENABLE_SHADOW_WARNINGS:BOOL=OFF \ |
| 218 |
-D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=OFF \ |
| 219 |
-D Trilinos_ENABLE_SECONDARY_STABLE_CODE:BOOL=ON \ |
| 220 |
-D Trilinos_ENABLE_STRONG_CXX_COMPILE_WARNINGS:BOOL=${PARANOID_COMPILER} \ |
| 221 |
-D Trilinos_ENABLE_CHECKED_STL:BOOL=${CHECK_STL} \ |
| 222 |
-D Trilinos_ENABLE_TESTS:BOOL=ON \ |
| 223 |
-D Trilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=${EXPLICIT_TEMPLATES} \ |
| 224 |
-D Trilinos_ENABLE_Sundance:BOOL=ON \ |
| 225 |
-D Trilinos_VERBOSE_CONFIGURE:BOOL=${VERBOSE_CONFIGURE} \ |
| 226 |
-D Sundance_ENABLE_MOOCHO:BOOL=${ENABLE_MOOCHO} \ |
| 227 |
-D Sundance_ENABLE_Stokhos:BOOL=${ENABLE_STOKHOS} \ |
| 228 |
-D Sundance_ENABLE_BROKEN_CODE:BOOL=OFF \ |
| 229 |
-D Sundance_ENABLE_Python:BOOL=${PY_SUNDANCE} \ |
| 230 |
-D Teuchos_ORDINAL_TYPE:STRING=${ORDINAL} \ |
| 231 |
-D Trilinos_DATA_DIR:FILEPATH="${TRILINOS_DATA_DIR}" \ |
| 232 |
-D NOX_ENABLE_LOCA:BOOL=OFF \ |
| 233 |
-D CMAKE_INSTALL_PREFIX:PATH=${INSTALL_PREFIX} \ |
| 234 |
-D TPL_LAPACK_LIBRARIES="-llapack -lblas -lgfortran" \ |
| 235 |
${TRILINOS_SRC_DIR} |
| 236 |
|
| 237 |
#-D TPL_LAPACK_LIBRARIES=/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/liblapack.dylib \ |
| 238 |
#-D TPL_BLAS_LIBRARIES=/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/libblas.dylib \ |
| 239 |
|
| 240 |
|
| 241 |
echo "extra link flags: " ${FORTRAN_LIBS} |
| 242 |
|
| 243 |
|
| 244 |
#exit 0 |
| 245 |
|