openfoam/etc/config.csh/settings
Mark Olesen 5bb5b3adfa BACKPORT: spack configuration patches (as per OpenFOAM-v1706)
etc/bashrc
  - improved robustness when sourcing
  - source top-level prefs.sh first (for sysadmin changes)

etc/config.*/settings
  - write job control information to the user directory
  - site/ directory under the OpenFOAM project dir, not its parent dir

etc/config.*/mpi
  - added USERMPI as place for spack mpi information

mgridgen, zoltan:
  - make location configurable

metis, scotch:
  - also check lib path (not just lib64)
2019-10-09 13:07:03 +02:00

316 lines
10 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# 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.csh/settings
#
# Description
# Startup file for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/cshrc
#
#------------------------------------------------------------------------------
# Prefix to PATH
alias _foamAddPath 'setenv PATH \!*\:${PATH}'
# Prefix to LD_LIBRARY_PATH
alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
# Prefix to MANPATH
alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
#------------------------------------------------------------------------------
# Set environment variables according to system type
setenv WM_ARCH `uname -s`
# Default WM_COMPILER_LIB_ARCH for 32bit
setenv WM_COMPILER_LIB_ARCH
switch ($WM_ARCH)
case Linux:
setenv WM_ARCH linux
switch (`uname -m`)
case i686:
setenv WM_ARCH_OPTION 32
breaksw
case x86_64:
switch ($WM_ARCH_OPTION)
case 32:
setenv WM_COMPILER_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m32 -fPIC'
setenv WM_CXXFLAGS '-m32 -fPIC -std=c++0x'
setenv WM_LDFLAGS '-m32'
breaksw
case 64:
setenv WM_ARCH linux64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m64 -fPIC'
setenv WM_CXXFLAGS '-m64 -fPIC -std=c++0x'
setenv WM_LDFLAGS '-m64'
breaksw
default:
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
breaksw
endsw
breaksw
case ia64:
setenv WM_ARCH linuxIA64
setenv WM_COMPILER I64
breaksw
case ppc64:
setenv WM_ARCH linuxPPC64
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m64 -fPIC'
setenv WM_CXXFLAGS '-m64 -fPIC -std=c++0x'
setenv WM_LDFLAGS '-m64'
breaksw
case ppc64le:
setenv WM_ARCH linuxPPC64le
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-m64 -fPIC'
setenv WM_CXXFLAGS '-m64 -fPIC -std=c++0x'
setenv WM_LDFLAGS '-m64'
breaksw
default:
echo Unknown processor type `uname -m` for Linux
breaksw
endsw
breaksw
case SunOS:
setenv WM_ARCH SunOS64
setenv WM_MPLIB FJMPI
setenv WM_COMPILER_LIB_ARCH 64
setenv WM_CC 'gcc'
setenv WM_CXX 'g++'
setenv WM_CFLAGS '-mabi=64 -fPIC'
setenv WM_CXXFLAGS '-mabi=64 -fPIC -std=c++0x'
setenv WM_LDFLAGS '-mabi=64 -G0'
breaksw
default:
echo
echo "Your '$WM_ARCH' operating system is not supported by this release"
echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.com"
echo
breaksw
endsw
#------------------------------------------------------------------------------
# Location of the jobControl directory
setenv FOAM_JOB_DIR "$HOME/.OpenFOAM/jobControl"
# wmake configuration
setenv WM_DIR $WM_PROJECT_DIR/wmake
setenv WM_LINK_LANGUAGE c++
setenv WM_LABEL_OPTION Int$WM_LABEL_SIZE
setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION$WM_COMPILE_OPTION
# Base executables/libraries
setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
# External (ThirdParty) libraries
setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/lib
# Site-specific directory
if ( $?WM_PROJECT_SITE ) then
set siteDir=$WM_PROJECT_SITE
else
set siteDir=$WM_PROJECT_INST_DIR/site
endif
# Shared site executables/libraries
# Similar naming convention as ~OpenFOAM expansion
setenv FOAM_SITE_APPBIN $siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
setenv FOAM_SITE_LIBBIN $siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
# User executables/libraries
setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
# DynamicCode templates
# - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
# setenv FOAM_CODE_TEMPLATES $WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
# Convenience
setenv FOAM_ETC $WM_PROJECT_DIR/etc
setenv FOAM_APP $WM_PROJECT_DIR/applications
setenv FOAM_SRC $WM_PROJECT_DIR/src
setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
setenv FOAM_UTILITIES $FOAM_APP/utilities
setenv FOAM_SOLVERS $FOAM_APP/solvers
setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
# Add wmake to the path - not required for runtime-only environment
if ( -d "${WM_DIR}" ) setenv PATH ${WM_DIR}:${PATH}
# Add OpenFOAM scripts to the path
setenv PATH ${WM_PROJECT_DIR}/bin:${PATH}
# Add site-specific scripts to path - only if they exist
if ( -d "$siteDir/bin" ) then # Generic
_foamAddPath "$siteDir/bin"
endif
if ( -d "$siteDir/$WM_PROJECT_VERSION/bin" ) then # Version-specific
_foamAddPath "$siteDir/$WM_PROJECT_VERSION/bin"
endif
unset siteDir
_foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
_foamAddLib $FOAM_LIBBIN/dummy # Dummy versions of external libraries last
if ( $?FOAM_EXT_LIBBIN ) then # External libraries (allowed to be unset)
_foamAddLib $FOAM_EXT_LIBBIN
endif
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}
# Compiler settings
# ~~~~~~~~~~~~~~~~~
unset gcc_version gmp_version mpfr_version mpc_version
unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
# Compiler installation - default to system
# ~~~~~~~~~~~~~~~~~~~~~
if ( ! $?WM_COMPILER_TYPE ) setenv WM_COMPILER_TYPE system
# Load configured compiler versions, regardless of the compiler type
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/compiler`
switch ("$WM_COMPILER_TYPE")
case system:
# Use system compiler
breaksw
case OpenFOAM:
case ThirdParty:
if ( $?gcc_version ) then
if ( ! $?gmp_version ) set gmp_version=gmp-system
if ( ! $?mpfr_version ) set mpfr_version=mpfr-system
if ( ! $?mpc_version ) set mpc_version=mpc-system
set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
set gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
set mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
set mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
# Check that the compiler directory can be found
if ( ! -d "$gccDir" ) then
cat << GCC_NOT_FOUND
===============================================================================
Warning in $WM_PROJECT_DIR/etc/config.csh/settings:
Cannot find '$WM_COMPILER' compiler installation
$gccDir
Either install this compiler version, or use the system compiler by setting
WM_COMPILER_TYPE to 'system' in \$WM_PROJECT_DIR/etc/cshrc.
===============================================================================
GCC_NOT_FOUND
endif
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
# Add ThirdParty compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# Add ThirdParty gmp/mpfr/mpc libraries to run-time environment
if ( "${gmpDir:t}" != "gmp-system" ) then
_foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH
setenv GMP_ARCH_PATH $gmpDir # For ThirdParty CGAL
endif
if ( "${mpfrDir:t}" != "mpfr-system" ) then
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
setenv MPFR_ARCH_PATH $mpfrDir # For ThirdParty CGAL
endif
if ( "${mpcDir:t}" != "mpc-system" ) then
_foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
endif
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using ThirdParty compiler"
echo " ${gccDir:t} (${gmpDir:t} ${mpfrDir:t} ${mpcDir:t})"
endif
endif
if ( $?clang_version ) then
set clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
# Check that the compiler directory can be found
if ( ! -d "$clangDir" ) then
cat << CLANG_NOT_FOUND
===============================================================================
Warning in $WM_PROJECT_DIR/etc/config.csh/settings:
Cannot find '$WM_COMPILER' compiler installation
$clangDir
Either install this compiler version, or use the system compiler by setting
WM_COMPILER_TYPE to 'system' in \$WM_PROJECT_DIR/etc/cshrc.
===============================================================================
CLANG_NOT_FOUND
endif
_foamAddMan $clangDir/man
_foamAddPath $clangDir/bin
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using ThirdParty compiler"
echo " ${clangDir:t}"
endif
endif
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir
breaksw
default:
echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported"
echo " treating as 'system' instead"
breaksw
endsw
# Cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
#- keep _foamAddPath _foamAddLib _foamAddMan
#------------------------------------------------------------------------------