diff --git a/etc/bashrc b/etc/bashrc index 3517abfb690963beca758ed0653f2195318f3757..2f76281083f661b04bb686dc8c69e4318893521f 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -58,8 +58,8 @@ foamInstall=$HOME/$WM_PROJECT : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR #- Compiler location: -# foamCompiler= system | ThirdParty (OpenFOAM) -foamCompiler=system +# WM_COMPILER_TYPE= system | ThirdParty (OpenFOAM) +export WM_COMPILER_TYPE=system #- Compiler: # WM_COMPILER = Gcc | Gcc45 | Gcc46 | Gcc47 | Gcc48 | Gcc49| Clang | Icc @@ -137,52 +137,9 @@ fi # ~~~~~~~~~~~~~~~~~~~~~~ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION - -# Source files, possibly with some verbosity -_foamSource() -{ - while [ $# -ge 1 ] - do - [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" 1>&2 - . $1 - shift - done -} - -# Evaluate command-line parameters -_foamEval() -{ - while [ $# -gt 0 ] - do - case "$1" in - -*) - # stray option (not meant for us here) -> get out - break - ;; - *=) - # name= -> unset name - [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "unset ${1%=}" 1>&2 - eval "unset ${1%=}" - ;; - *=*) - # name=value -> export name=value - [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "export $1" 1>&2 - eval "export $1" - ;; - *) - # filename: source it - if [ -f "$1" ] - then - _foamSource "$1" - else - _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -silent "$1"` - fi - ;; - esac - shift - done -} - +# Source initialization functions +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +. $WM_PROJECT_DIR/etc/config.sh/functions # Add in preset user or site preferences: _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` @@ -245,9 +202,13 @@ then fi -# cleanup environment: +# Cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ unset cleaned foamClean foamInstall foamOldDirs -unset _foamSource _foamEval + + +# Unload initialization functions: +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +. $WM_PROJECT_DIR/etc/config.sh/functions #------------------------------------------------------------------------------ diff --git a/etc/config.sh/CGAL b/etc/config.sh/CGAL index 5b6a32618cddeadb111838f80bb005fb6fa8cf93..c76aabe75e5b5dbc72e30a74562c378c01758612 100644 --- a/etc/config.sh/CGAL +++ b/etc/config.sh/CGAL @@ -32,8 +32,13 @@ boost_version=boost-system cgal_version=CGAL-4.7 -export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version -export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version +if [ -z "$SOURCE_CGAL_VERSIONS_ONLY" ] +then + +common_path=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER + +export BOOST_ARCH_PATH=$common_path/$boost_version +export CGAL_ARCH_PATH=$common_path/$cgal_version if [ "$FOAM_VERBOSE" -a "$PS1" ] then @@ -52,6 +57,8 @@ then _foamAddLib $BOOST_ARCH_PATH/lib fi -unset boost_version cgal_version +unset boost_version cgal_version common_path + +fi #------------------------------------------------------------------------------ diff --git a/etc/config.sh/compiler b/etc/config.sh/compiler new file mode 100644 index 0000000000000000000000000000000000000000..63099a7923bfeec706ed98d8ac8c0b859b0ffeb7 --- /dev/null +++ b/etc/config.sh/compiler @@ -0,0 +1,82 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. +# +# File +# etc/config.sh/compiler +# +# Description +# Startup file for custom compiler versions for OpenFOAM +# Sourced from OpenFOAM-<VERSION>/etc/config.sh/settings +# +#------------------------------------------------------------------------------ + +case "$WM_COMPILER_TYPE" in +OpenFOAM | ThirdParty) + + # Default versions of GMP, MPFR and MPC, override as necessary + gmp_version=gmp-5.1.2 + mpfr_version=mpfr-3.1.2 + mpc_version=mpc-1.0.1 + + case "$WM_COMPILER" in + Gcc | Gcc48) + gcc_version=gcc-4.8.5 + ;; + Gcc45) + gcc_version=gcc-4.5.4 + ;; + Gcc46) + gcc_version=gcc-4.6.4 + ;; + Gcc47) + gcc_version=gcc-4.7.4 + ;; + Gcc49) + gcc_version=gcc-4.9.3 + ;; + Gcc51) + gcc_version=gcc-5.1.0 + ;; + Gcc52) + gcc_version=gcc-5.2.0 + ;; + Gcc53) + gcc_version=gcc-5.3.0 + ;; + Clang) + # Using clang - not gcc + export WM_CC='clang' + export WM_CXX='clang++' + clang_version=llvm-3.7.0 + ;; + *) + echo 1>&2 + echo "Warning in $WM_PROJECT_DIR/etc/config.sh/compiler:" 1>&2 + echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" 1>&2 + echo " Please check your settings" 1>&2 + echo 1>&2 + ;; + esac + ;; + +esac diff --git a/etc/config.sh/example/compiler b/etc/config.sh/example/compiler index 34658b82178a4918e34f51327b5b2e4095cbeae4..493cafb56ef064fe8973fb01ed8ead4da0bd1708 100644 --- a/etc/config.sh/example/compiler +++ b/etc/config.sh/example/compiler @@ -25,12 +25,19 @@ # config.sh/example/compiler # # Description -# Example of fine tuning ThirdParty compiler settings for OpenFOAM +# Example of fine tuning compiler versions and settings for OpenFOAM # Sourced from OpenFOAM-<VERSION>/etc/config.sh/settings # #------------------------------------------------------------------------------ -# Modified compiler settings +# First load the standard versions, if necessary +foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config.sh/compiler \ + 2>/dev/null) +[ $? -eq 0 ] && _foamSource $foamFile +unset foamFile + + +# Override compiler settings case "$WM_COMPILER" in Gcc46 | Gcc46++0x) gcc_version=gcc-4.6.0 @@ -44,6 +51,17 @@ Gcc45 | Gcc45++0x) mpfr_version=mpfr-2.4.2 mpc_version=mpc-0.8.1 ;; +Gcc48u) + # Example of using the system GCC 4.8 in Ubuntu 15.10. Keep in mind you + # will also need to create respective directory in "wmake/rules" + export WM_CC='gcc-4.8' + export WM_CXX='g++-4.8' + ;; +Icc) + # Example for ensuring that 3rd software uses the Icc compilers + export WM_CC='icc' + export WM_CXX='icpc' + ;; esac #------------------------------------------------------------------------------ diff --git a/etc/config.sh/example/prefs.sh b/etc/config.sh/example/prefs.sh index a378712af5a1897ad9cd3088f80a4625eb493aee..58b1fd76614c2c9237664da7ce1158e0f1244ee3 100644 --- a/etc/config.sh/example/prefs.sh +++ b/etc/config.sh/example/prefs.sh @@ -38,7 +38,7 @@ ## Specify OpenFOAM ThirdParty compiler ## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# foamCompiler=ThirdParty +#WM_COMPILER_TYPE=ThirdParty ## Specify compiler type ## ~~~~~~~~~~~~~~~~~~~~~ @@ -46,7 +46,7 @@ ## Specify system openmpi ## ~~~~~~~~~~~~~~~~~~~~~~ -# export WM_MPLIB=SYSTEMOPENMPI +#export WM_MPLIB=SYSTEMOPENMPI #------------------------------------------------------------------------------ diff --git a/etc/config.sh/functions b/etc/config.sh/functions new file mode 100644 index 0000000000000000000000000000000000000000..dcec6549d474c5ac2eaeb6a943dd24c18162c8f0 --- /dev/null +++ b/etc/config.sh/functions @@ -0,0 +1,122 @@ +#----------------------------------*-sh-*-------------------------------------- +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation +# \\/ M anipulation | +#------------------------------------------------------------------------------ +# License +# This file is part of OpenFOAM. +# +# OpenFOAM is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. +# +# File +# etc/config.sh/functions +# +# Description +# Initialization script functions for the bashrc environment +# Sourced from OpenFOAM-<VERSION>/etc/config.sh/bashrc +# +#------------------------------------------------------------------------------ + +if [ -z "$WM_BASH_FUNCTIONS" ] +then + + # Temporary environment variable for automatically (un)loading functions + WM_BASH_FUNCTIONS=loaded + + # Source files, possibly with some verbosity + _foamSource() + { + while [ $# -ge 1 ] + do + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1" 1>&2 + . $1 + shift + done + } + + # Evaluate command-line parameters + _foamEval() + { + while [ $# -gt 0 ] + do + case "$1" in + -*) + # stray option (not meant for us here) -> get out + break + ;; + *=) + # name= -> unset name + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "unset ${1%=}" 1>&2 + eval "unset ${1%=}" + ;; + *=*) + # name=value -> export name=value + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "export $1" 1>&2 + eval "export $1" + ;; + *) + # filename: source it + if [ -f "$1" ] + then + _foamSource "$1" + else + _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile -silent "$1"` + fi + ;; + esac + shift + done + } + + # Prefix to PATH + _foamAddPath() + { + while [ $# -ge 1 ] + do + export PATH=$1:$PATH + shift + done + } + + # Prefix to LD_LIBRARY_PATH + _foamAddLib() + { + while [ $# -ge 1 ] + do + export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH + shift + done + } + + # Prefix to MANPATH + _foamAddMan() + { + while [ $# -ge 1 ] + do + export MANPATH=$1:$MANPATH + shift + done + } + +else + + # Cleanup environment: + # ~~~~~~~~~~~~~~~~~~~~ + unset WM_BASH_FUNCTIONS + unset _foamAddPath _foamAddLib _foamAddMan + unset _foamSource _foamEval + +fi diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi index f31c0018f666e9534956d0581836d7981d38bf0a..36b651e0fcc10923bf5fb3272d00491911bb53fe 100644 --- a/etc/config.sh/mpi +++ b/etc/config.sh/mpi @@ -267,4 +267,9 @@ then fi export MPI_BUFFER_SIZE + +# Cleanup environment: +# ~~~~~~~~~~~~~~~~~~~~ +unset minBufferSize + #------------------------------------------------------------------------------ diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview index c686b32702a744de1cb79faf307d86b9fd3717c7..0d14688677bcfbb6e5c80982bbfcc050d9558905 100644 --- a/etc/config.sh/paraview +++ b/etc/config.sh/paraview @@ -49,6 +49,7 @@ do if [ -r $cmake ] then export CMAKE_HOME=$cmake + export CMAKE_ROOT=$cmake export PATH=$CMAKE_HOME/bin:$PATH break fi diff --git a/etc/config.sh/settings b/etc/config.sh/settings index cdd3b21f20867b894be47fd62a50e248af888a41..aff65057c399d478367689b0b6d181e929752f95 100644 --- a/etc/config.sh/settings +++ b/etc/config.sh/settings @@ -30,37 +30,6 @@ # #------------------------------------------------------------------------------ -# Prefix to PATH -_foamAddPath() -{ - while [ $# -ge 1 ] - do - export PATH=$1:$PATH - shift - done -} - -# Prefix to LD_LIBRARY_PATH -_foamAddLib() -{ - while [ $# -ge 1 ] - do - export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH - shift - done -} - -# Prefix to MANPATH -_foamAddMan() -{ - while [ $# -ge 1 ] - do - export MANPATH=$1:$MANPATH - shift - done -} - -#------------------------------------------------------------------------------ # Set environment variables according to system type export WM_ARCH=`uname -s` @@ -233,61 +202,19 @@ unset MPFR_ARCH_PATH GMP_ARCH_PATH # Location of compiler installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if [ -z "$foamCompiler" ] +if [ -z "$WM_COMPILER_TYPE" ] then - foamCompiler=system + WM_COMPILER_TYPE=system echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2 - echo " foamCompiler not set, using '$foamCompiler'" 1>&2 + echo " WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'" 1>&2 fi -case "${foamCompiler}" in -OpenFOAM | ThirdParty) - # Default versions of GMP, MPFR and MPC, overide as necessary - gmp_version=gmp-5.1.2 - mpfr_version=mpfr-3.1.2 - mpc_version=mpc-1.0.1 - case "$WM_COMPILER" in - Gcc | Gcc48) - gcc_version=gcc-4.8.5 - ;; - Gcc45) - gcc_version=gcc-4.5.4 - ;; - Gcc46) - gcc_version=gcc-4.6.4 - ;; - Gcc47) - gcc_version=gcc-4.7.4 - ;; - Gcc49) - gcc_version=gcc-4.9.3 - ;; - Gcc51) - gcc_version=gcc-5.1.0 - ;; - Gcc52) - gcc_version=gcc-5.2.0 - ;; - Gcc53) - gcc_version=gcc-5.3.0 - ;; - Clang) - # Using clang - not gcc - export WM_CC='clang' - export WM_CXX='clang++' - clang_version=llvm-3.7.0 - ;; - *) - echo 1>&2 - echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2 - echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" 1>&2 - echo " Please check your settings" 1>&2 - echo 1>&2 - ;; - esac +# Load configured compiler versions, regardless of the compiler type +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler` - # Optional configuration tweaks: - _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler` +case "$WM_COMPILER_TYPE" in +OpenFOAM | ThirdParty) if [ -n "$gcc_version" ] then @@ -303,7 +230,7 @@ OpenFOAM | ThirdParty) echo " Cannot find $gccDir installation." 1>&2 echo " Please install this compiler version or if you wish to" \ " use the system compiler," 1>&2 - echo " change the 'foamCompiler' setting to 'system'" 1>&2 + echo " change the 'WM_COMPILER_TYPE' setting to 'system'" 1>&2 echo } @@ -341,7 +268,7 @@ OpenFOAM | ThirdParty) echo " Cannot find $clangDir installation." 1>&2 echo " Please install this compiler version or if you wish to" \ " use the system compiler," 1>&2 - echo " change the 'foamCompiler' setting to 'system'" 1>&2 + echo " change the 'WM_COMPILER_TYPE' setting to 'system'" 1>&2 echo 1>&2 } @@ -354,15 +281,9 @@ system) # Use system compiler ;; *) - echo "Warn: foamCompiler='$foamCompiler' is unsupported" 1>&2 + echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2 echo " treating as 'system' instead" 1>&2 ;; esac - -# Cleanup environment: -# ~~~~~~~~~~~~~~~~~~~~ -#keep _foamAddPath _foamAddLib _foamAddMan -unset foamCompiler minBufferSize - #------------------------------------------------------------------------------