ENH: minor improvements to environment
- handle sourcing bashrc with a relative path (issue #383) - handle sourcing from bash and zsh. Still need manual intervention when sourcing dash, sh, or ksh. - replace grep in etc/cshrc with sed only - logical instead of physical path for WM_PROJECT_DIR (issue #431). Doesn't seem to be possible for csh/tcsh. * Continue using physical locations when comparing directories, but not for the top-level FOAM_INST_DIR, WM_PROJECT_DIR. - relocate WM_CC, WM_CXX overrides from etc/config.*/compiler to etc/config.*/settings to ensure that they are left untouched when etc/config.sh/compiler is sourced while making third-party packages (eg, gcc, llvm, CGAL). - provide fallback FOAM_TUTORIALS setting in RunFunctions STYLE: remove "~OpenFOAM" fallback as being too rare, non-obvious
This commit is contained in:
parent
5d62a7430d
commit
b970ba0901
@ -129,7 +129,7 @@ done
|
||||
ERROR: ParaView reader module library ($plugin) does not exist
|
||||
Please build the reader module before continuing:
|
||||
|
||||
cd \$FOAM_UTILITIES/postProcessing/graphics/PVReaders
|
||||
cd \$WM_PROJECT_DIR/applications/utilities/postProcessing/graphics/PVReaders
|
||||
./Allwclean
|
||||
./Allwmake
|
||||
|
||||
|
@ -28,6 +28,12 @@
|
||||
# Miscellaneous functions for running tutorial cases
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# The normal locations
|
||||
[ -n "$FOAM_TUTORIALS" ] || export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Look for '-parallel' in the argument list.
|
||||
#
|
||||
|
@ -139,11 +139,12 @@ _inlineSed()
|
||||
}
|
||||
|
||||
grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || { \
|
||||
echo "Failed: $msg in $file"
|
||||
echo "Failed: ${msg:-replacement} in $file"
|
||||
return 1
|
||||
}
|
||||
|
||||
echo " $msg ($file)"
|
||||
[ -n "$msg" ] && echo " $msg ($file)"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -166,7 +167,7 @@ replace()
|
||||
shift 2
|
||||
|
||||
_inlineSed \
|
||||
$file \
|
||||
$file \
|
||||
"$key=.*" \
|
||||
"$key=$val" \
|
||||
"Replaced $key setting by '$val'"
|
||||
@ -194,8 +195,13 @@ do
|
||||
_inlineSed \
|
||||
etc/bashrc \
|
||||
'\(.*BASH_SOURCE.*\)' \
|
||||
'##\1' \
|
||||
"Removed default FOAM_INST_DIR setting"
|
||||
'## \1' \
|
||||
"Remove default FOAM_INST_DIR setting" \
|
||||
&& _inlineSed \
|
||||
etc/bashrc \
|
||||
'\(.* && FOAM_INST_DIR\)' \
|
||||
'## \1'
|
||||
|
||||
_inlineSed \
|
||||
etc/bashrc \
|
||||
'^ *FOAM_INST_DIR=.*' \
|
||||
|
30
etc/bashrc
30
etc/bashrc
@ -27,7 +27,7 @@
|
||||
# Description
|
||||
# Startup file for OpenFOAM
|
||||
# Sourced from ~/.profile or ~/.bashrc
|
||||
# Should be usable by any POSIX-compliant shell (eg, ksh)
|
||||
# Should be usable by any POSIX-compliant shell (eg, dash, ksh)
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -37,20 +37,23 @@ export WM_PROJECT_VERSION=plus
|
||||
################################################################################
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
#
|
||||
# FOAM_INST_DIR is the location of the OpenFOAM installation which defaults to
|
||||
# the directory containing this file if sourced by a bash shell.
|
||||
# FOAM_INST_DIR = the parent directory containing the OpenFOAM installation(s).
|
||||
# - If the OpenFOAM installation has this OpenFOAM-<VERSION>/etc/bashrc, the
|
||||
# next lines should work when sourced by a BASH or ZSH shell.
|
||||
# - If this does not produce the desired result, please set one of the fallback
|
||||
# values to an appropriate path.
|
||||
#
|
||||
# Please set to the appropriate path if the default is not correct.
|
||||
#
|
||||
[ $BASH_SOURCE ] && FOAM_INST_DIR=$(\cd ${BASH_SOURCE%/*/*/*} && \pwd -P) || \
|
||||
rc="${BASH_SOURCE:-${ZSH_NAME:+$0}}"
|
||||
[ -n "$rc" ] && FOAM_INST_DIR=$(\cd $(dirname $rc)/../.. && \pwd -L) || \
|
||||
FOAM_INST_DIR=$HOME/$WM_PROJECT
|
||||
# FOAM_INST_DIR=~$WM_PROJECT
|
||||
# FOAM_INST_DIR=/opt/$WM_PROJECT
|
||||
# FOAM_INST_DIR=/usr/local/$WM_PROJECT
|
||||
#
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
################################################################################
|
||||
: # Extra safety - if the user commented out all fallback values
|
||||
export FOAM_INST_DIR
|
||||
unset rc
|
||||
|
||||
# The default environment variables below can be overridden in a prefs.sh file
|
||||
# located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM,
|
||||
@ -90,8 +93,8 @@ export WM_COMPILE_OPTION=Opt
|
||||
export WM_MPLIB=SYSTEMOPENMPI
|
||||
|
||||
#- Operating System:
|
||||
# WM_OSTYPE = POSIX | ???
|
||||
export WM_OSTYPE=POSIX
|
||||
# WM_OSTYPE = POSIX
|
||||
#export WM_OSTYPE=POSIX
|
||||
|
||||
#- Floating-point signal handling:
|
||||
# set or unset
|
||||
@ -132,8 +135,8 @@ fi
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~
|
||||
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
|
||||
|
||||
# Load helper functions
|
||||
# ~~~~~~~~~~~~~~~~~~~~~
|
||||
# Load shell functions
|
||||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||
|
||||
# Add in preset user or site preferences:
|
||||
@ -206,9 +209,8 @@ fi
|
||||
# ~~~~~~~~~~~~~~~~~~~
|
||||
unset cleaned foamClean foamOldDirs
|
||||
|
||||
|
||||
# Unload helper functions
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Unload functions
|
||||
# ~~~~~~~~~~~~~~~~
|
||||
. $WM_PROJECT_DIR/etc/config.sh/functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -31,7 +31,6 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
switch ("$WM_COMPILER_TYPE")
|
||||
case OpenFOAM:
|
||||
case ThirdParty:
|
||||
# Default versions of GMP, MPFR and MPC, override as necessary
|
||||
set gmp_version=gmp-system
|
||||
@ -90,21 +89,6 @@ Please check your settings
|
||||
UNKNOWN_COMPILER
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
setenv WM_COMPILER_TYPE ThirdParty # Canonical name
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
# Common settings (system or ThirdParty)
|
||||
switch ("$WM_COMPILER")
|
||||
case Clang*:
|
||||
# Using clang - not gcc
|
||||
setenv WM_CC 'clang'
|
||||
setenv WM_CXX 'clang++'
|
||||
breaksw
|
||||
case Icc*:
|
||||
setenv WM_CC 'icc'
|
||||
setenv WM_CXX 'icpc'
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Fallback value
|
||||
if (! $?CEI_HOME) then
|
||||
if (! $?CEI_HOME ) then
|
||||
setenv CEI_HOME /usr/local/ensight/CEI
|
||||
endif
|
||||
|
||||
|
@ -30,21 +30,13 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Modified compiler settings
|
||||
# Modify/override compiler settings
|
||||
switch ("$WM_COMPILER")
|
||||
case Gcc46:
|
||||
case Gcc46++0x:
|
||||
set gcc_version=gcc-4.6.0
|
||||
set gmp_version=gmp-5.0.1
|
||||
set mpfr_version=mpfr-2.4.2
|
||||
set mpc_version=mpc-0.8.1
|
||||
breaksw
|
||||
case Gcc45:
|
||||
case Gcc45++0x:
|
||||
set gcc_version=gcc-4.5.2
|
||||
set gmp_version=gmp-5.0.1
|
||||
set mpfr_version=mpfr-2.4.2
|
||||
set mpc_version=mpc-0.8.1
|
||||
case Gcc70:
|
||||
set gcc_version=gcc-7.0.0
|
||||
set gmp_version=gmp-6.1.2
|
||||
set mpfr_version=mpfr-3.1.5
|
||||
set mpc_version=mpc-1.0.3
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
|
@ -259,8 +259,8 @@ else
|
||||
setenv MPI_BUFFER_SIZE $minBufferSize
|
||||
endif
|
||||
|
||||
# Cleanup environment:
|
||||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
# Cleanup environment
|
||||
# ~~~~~~~~~~~~~~~~~~~
|
||||
unset minBufferSize
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -59,7 +59,7 @@ set cmake_version=cmake-system
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if ( ! $?ParaView_DIR ) setenv ParaView_DIR
|
||||
if (! $?ParaView_DIR ) setenv ParaView_DIR
|
||||
|
||||
# Clean PATH and LD_LIBRARY_PATH
|
||||
set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/ParaView-"`
|
||||
|
@ -39,11 +39,10 @@ alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Set environment variables according to system type
|
||||
if (! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX # Default is POSIX
|
||||
setenv WM_COMPILER_LIB_ARCH # Set, but empty: default for 32bit
|
||||
|
||||
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
|
||||
@ -54,7 +53,7 @@ case Linux:
|
||||
breaksw
|
||||
|
||||
case x86_64:
|
||||
if ( ! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64 # Default to 64-bit
|
||||
if (! $?WM_ARCH_OPTION ) setenv WM_ARCH_OPTION 64 # Default to 64-bit
|
||||
switch ($WM_ARCH_OPTION)
|
||||
case 32:
|
||||
setenv WM_COMPILER_ARCH 64
|
||||
@ -136,7 +135,6 @@ UNSUPPORTED_OS
|
||||
|
||||
endsw
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Location of the jobControl directory
|
||||
@ -202,37 +200,49 @@ _foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
|
||||
# Make sure to pick up dummy versions of external libraries last
|
||||
_foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_EXT_LIBBIN}:${FOAM_LIBBIN}/dummy
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Compiler settings
|
||||
# ~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Default to system compiler
|
||||
if (! $?WM_COMPILER_TYPE ) setenv WM_COMPILER_TYPE system
|
||||
|
||||
# Adjustments for non-gcc compilers
|
||||
switch ("$WM_COMPILER")
|
||||
case Clang*:
|
||||
# Using clang - not gcc
|
||||
setenv WM_CC 'clang'
|
||||
setenv WM_CXX 'clang++'
|
||||
breaksw
|
||||
case Icc*:
|
||||
# Using icc - not gcc
|
||||
setenv WM_CC 'icc'
|
||||
setenv WM_CXX 'icpc'
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
# Clear prior to sourcing
|
||||
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
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Load pre-defined compiler versions
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_foamEtc config.csh/compiler
|
||||
|
||||
switch ("$WM_COMPILER_TYPE")
|
||||
case system:
|
||||
# Use system compiler
|
||||
breaksw
|
||||
switch ("$WM_COMPILER_TYPE-$WM_COMPILER")
|
||||
case ThirdParty-Gcc*:
|
||||
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
|
||||
|
||||
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
|
||||
/bin/cat << GCC_NOT_FOUND
|
||||
# Check that the compiler directory can be found
|
||||
if ( ! -d "$gccDir" ) then
|
||||
/bin/cat << GCC_NOT_FOUND
|
||||
===============================================================================
|
||||
Warning in $WM_PROJECT_DIR/etc/config.csh/settings:
|
||||
Cannot find '$WM_COMPILER' compiler installation
|
||||
@ -242,39 +252,39 @@ Cannot find '$WM_COMPILER' compiler installation
|
||||
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
|
||||
_foamAddMan $gccDir/man
|
||||
_foamAddPath $gccDir/bin
|
||||
|
||||
# Check that the compiler directory can be found
|
||||
if ( ! -d "$clangDir" ) then
|
||||
/bin/cat << CLANG_NOT_FOUND
|
||||
# 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
|
||||
breaksw
|
||||
|
||||
case ThirdParty-Clang*:
|
||||
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
|
||||
/bin/cat << CLANG_NOT_FOUND
|
||||
===============================================================================
|
||||
Warning in $WM_PROJECT_DIR/etc/config.csh/settings:
|
||||
Cannot find '$WM_COMPILER' compiler installation
|
||||
@ -284,20 +294,20 @@ Cannot find '$WM_COMPILER' compiler installation
|
||||
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
|
||||
_foamAddMan $clangDir/man
|
||||
_foamAddPath $clangDir/bin
|
||||
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${clangDir:t}"
|
||||
endif
|
||||
breaksw
|
||||
|
||||
case system-*:
|
||||
case ThirdParty-*:
|
||||
# Using system compiler or other ThirdParty compiler
|
||||
breaksw
|
||||
|
||||
default:
|
||||
@ -312,9 +322,12 @@ UNKNOWN_TYPE
|
||||
|
||||
endsw
|
||||
|
||||
# Cleanup
|
||||
# ~~~~~~~
|
||||
unset gcc_version gccDir
|
||||
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
|
||||
unset clang_version clangDir
|
||||
# Retain: _foamAddPath _foamAddLib _foamAddMan
|
||||
|
||||
# Cleanup environment:
|
||||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
#- keep _foamAddPath _foamAddLib _foamAddMan
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -31,7 +31,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
case "$WM_COMPILER_TYPE" in
|
||||
OpenFOAM | ThirdParty)
|
||||
ThirdParty)
|
||||
# Default versions of GMP, MPFR and MPC, override as necessary
|
||||
gmp_version=gmp-system
|
||||
mpfr_version=mpfr-system
|
||||
@ -88,20 +88,6 @@ Please check your settings
|
||||
UNKNOWN_COMPILER
|
||||
;;
|
||||
esac
|
||||
WM_COMPILER_TYPE=ThirdParty # Canonical name
|
||||
;;
|
||||
esac
|
||||
|
||||
# Common settings (system or ThirdParty)
|
||||
case "$WM_COMPILER" in
|
||||
Clang*)
|
||||
# Using clang - not gcc
|
||||
export WM_CC='clang'
|
||||
export WM_CXX='clang++'
|
||||
;;
|
||||
Icc*)
|
||||
export WM_CC='icc'
|
||||
export WM_CXX='icpc'
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -30,39 +30,23 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# First load the standard versions, if necessary
|
||||
if foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config.sh/compiler)
|
||||
then
|
||||
. $foamFile
|
||||
fi
|
||||
unset foamFile
|
||||
# Load the standard versions...
|
||||
eval $($WM_PROJECT_DIR/bin/foamEtcFile -sh -mode=o config.sh/compiler)
|
||||
|
||||
|
||||
# Override compiler settings
|
||||
# Modify/override compiler settings
|
||||
case "$WM_COMPILER" in
|
||||
Gcc46 | Gcc46++0x)
|
||||
gcc_version=gcc-4.6.0
|
||||
gmp_version=gmp-5.0.1
|
||||
mpfr_version=mpfr-2.4.2
|
||||
mpc_version=mpc-0.8.1
|
||||
;;
|
||||
Gcc45 | Gcc45++0x)
|
||||
gcc_version=gcc-4.5.2
|
||||
gmp_version=gmp-5.0.1
|
||||
mpfr_version=mpfr-2.4.2
|
||||
mpc_version=mpc-0.8.1
|
||||
Gcc70)
|
||||
gcc_version=gcc-7.0.0
|
||||
gmp_version=gmp-6.1.2
|
||||
mpfr_version=mpfr-3.1.5
|
||||
mpc_version=mpc-1.0.3
|
||||
;;
|
||||
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"
|
||||
# will also need to create the 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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -35,10 +35,11 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Use other (shipped) paraview with a different ParaView_VERSION
|
||||
# Use the shipped paraview config file (-mode=o)
|
||||
# with a different ParaView_VERSION
|
||||
#
|
||||
|
||||
foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config.sh/paraview 2>/dev/null)
|
||||
foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode=o config.sh/paraview 2>/dev/null)
|
||||
[ $? -eq 0 ] && . $foamFile ParaView_VERSION=5.0.1
|
||||
|
||||
unset foamFile
|
||||
|
@ -30,12 +30,12 @@
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$WM_BASH_FUNCTIONS" ]
|
||||
if [ -z "$WM_SHELL_FUNCTIONS" ]
|
||||
then
|
||||
# Not previously loaded/defined - define now
|
||||
|
||||
# Temporary environment variable to track loading/unloading of functions
|
||||
WM_BASH_FUNCTIONS=loaded
|
||||
WM_SHELL_FUNCTIONS=loaded
|
||||
|
||||
# Prefix to PATH
|
||||
_foamAddPath()
|
||||
@ -69,7 +69,6 @@ then
|
||||
# Evaluate command-line parameters
|
||||
_foamEval()
|
||||
{
|
||||
local file
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
@ -105,7 +104,7 @@ then
|
||||
else
|
||||
# Was previously loaded/defined - now unset
|
||||
|
||||
unset WM_BASH_FUNCTIONS
|
||||
unset WM_SHELL_FUNCTIONS
|
||||
unset -f _foamAddPath _foamAddLib _foamAddMan
|
||||
unset -f _foamEtc _foamEval
|
||||
|
||||
|
@ -274,8 +274,8 @@ fi
|
||||
export MPI_BUFFER_SIZE
|
||||
|
||||
|
||||
# Cleanup environment:
|
||||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
# Cleanup environment
|
||||
# ~~~~~~~~~~~~~~~~~~~
|
||||
unset minBufferSize
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -29,10 +29,10 @@
|
||||
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Set environment variables according to system type
|
||||
export WM_ARCH=$(uname -s)
|
||||
: ${WM_OSTYPE:=POSIX}; export WM_OSTYPE # Default is POSIX
|
||||
|
||||
export WM_ARCH=$(uname -s)
|
||||
case "$WM_ARCH" in
|
||||
Linux)
|
||||
WM_ARCH=linux
|
||||
@ -201,34 +201,45 @@ _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
|
||||
# Make sure to pick up dummy versions of external libraries last
|
||||
_foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Compiler settings
|
||||
# ~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Default to system compiler
|
||||
: ${WM_COMPILER_TYPE:=system}; export WM_COMPILER_TYPE
|
||||
|
||||
# Adjust for non-gcc compilers
|
||||
case "$WM_COMPILER" in
|
||||
Clang*)
|
||||
# Using clang - not gcc
|
||||
export WM_CC='clang'
|
||||
export WM_CXX='clang++'
|
||||
;;
|
||||
Icc*)
|
||||
# Using icc - not gcc
|
||||
export WM_CC='icc'
|
||||
export WM_CXX='icpc'
|
||||
;;
|
||||
esac
|
||||
|
||||
# Clear prior to sourcing
|
||||
unset gcc_version gmp_version mpfr_version mpc_version
|
||||
unset GMP_ARCH_PATH MPFR_ARCH_PATH
|
||||
|
||||
# Compiler installation - default to system
|
||||
# ~~~~~~~~~~~~~~~~~~~~~
|
||||
: ${WM_COMPILER_TYPE:=system}; export WM_COMPILER_TYPE
|
||||
|
||||
# Load configured compiler versions, regardless of the compiler type
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# Load pre-defined compiler versions
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
_foamEtc config.sh/compiler
|
||||
|
||||
case "$WM_COMPILER_TYPE" in
|
||||
system)
|
||||
# Use system compiler
|
||||
;;
|
||||
case "$WM_COMPILER_TYPE-$WM_COMPILER" in
|
||||
ThirdParty-Gcc*)
|
||||
gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
|
||||
gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/${gmp_version:-gmp-system}
|
||||
mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/${mpfr_version:-mpfr-system}
|
||||
mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/${mpc_version:-mpc-system}
|
||||
|
||||
ThirdParty)
|
||||
if [ -n "$gcc_version" ]
|
||||
then
|
||||
gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
|
||||
gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/${gmp_version:-gmp-system}
|
||||
mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/${mpfr_version:-mpfr-system}
|
||||
mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/${mpc_version:-mpc-system}
|
||||
|
||||
# Check that the compiler directory can be found
|
||||
[ -d "$gccDir" ] || /bin/cat << GCC_NOT_FOUND 1>&2
|
||||
# Check that the compiler directory can be found
|
||||
[ -d "$gccDir" ] || /bin/cat << GCC_NOT_FOUND 1>&2
|
||||
===============================================================================
|
||||
Warning in $WM_PROJECT_DIR/etc/config.sh/settings:
|
||||
Cannot find '$WM_COMPILER' compiler installation
|
||||
@ -239,41 +250,40 @@ Cannot find '$WM_COMPILER' compiler installation
|
||||
===============================================================================
|
||||
GCC_NOT_FOUND
|
||||
|
||||
_foamAddMan $gccDir/man
|
||||
_foamAddPath $gccDir/bin
|
||||
_foamAddMan $gccDir/man
|
||||
_foamAddPath $gccDir/bin
|
||||
|
||||
# Add ThirdParty compiler libraries to run-time environment
|
||||
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
|
||||
# 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##*-}" != system ]
|
||||
then
|
||||
_foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH
|
||||
export GMP_ARCH_PATH=$gmpDir # For ThirdParty CGAL
|
||||
fi
|
||||
if [ "${mpfrDir##*-}" != system ]
|
||||
then
|
||||
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
|
||||
export MPFR_ARCH_PATH=$mpfrDir # For ThirdParty CGAL
|
||||
fi
|
||||
if [ "${mpcDir##*-}" != system ]
|
||||
then
|
||||
_foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
|
||||
fi
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${gccDir##*/} (${gmpDir##*/} $${mpfrDir##*/} ${mpcDir##*/})"
|
||||
fi
|
||||
# Add ThirdParty gmp/mpfr/mpc libraries to run-time environment
|
||||
if [ "${gmpDir##*-}" != system ]
|
||||
then
|
||||
_foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH
|
||||
export GMP_ARCH_PATH=$gmpDir # For ThirdParty CGAL
|
||||
fi
|
||||
if [ "${mpfrDir##*-}" != system ]
|
||||
then
|
||||
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
|
||||
export MPFR_ARCH_PATH=$mpfrDir # For ThirdParty CGAL
|
||||
fi
|
||||
if [ "${mpcDir##*-}" != system ]
|
||||
then
|
||||
_foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
|
||||
fi
|
||||
|
||||
if [ -n "$clang_version" ]
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${gccDir##*/} (${gmpDir##*/} $${mpfrDir##*/} ${mpcDir##*/})"
|
||||
fi
|
||||
;;
|
||||
|
||||
# Check that the compiler directory can be found
|
||||
[ -d "$clangDir" ] || /bin/cat << CLANG_NOT_FOUND 1>&2
|
||||
ThirdParty-Clang*)
|
||||
clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
|
||||
|
||||
# Check that the compiler directory can be found
|
||||
[ -d "$clangDir" ] || /bin/cat << CLANG_NOT_FOUND 1>&2
|
||||
===============================================================================
|
||||
Warning in $WM_PROJECT_DIR/etc/config.sh/settings:
|
||||
Cannot find '$WM_COMPILER' compiler installation
|
||||
@ -284,20 +294,20 @@ Cannot find '$WM_COMPILER' compiler installation
|
||||
===============================================================================
|
||||
CLANG_NOT_FOUND
|
||||
|
||||
_foamAddMan $clangDir/share/man
|
||||
_foamAddPath $clangDir/bin
|
||||
_foamAddMan $clangDir/share/man
|
||||
_foamAddPath $clangDir/bin
|
||||
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${clangDir##*/}"
|
||||
fi
|
||||
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
||||
then
|
||||
echo "Using ThirdParty compiler"
|
||||
echo " ${clangDir##*/}"
|
||||
fi
|
||||
|
||||
unset gcc_version gccDir
|
||||
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
|
||||
unset clang_version clangDir
|
||||
;;
|
||||
|
||||
system-* | ThirdParty-*)
|
||||
# Using system compiler or other ThirdParty compiler
|
||||
;;
|
||||
|
||||
*)
|
||||
/bin/cat << UNKNOWN_TYPE 1>&2
|
||||
===============================================================================
|
||||
@ -310,4 +320,11 @@ UNKNOWN_TYPE
|
||||
|
||||
esac
|
||||
|
||||
|
||||
# Cleanup
|
||||
# ~~~~~~~
|
||||
unset gcc_version gccDir
|
||||
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
|
||||
unset clang_version clangDir
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
39
etc/cshrc
39
etc/cshrc
@ -36,22 +36,22 @@ setenv WM_PROJECT_VERSION plus
|
||||
################################################################################
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
#
|
||||
# FOAM_INST_DIR is the location of the OpenFOAM installation which defaults to
|
||||
# the directory containing this file.
|
||||
# FOAM_INST_DIR = the parent directory containing the OpenFOAM installation(s).
|
||||
# - If the OpenFOAM installation has this OpenFOAM-<VERSION>/etc/cshrc, the
|
||||
# next lines should work when sourced by a CSH or TCSH shell.
|
||||
# - If this does not produce the desired result, please set one of the fallback
|
||||
# values to an appropriate path.
|
||||
#
|
||||
# Please set to the appropriate path if the default is not correct.
|
||||
#
|
||||
setenv FOAM_INST_DIR `lsof +p $$ |& grep -oE '/.*'$WM_PROJECT'[^/]*/etc/cshrc' | \
|
||||
sed 's%/'$WM_PROJECT'[^/]*/etc/cshrc%%'`
|
||||
setenv FOAM_INST_DIR `/usr/bin/lsof +p $$ |& \
|
||||
sed -n -e 's@[^/]*@@' -e 's@/'$WM_PROJECT'[^/]*/etc/cshrc@@p'`
|
||||
# setenv FOAM_INST_DIR $HOME/$WM_PROJECT
|
||||
# setenv FOAM_INST_DIR ~$WM_PROJECT
|
||||
# setenv FOAM_INST_DIR /opt/$WM_PROJECT
|
||||
# setenv FOAM_INST_DIR /usr/local/$WM_PROJECT
|
||||
#
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
################################################################################
|
||||
|
||||
# The default environment variables below can be overridden in a prefs.sh file
|
||||
# The default environment variables below can be overridden in a prefs.csh file
|
||||
# located in ~/.OpenFOAM/$WM_PROJECT_VERSION, ~/.OpenFOAM,
|
||||
# $FOAM_INST_DIR/site/$WM_PROJECT_VERSION or $FOAM_INST_DIR/site
|
||||
|
||||
@ -90,8 +90,8 @@ setenv WM_COMPILE_OPTION Opt
|
||||
setenv WM_MPLIB SYSTEMOPENMPI
|
||||
|
||||
#- Operating System:
|
||||
# WM_OSTYPE = POSIX | ???
|
||||
setenv WM_OSTYPE POSIX
|
||||
# WM_OSTYPE = POSIX
|
||||
#setenv WM_OSTYPE POSIX
|
||||
|
||||
#- Floating-point signal handling:
|
||||
# set or unset
|
||||
@ -176,11 +176,11 @@ while ( $#argv > 0 )
|
||||
breaksw
|
||||
default:
|
||||
# Filename: source it
|
||||
if ( -f "$1" ) then
|
||||
if ($?FOAM_VERBOSE && $?prompt) echo "Using: $1"
|
||||
source "$1"
|
||||
if ( -f "$argv[1]" ) then
|
||||
if ($?FOAM_VERBOSE && $?prompt) echo "Using: $argv[1]"
|
||||
source "$argv[1]"
|
||||
else
|
||||
_foamEtc -silent "$1"
|
||||
_foamEtc -silent "$argv[1]"
|
||||
endif
|
||||
breaksw
|
||||
endsw
|
||||
@ -195,8 +195,8 @@ set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
|
||||
#- prevent local variables from shadowing setenv variables
|
||||
unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD
|
||||
|
||||
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH ''
|
||||
if (! $?MANPATH) setenv MANPATH ''
|
||||
if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH
|
||||
if (! $?MANPATH ) setenv MANPATH
|
||||
|
||||
#- Clean PATH (path)
|
||||
set cleaned=`$foamClean "$PATH" "$foamOldDirs"`
|
||||
@ -249,9 +249,12 @@ if ( $?LD_PRELOAD ) then
|
||||
endif
|
||||
|
||||
|
||||
# Cleanup environment:
|
||||
# ~~~~~~~~~~~~~~~~~~~~
|
||||
# Cleanup environment
|
||||
# ~~~~~~~~~~~~~~~~~~~
|
||||
unset cleaned foamClean foamOldDirs
|
||||
unalias _foamEtc
|
||||
unalias _foamAddPath
|
||||
unalias _foamAddLib
|
||||
unalias _foamAddMan
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -20,10 +20,10 @@ cd ${0%/*} && wmakeCheckPwd "$WM_PROJECT_DIR/src" 2>/dev/null || {
|
||||
wmakePrintBuild -check || wrmo OpenFOAM/global/global.o 2>/dev/null
|
||||
|
||||
wmakeLnInclude -u OpenFOAM
|
||||
wmakeLnInclude -u OSspecific/${WM_OSTYPE:-POSIX}
|
||||
wmakeLnInclude -u OSspecific/${WM_OSTYPE:=POSIX}
|
||||
Pstream/Allwmake $targetType $*
|
||||
|
||||
OSspecific/${WM_OSTYPE:-POSIX}/Allwmake $targetType $*
|
||||
OSspecific/${WM_OSTYPE:=POSIX}/Allwmake $targetType $*
|
||||
wmake $targetType OpenFOAM
|
||||
|
||||
wmake $targetType fileFormats
|
||||
|
@ -95,6 +95,12 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
# Set tutorial locations (as required)
|
||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#
|
||||
# set up a default scheme on all schemes
|
||||
|
@ -85,7 +85,7 @@ expandPath()
|
||||
# - WM_PROJECT_DIR, HOME
|
||||
findTarget()
|
||||
{
|
||||
local wmpdir=$(expandPath $WM_PROJECT_DIR)
|
||||
local project=$(expandPath $WM_PROJECT_DIR)
|
||||
local home=$(expandPath $HOME)
|
||||
local reldir="${1:-.}"
|
||||
local absdir=$(expandPath $reldir)
|
||||
@ -93,7 +93,7 @@ findTarget()
|
||||
while [ -n "$absdir" ]
|
||||
do
|
||||
case "$absdir" in
|
||||
($wmpdir | $home | /)
|
||||
($project | $home | /)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
@ -154,21 +154,21 @@ cdSource()
|
||||
# - WM_PROJECT_DIR, WM_OPTIONS
|
||||
findObjectDir()
|
||||
{
|
||||
local wmpdir=$(expandPath $WM_PROJECT_DIR)
|
||||
local exPath=$(expandPath ${1:-.})
|
||||
local project=$(expandPath $WM_PROJECT_DIR)
|
||||
local absdir=$(expandPath ${1:-.})
|
||||
local objectsDir
|
||||
|
||||
case "$exPath" in
|
||||
("$wmpdir"/*)
|
||||
case "$absdir" in
|
||||
("$project"/*)
|
||||
local buildPath=$WM_PROJECT_DIR/build/${WM_OPTIONS}
|
||||
objectsDir=$buildPath$(echo $exPath | sed s%$wmpdir%% )
|
||||
objectsDir=$buildPath$(echo $absdir | sed s%$project%% )
|
||||
;;
|
||||
(*)
|
||||
local path=$exPath
|
||||
local path=$absdir
|
||||
local appDir=.
|
||||
[ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal
|
||||
exPath=$(expandPath $appDir/.)
|
||||
objectsDir=$appDir/Make/${WM_OPTIONS}$(echo $path | sed s%$exPath%% )
|
||||
absdir=$(expandPath $appDir/.)
|
||||
objectsDir=$appDir/Make/${WM_OPTIONS}$(echo $path | sed s%$absdir%% )
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user