mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: handle command-line parameters in bashrc/cshrc
- this provides a means to temporarily override the default settings
and/or the prefs.{csh,sh} settings.
bash:
name= -> unset name
name=value -> export name=value
csh:
name= -> unsetenv name
name=value -> setenv name value
eg,
. <WM_PROJECT_DIR>/etc/bashrc WM_COMPILER=Gcc45 WM_MPLIB=
to use gcc 4.5 and the default mplib
This commit is contained in:
16
etc/bashrc
16
etc/bashrc
@ -90,6 +90,22 @@ _foamSource()
|
||||
foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` && _foamSource $foamPrefs
|
||||
unset foamPrefs
|
||||
|
||||
# Evaluate command-line parameters
|
||||
while [ $# -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
*=)
|
||||
# name= -> unset name
|
||||
eval "unset ${1%=}"
|
||||
;;
|
||||
*=*)
|
||||
# name=value -> export name=value
|
||||
eval "export $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# Operating System/Platform
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
15
etc/cshrc
15
etc/cshrc
@ -78,6 +78,21 @@ if ( $status == 0 ) then
|
||||
endif
|
||||
unset foamPrefs
|
||||
|
||||
# Evaluate command-line parameters
|
||||
while ( $#argv > 0 )
|
||||
switch ($argv[1])
|
||||
case *=:
|
||||
# name= -> unsetenv name
|
||||
eval "unsetenv $argv[1]:s/=//"
|
||||
breaksw
|
||||
case *=*:
|
||||
# name=value -> setenv name value
|
||||
eval "setenv $argv[1]:s/=/ /"
|
||||
breaksw
|
||||
endsw
|
||||
shift
|
||||
end
|
||||
|
||||
|
||||
# Operating System/Platform
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -121,7 +121,10 @@ case OpenFOAM:
|
||||
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
|
||||
if ( $?mpc_version ) then
|
||||
set mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
|
||||
endif
|
||||
|
||||
|
||||
# Check that the compiler directory can be found
|
||||
if ( ! -d "$gccDir" ) then
|
||||
|
||||
Reference in New Issue
Block a user