mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support -gcc option for foamConfigurePaths
- simplifies things for legacyCompile
This commit is contained in:
@ -4,7 +4,7 @@
|
|||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
# \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||||
@ -22,7 +22,9 @@ usage() {
|
|||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
cat<<USAGE
|
cat<<USAGE
|
||||||
|
|
||||||
usage: ${0##*/}
|
usage: ${0##*/} options
|
||||||
|
|
||||||
|
Basic
|
||||||
-foamInstall DIR specify installation directory (eg, /opt)
|
-foamInstall DIR specify installation directory (eg, /opt)
|
||||||
-foamVersion VER specify project version (eg, 1612)
|
-foamVersion VER specify project version (eg, 1612)
|
||||||
-projectName NAME specify project directory name (eg, openfoam1612)
|
-projectName NAME specify project directory name (eg, openfoam1612)
|
||||||
@ -30,13 +32,27 @@ usage: ${0##*/}
|
|||||||
-SP | -float32 specify 'WM_PRECISION_OPTION'
|
-SP | -float32 specify 'WM_PRECISION_OPTION'
|
||||||
-DP | -float64 specify 'WM_PRECISION_OPTION'
|
-DP | -float64 specify 'WM_PRECISION_OPTION'
|
||||||
-int32 | -int64 specify 'WM_LABEL_SIZE'
|
-int32 | -int64 specify 'WM_LABEL_SIZE'
|
||||||
|
|
||||||
|
Compiler
|
||||||
-system NAME specify 'system' compiler to use (eg, Gcc, Icc,...)
|
-system NAME specify 'system' compiler to use (eg, Gcc, Icc,...)
|
||||||
-third NAME specify 'ThirdParty' compiler to use (eg, Clang40,...)
|
-third NAME specify 'ThirdParty' compiler to use (eg, Clang40,...)
|
||||||
|
-gcc VER specify 'gcc_version' for ThirdParty Gcc
|
||||||
|
-clang VER specify 'clang_version' for ThirdParty Clang
|
||||||
|
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
|
||||||
|
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
|
||||||
|
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
|
||||||
|
|
||||||
|
MPI
|
||||||
|
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc)
|
||||||
|
-openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI'
|
||||||
|
-openmpi-system use system openmpi
|
||||||
|
-openmpi-third use ThirdParty openmpi (using default version)
|
||||||
|
|
||||||
|
Components
|
||||||
-boost VER specify 'boost_version'
|
-boost VER specify 'boost_version'
|
||||||
-boost-path DIR specify 'BOOST_ARCH_PATH'
|
-boost-path DIR specify 'BOOST_ARCH_PATH'
|
||||||
-cgal ver specify 'cgal_version'
|
-cgal ver specify 'cgal_version'
|
||||||
-cgal-path DIR specify 'CGAL_ARCH_PATH'
|
-cgal-path DIR specify 'CGAL_ARCH_PATH'
|
||||||
-clang VER specify 'clang_version' for ThirdParty Clang
|
|
||||||
-cmake VER specify 'cmake_version'
|
-cmake VER specify 'cmake_version'
|
||||||
-fftw VER specify 'fffw_version'
|
-fftw VER specify 'fffw_version'
|
||||||
-fftw-path DIR specify 'FFTW_ARCH_PATH'
|
-fftw-path DIR specify 'FFTW_ARCH_PATH'
|
||||||
@ -44,20 +60,17 @@ usage: ${0##*/}
|
|||||||
-kahip-path DIR specify 'KAHIP_ARCH_PATH'
|
-kahip-path DIR specify 'KAHIP_ARCH_PATH'
|
||||||
-metis ver specify 'METIS_VERSION'
|
-metis ver specify 'METIS_VERSION'
|
||||||
-metis-path DIR specify 'METIS_ARCH_PATH'
|
-metis-path DIR specify 'METIS_ARCH_PATH'
|
||||||
|
|
||||||
|
Graphics
|
||||||
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1)
|
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1)
|
||||||
-paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1)
|
-paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1)
|
||||||
-mpi NAME specify 'WM_MPLIB' type (eg, FJMPI, INTELMPI, etc)
|
|
||||||
-openmpi VER specify ThirdParty openmpi version for 'FOAM_MPI'
|
|
||||||
-openmpi-system activate system openmpi
|
|
||||||
-openmpi-third activate ThirdParty openmpi (using default version)
|
|
||||||
-scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4)
|
-scotch VER specify 'SCOTCH_VERSION' (eg, scotch_6.0.4)
|
||||||
-scotch-path DIR specify 'SCOTCH_ARCH_PATH' (eg, /opt/OpenFOAM-scotch_6.0.4)
|
-scotch-path DIR specify 'SCOTCH_ARCH_PATH' (eg, /opt/OpenFOAM-scotch_6.0.4)
|
||||||
-vtk VER specify 'vtk_version' (eg, VTK-7.1.0)
|
-vtk VER specify 'vtk_version' (eg, VTK-7.1.0)
|
||||||
-mesa VER specify 'mesa_version' (eg, mesa-13.0.1)
|
-mesa VER specify 'mesa_version' (eg, mesa-13.0.1)
|
||||||
|
|
||||||
|
Misc
|
||||||
-sigfpe | -no-sigfpe [defunct - now under etc/controlDict]
|
-sigfpe | -no-sigfpe [defunct - now under etc/controlDict]
|
||||||
gmp-VERSION for ThirdParty gcc (gmp-system for system library)
|
|
||||||
mpfr-VERSION for ThirdParty gcc (mpfr-system for system library)
|
|
||||||
mpc-VERSION for ThirdParty gcc (mpc-system for system library)
|
|
||||||
|
|
||||||
* Adjust hardcoded versions and installation paths (for bash, POSIX shell).
|
* Adjust hardcoded versions and installation paths (for bash, POSIX shell).
|
||||||
|
|
||||||
@ -76,11 +89,6 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that it appears to be an OpenFOAM installation
|
|
||||||
[ -f etc/bashrc -a -d etc/config.sh ] || \
|
|
||||||
usage "Please run from top-level directory of installation"
|
|
||||||
|
|
||||||
|
|
||||||
# Report error and exit
|
# Report error and exit
|
||||||
die()
|
die()
|
||||||
{
|
{
|
||||||
@ -94,6 +102,12 @@ die()
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Check that it appears to be an OpenFOAM installation
|
||||||
|
[ -f etc/bashrc -a -d etc/config.sh ] || \
|
||||||
|
usage "Please run from top-level directory of installation"
|
||||||
|
|
||||||
|
|
||||||
# Check if argument matches the expected input. Respects case.
|
# Check if argument matches the expected input. Respects case.
|
||||||
# Uses sed for consistency with the replacement routines.
|
# Uses sed for consistency with the replacement routines.
|
||||||
@ -178,6 +192,8 @@ do
|
|||||||
# Discard empty arguments
|
# Discard empty arguments
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
## Basic ##
|
||||||
|
|
||||||
-foamInstall | --foamInstall)
|
-foamInstall | --foamInstall)
|
||||||
# Replace FOAM_INST_DIR=...
|
# Replace FOAM_INST_DIR=...
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
@ -260,6 +276,25 @@ do
|
|||||||
adjusted=true
|
adjusted=true
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
## Compiler ##
|
||||||
|
|
||||||
|
-clang)
|
||||||
|
# Replace clang_version=...
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
replace etc/config.sh/compiler clang_version "$2"
|
||||||
|
adjusted=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-gcc)
|
||||||
|
# Replace gcc_version=...
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
replace etc/config.sh/compiler gcc_version "$2"
|
||||||
|
adjusted=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
-system)
|
-system)
|
||||||
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
@ -276,6 +311,71 @@ do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
gmp-[4-9]* | gmp-system)
|
||||||
|
# gcc-related package
|
||||||
|
replace etc/config.sh/compiler gmp_version "$1"
|
||||||
|
adjusted=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
mpfr-[2-9]* | mpfr-system)
|
||||||
|
# gcc-related package
|
||||||
|
replace etc/config.sh/compiler mpfr_version "$1"
|
||||||
|
adjusted=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
mpc-[0-9]* | mpc-system)
|
||||||
|
# gcc-related package
|
||||||
|
replace etc/config.sh/compiler mpc_version "$1"
|
||||||
|
adjusted=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
## MPI ##
|
||||||
|
|
||||||
|
-mpi)
|
||||||
|
# Explicitly set WM_MPLIB=...
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
replace etc/bashrc WM_MPLIB "$2"
|
||||||
|
optMpi=system
|
||||||
|
adjusted=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-openmpi)
|
||||||
|
# Replace FOAM_MPI=openmpi-<digits>.. and set to use third-party
|
||||||
|
# The edit is slightly fragile, but works
|
||||||
|
expected="openmpi-[1-9][.0-9]*"
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
optMpi="$2"
|
||||||
|
_matches "$optMpi" "$expected" || die "'$1' option has bad value: '$optMpi'"
|
||||||
|
|
||||||
|
_inlineSed etc/config.sh/mpi \
|
||||||
|
"FOAM_MPI=$expected" \
|
||||||
|
"FOAM_MPI=$optMpi" \
|
||||||
|
"Replaced 'FOAM_MPI=$expected' setting by 'FOAM_MPI=$optMpi'"
|
||||||
|
|
||||||
|
replace etc/bashrc WM_MPLIB OPENMPI
|
||||||
|
adjusted=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-openmpi-system)
|
||||||
|
# Explicitly set WM_MPLIB=SYSTEMOPENMPI
|
||||||
|
replace etc/bashrc WM_MPLIB SYSTEMOPENMPI
|
||||||
|
optMpi=system
|
||||||
|
adjusted=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
-openmpi-third)
|
||||||
|
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi
|
||||||
|
replace etc/bashrc WM_MPLIB OPENMPI
|
||||||
|
optMpi=third
|
||||||
|
adjusted=true
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
## Components ##
|
||||||
|
|
||||||
-boost)
|
-boost)
|
||||||
# Replace boost_version=...
|
# Replace boost_version=...
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
@ -324,14 +424,6 @@ do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-clang)
|
|
||||||
# Replace clang_version=...
|
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
||||||
replace etc/config.sh/compiler clang_version "$2"
|
|
||||||
adjusted=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-cmake)
|
-cmake)
|
||||||
# Replace cmake_version=...
|
# Replace cmake_version=...
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
@ -340,66 +432,6 @@ do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-mpi)
|
|
||||||
# Explicitly set WM_MPLIB=...
|
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
||||||
replace etc/bashrc WM_MPLIB "$2"
|
|
||||||
optMpi=system
|
|
||||||
adjusted=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-openmpi)
|
|
||||||
# Replace FOAM_MPI=openmpi-<digits>.. and set to use third-party
|
|
||||||
# The edit is slightly fragile, but works
|
|
||||||
expected="openmpi-[1-9][.0-9]*"
|
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
||||||
optMpi="$2"
|
|
||||||
_matches "$optMpi" "$expected" || die "'$1' option has bad value: '$optMpi'"
|
|
||||||
|
|
||||||
_inlineSed etc/config.sh/mpi \
|
|
||||||
"FOAM_MPI=$expected" \
|
|
||||||
"FOAM_MPI=$optMpi" \
|
|
||||||
"Replaced 'FOAM_MPI=$expected' setting by 'FOAM_MPI=$optMpi'"
|
|
||||||
|
|
||||||
replace etc/bashrc WM_MPLIB OPENMPI
|
|
||||||
adjusted=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-openmpi-system)
|
|
||||||
# Explicitly set WM_MPLIB=SYSTEMOPENMPI
|
|
||||||
replace etc/bashrc WM_MPLIB SYSTEMOPENMPI
|
|
||||||
optMpi=system
|
|
||||||
adjusted=true
|
|
||||||
;;
|
|
||||||
|
|
||||||
-openmpi-third)
|
|
||||||
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi
|
|
||||||
replace etc/bashrc WM_MPLIB OPENMPI
|
|
||||||
optMpi=third
|
|
||||||
adjusted=true
|
|
||||||
;;
|
|
||||||
|
|
||||||
-paraview | -paraviewVersion | --paraviewVersion)
|
|
||||||
# Replace ParaView_VERSION=...
|
|
||||||
expected="[5-9][.0-9]*"
|
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
||||||
_matches "$2" "$expected" || die "'$1' option has bad value: '$2'"
|
|
||||||
|
|
||||||
replace etc/config.sh/paraview ParaView_VERSION "$2"
|
|
||||||
adjusted=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-paraview-path | -paraviewInstall | --paraviewInstall)
|
|
||||||
# Replace ParaView_DIR=...
|
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
||||||
replace etc/config.sh/paraview ParaView_DIR "$2"
|
|
||||||
adjusted=true
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-kahip)
|
-kahip)
|
||||||
# Replace KAHIP_VERSION=...
|
# Replace KAHIP_VERSION=...
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
@ -448,6 +480,28 @@ do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
## Graphics ##
|
||||||
|
|
||||||
|
-paraview | -paraviewVersion | --paraviewVersion)
|
||||||
|
# Replace ParaView_VERSION=...
|
||||||
|
expected="[5-9][.0-9]*"
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
_matches "$2" "$expected" || die "'$1' option has bad value: '$2'"
|
||||||
|
|
||||||
|
replace etc/config.sh/paraview ParaView_VERSION "$2"
|
||||||
|
adjusted=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-paraview-path | -paraviewInstall | --paraviewInstall)
|
||||||
|
# Replace ParaView_DIR=...
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
replace etc/config.sh/paraview ParaView_DIR "$2"
|
||||||
|
adjusted=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
-vtk)
|
-vtk)
|
||||||
# Replace vtk_version=...
|
# Replace vtk_version=...
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
@ -464,23 +518,8 @@ do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gmp-[4-9]* | gmp-system)
|
|
||||||
# gcc-related package
|
|
||||||
replace etc/config.sh/compiler gmp_version "$1"
|
|
||||||
adjusted=true
|
|
||||||
;;
|
|
||||||
|
|
||||||
mpfr-[2-9]* | mpfr-system)
|
## Misc ##
|
||||||
# gcc-related package
|
|
||||||
replace etc/config.sh/compiler mpfr_version "$1"
|
|
||||||
adjusted=true
|
|
||||||
;;
|
|
||||||
|
|
||||||
mpc-[0-9]* | mpc-system)
|
|
||||||
# gcc-related package
|
|
||||||
replace etc/config.sh/compiler mpc_version "$1"
|
|
||||||
adjusted=true
|
|
||||||
;;
|
|
||||||
|
|
||||||
-sigfpe | -no-sigfpe)
|
-sigfpe | -no-sigfpe)
|
||||||
echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2
|
echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2
|
||||||
|
|||||||
@ -231,7 +231,7 @@ case Arm*: # Arm system compilers
|
|||||||
endsw
|
endsw
|
||||||
|
|
||||||
# Clear prior to sourcing
|
# Clear prior to sourcing
|
||||||
unset gcc_version gmp_version mpfr_version mpc_version
|
unset gcc_version gmp_version mpfr_version mpc_version clang_version
|
||||||
unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
|
unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
|
||||||
|
|
||||||
# Load pre-defined compiler versions
|
# Load pre-defined compiler versions
|
||||||
|
|||||||
@ -228,7 +228,7 @@ Arm*) # Arm system compilers
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Clear prior to sourcing
|
# Clear prior to sourcing
|
||||||
unset gcc_version gmp_version mpfr_version mpc_version
|
unset gcc_version gmp_version mpfr_version mpc_version clang_version
|
||||||
unset GMP_ARCH_PATH MPFR_ARCH_PATH
|
unset GMP_ARCH_PATH MPFR_ARCH_PATH
|
||||||
|
|
||||||
# Load pre-defined compiler versions
|
# Load pre-defined compiler versions
|
||||||
|
|||||||
Reference in New Issue
Block a user