mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
1. "foamCompiler" was changed to a more permanent "WM_COMPILER_TYPE"
environment variable, so that it can be used by 3rd party
installation scripts, such as "makeGcc", "makeLLVM" and so on. More
on this will be provided in issue #1215.
2. The script functions such as "_foamSource()" and "_foamAddPath()"
were moved to a new file "etc/config.sh/functions". It has the
ability to set or unset, depending on whether "WM_BASH_FUNCTIONS" is
defined or not. This allows for these functions to be reused by
other scripts, such as "makeGcc".
3. The script "etc/config.sh/CGAL" relies on whether a local
environment variable "SOURCE_CGAL_VERSIONS_ONLY" is defined or not,
so that it will load only the version settings if it's defined. This
is to make it easier to call this script from "makeCGAL". Although
it still feels a bit of a clunky hack, but I didn't manage to deduce
any other way we could do this :( I didn't add indentation within
the if-block, to make it easier to read the changes. In addition,
the local variable "common_path" is used to shorten the length of
the lines and use slightly less repeated code.
4. Added another new script "etc/config.sh/compiler", which has only
the version numbers for the compilers taken out from the "settings"
file. It currently depends on "WM_COMPILER_TYPE" for setting the
variables, the same way it did with "foamCompiler". This script is
now always sourced from the "settings" file, for the following
reasons:
- "makeGCC" and "makeLLVM" can now take advantage of this script file.
- The example "compiler" script (detailed next) can rely on this
script file and then override parameters on-demand, as well as
allowing for system compilers to have dedicated settings, such as
setting "WM_CC". This is similar to how the example environment
script for "paraview" works.
5. To the script "etc/config.sh/example/compiler" were added a few more examples:
- It now starts with a block where it first loads the default "compiler" script.
- Has a "WM_COMPILER=Gcc48u" case example for when we try to use GCC
4.8 in Ubuntu 15.10. This is just to give the idea that in a
particular system, we might have several system-wide compiler
versions. For example, in Ubuntu 15.10, there is GCC 4.7, 4.8 and
5.2, which could be used for testing performances or compatibility
with some other 3rd party library.
- Has the "WM_COMPILER=Icc" case example, related to the original bug
report, where "WM_CC=icc" and "WM_CXX=icpc", so that the user then
simply copies this file to their own local preferences folder.
6. Small bug fix in "etc/config.sh/mpi", where unsetting "minBufferSize" was missing at the end of the script.
7. Small change in "etc/config.sh/paraview", where "CMAKE_ROOT" is set
along with "CMAKE_HOME". This is due to a rare issue that occurs on
people's systems where they have a custom system-wide CMake version
installed and which is used by having "CMAKE_ROOT" set on that
environment. This can mess up OpenFOAM's custom ParaView builds,
given that conflicting CMake versions can lead to not building
ParaView at all.
- For more details about "CMAKE_ROOT":
https://cmake.org/Wiki/CMake_Useful_Variables [^]
8. The scripts "_foamAddPath _foamAddLib _foamAddMan" were not being
unset at the end of "settings". They are now unset at the end of
"bashrc", through a call to the new double-use "functions" script.
Additionally all references to "foamCompiler" have been changed to
"WM_COMPILER_TYPE".
See also http://www.openfoam.org/mantisbt/view.php?id=1232
290 lines
9.1 KiB
Bash
290 lines
9.1 KiB
Bash
#----------------------------------*-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/settings
|
|
#
|
|
# Description
|
|
# Startup file for OpenFOAM
|
|
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Set environment variables according to system type
|
|
export WM_ARCH=`uname -s`
|
|
|
|
case "$WM_ARCH" in
|
|
Linux)
|
|
WM_ARCH=linux
|
|
|
|
# Compiler specifics
|
|
case `uname -m` in
|
|
i686)
|
|
export WM_ARCH_OPTION=32
|
|
;;
|
|
|
|
x86_64)
|
|
case "$WM_ARCH_OPTION" in
|
|
32)
|
|
export WM_COMPILER_ARCH=64
|
|
export WM_CC='gcc'
|
|
export WM_CXX='g++'
|
|
export WM_CFLAGS='-m32 -fPIC'
|
|
export WM_CXXFLAGS='-m32 -fPIC -std=c++0x'
|
|
export WM_LDFLAGS='-m32'
|
|
;;
|
|
64)
|
|
WM_ARCH=linux64
|
|
export WM_COMPILER_LIB_ARCH=64
|
|
export WM_CC='gcc'
|
|
export WM_CXX='g++'
|
|
export WM_CFLAGS='-m64 -fPIC'
|
|
export WM_CXXFLAGS='-m64 -fPIC -std=c++0x'
|
|
export WM_LDFLAGS='-m64'
|
|
;;
|
|
*)
|
|
echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"\
|
|
1>&2
|
|
;;
|
|
esac
|
|
;;
|
|
|
|
ia64)
|
|
WM_ARCH=linuxIA64
|
|
export WM_COMPILER=I64
|
|
;;
|
|
|
|
armv7l)
|
|
WM_ARCH=linuxARM7
|
|
export WM_COMPILER_LIB_ARCH=32
|
|
export WM_CC='gcc'
|
|
export WM_CXX='g++'
|
|
export WM_CFLAGS='-fPIC'
|
|
export WM_CXXFLAGS='-fPIC -std=c++0x'
|
|
export WM_LDFLAGS=
|
|
;;
|
|
|
|
ppc64)
|
|
WM_ARCH=linuxPPC64
|
|
export WM_COMPILER_LIB_ARCH=64
|
|
export WM_CC='gcc'
|
|
export WM_CXX='g++'
|
|
export WM_CFLAGS='-m64 -fPIC'
|
|
export WM_CXXFLAGS='-m64 -fPIC -std=c++0x'
|
|
export WM_LDFLAGS='-m64'
|
|
;;
|
|
|
|
ppc64le)
|
|
WM_ARCH=linuxPPC64le
|
|
export WM_COMPILER_LIB_ARCH=64
|
|
export WM_CC='gcc'
|
|
export WM_CXX='g++'
|
|
export WM_CFLAGS='-m64 -fPIC'
|
|
export WM_CXXFLAGS='-m64 -fPIC -std=c++0x'
|
|
export WM_LDFLAGS='-m64'
|
|
;;
|
|
|
|
*)
|
|
echo Unknown processor type `uname -m` for Linux 1>&2
|
|
;;
|
|
esac
|
|
;;
|
|
|
|
SunOS)
|
|
WM_ARCH=SunOS64
|
|
WM_MPLIB=FJMPI
|
|
export WM_COMPILER_LIB_ARCH=64
|
|
export WM_CC='gcc'
|
|
export WM_CXX='g++'
|
|
export WM_CFLAGS='-mabi=64 -fPIC'
|
|
export WM_CXXFLAGS='-mabi=64 -fPIC -std=c++0x'
|
|
export WM_LDFLAGS='-mabi=64 -G0'
|
|
;;
|
|
|
|
*) # An unsupported operating system
|
|
/bin/cat <<USAGE 1>&2
|
|
|
|
Your "$WM_ARCH" operating system is not supported by this release
|
|
of OpenFOAM. For further assistance, please contact www.OpenFOAM.org
|
|
|
|
USAGE
|
|
;;
|
|
esac
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Location of the jobControl directory
|
|
export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
|
|
|
|
# wmake configuration
|
|
export WM_DIR=$WM_PROJECT_DIR/wmake
|
|
export WM_LINK_LANGUAGE=c++
|
|
export WM_LABEL_OPTION=Int$WM_LABEL_SIZE
|
|
export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION$WM_COMPILE_OPTION
|
|
|
|
# Base executables/libraries
|
|
export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
|
|
export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
|
|
|
|
# External (ThirdParty) libraries
|
|
export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
|
|
|
|
# Site-specific directory
|
|
siteDir="${WM_PROJECT_SITE:-$WM_PROJECT_INST_DIR/site}"
|
|
|
|
# Shared site executables/libraries
|
|
# Similar naming convention as ~OpenFOAM expansion
|
|
export FOAM_SITE_APPBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
|
|
export FOAM_SITE_LIBBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
|
|
|
|
# User executables/libraries
|
|
export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
|
|
export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
|
|
|
|
# DynamicCode templates
|
|
# - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
|
|
# export FOAM_CODE_TEMPLATES=$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
|
|
|
|
# Convenience
|
|
export FOAM_ETC=$WM_PROJECT_DIR/etc
|
|
export FOAM_APP=$WM_PROJECT_DIR/applications
|
|
export FOAM_SRC=$WM_PROJECT_DIR/src
|
|
export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
|
|
export FOAM_UTILITIES=$FOAM_APP/utilities
|
|
export FOAM_SOLVERS=$FOAM_APP/solvers
|
|
export FOAM_RUN=$WM_PROJECT_USER_DIR/run
|
|
|
|
# Add wmake to the path - not required for runtime-only environment
|
|
[ -d "$WM_DIR" ] && PATH=$WM_DIR:$PATH
|
|
# Add OpenFOAM scripts to the path
|
|
export PATH=$WM_PROJECT_DIR/bin:$PATH
|
|
|
|
# Add site-specific scripts to path - only if they exist
|
|
if [ -d "$siteDir/bin" ] # Generic
|
|
then
|
|
_foamAddPath "$siteDir/bin"
|
|
fi
|
|
if [ -d "$siteDir/$WM_PROJECT_VERSION/bin" ] # Version-specific
|
|
then
|
|
_foamAddPath "$siteDir/$WM_PROJECT_VERSION/bin"
|
|
fi
|
|
unset siteDir
|
|
|
|
_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
|
|
# ~~~~~~~~~~~~~~~~~
|
|
unset gcc_version gmp_version mpfr_version mpc_version
|
|
unset MPFR_ARCH_PATH GMP_ARCH_PATH
|
|
|
|
# Location of compiler installation
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
if [ -z "$WM_COMPILER_TYPE" ]
|
|
then
|
|
WM_COMPILER_TYPE=system
|
|
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
|
|
echo " WM_COMPILER_TYPE not set, using '$WM_COMPILER_TYPE'" 1>&2
|
|
fi
|
|
|
|
# Load configured compiler versions, regardless of the compiler type
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler`
|
|
|
|
case "$WM_COMPILER_TYPE" in
|
|
OpenFOAM | 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
|
|
mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
|
|
mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
|
|
|
|
# Check that the compiler directory can be found
|
|
[ -d "$gccDir" ] || {
|
|
echo 1>&2
|
|
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
|
|
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 'WM_COMPILER_TYPE' setting to 'system'" 1>&2
|
|
echo
|
|
}
|
|
|
|
_foamAddMan $gccDir/man
|
|
_foamAddPath $gccDir/bin
|
|
|
|
# Add compiler libraries to run-time environment
|
|
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
|
|
|
|
# Add gmp/mpfr libraries to run-time environment
|
|
_foamAddLib $gmpDir/lib
|
|
_foamAddLib $mpfrDir/lib
|
|
|
|
# Add mpc libraries (not need for older gcc) to run-time environment
|
|
if [ -n "$mpc_version" ]
|
|
then
|
|
_foamAddLib $mpcDir/lib
|
|
fi
|
|
|
|
# Used by boost/CGAL:
|
|
export MPFR_ARCH_PATH=$mpfrDir
|
|
export GMP_ARCH_PATH=$gmpDir
|
|
fi
|
|
unset gcc_version gccDir
|
|
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
|
|
|
|
if [ -n "$clang_version" ]
|
|
then
|
|
clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
|
|
|
|
# Check that the compiler directory can be found
|
|
[ -d "$clangDir" ] || {
|
|
echo 1>&2
|
|
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
|
|
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 'WM_COMPILER_TYPE' setting to 'system'" 1>&2
|
|
echo 1>&2
|
|
}
|
|
|
|
_foamAddMan $clangDir/share/man
|
|
_foamAddPath $clangDir/bin
|
|
fi
|
|
unset clang_version clangDir
|
|
;;
|
|
system)
|
|
# Use system compiler
|
|
;;
|
|
*)
|
|
echo "Warn: WM_COMPILER_TYPE='$WM_COMPILER_TYPE' is unsupported" 1>&2
|
|
echo " treating as 'system' instead" 1>&2
|
|
;;
|
|
esac
|
|
|
|
#------------------------------------------------------------------------------
|