ENH: support use of system gmp/mpfr/mpc with ThirdParty gcc

- not previously possible to configure a third-party gcc
  with system gmp/mpfr/mpc.
  This makes it easier to switch between compilers for testing.

- use system libraries by default
This commit is contained in:
Mark Olesen 2016-06-16 16:49:28 +02:00
parent 62f634c014
commit bbf20318e0
3 changed files with 52 additions and 28 deletions

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -202,7 +202,7 @@ _foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_EXT_L
# Compiler settings
# ~~~~~~~~~~~~~~~~~
unset gcc_version gmp_version mpfr_version mpc_version
unsetenv MPFR_ARCH_PATH GMP_ARCH_PATH
unsetenv GMP_ARCH_PATH MPFR_ARCH_PATH
# Location of compiler installation
@ -217,9 +217,9 @@ switch ("$WM_COMPILER_TYPE")
case OpenFOAM:
case ThirdParty:
# Default versions of GMP, MPFR and MPC, overide as necessary
set gmp_version=gmp-6.0.1
set mpfr_version=mpfr-3.1.4
set mpc_version=mpc-1.0.3
set gmp_version=gmp-system
set mpfr_version=mpfr-system
set mpc_version=mpc-system
switch ("$WM_COMPILER")
case Gcc:
case Gcc48:
@ -291,17 +291,28 @@ case ThirdParty:
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
# Add compiler libraries to run-time environment
# Add ThirdParty compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# Add gmp/mpfr/mpc libraries to run-time environment
_foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $mpcDir/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
endif
if ( "${mpfrDir:t}" != "mpfr-system" ) then
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
endif
if ( "${mpcDir:t}" != "mpc-system" ) then
_foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
endif
# Used by boost/CGAL:
setenv MPFR_ARCH_PATH $mpfrDir
setenv GMP_ARCH_PATH $gmpDir
setenv MPFR_ARCH_PATH $mpfrDir
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using ThirdParty compiler"
echo " ${gccDir:t} (${gmpDir:t} ${mpfrDir:t} ${mpcDir:t})"
endif
endif
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
@ -324,7 +335,6 @@ case ThirdParty:
_foamAddPath $clangDir/bin
endif
unset clang_version clangDir
breaksw
case system:

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -32,11 +32,10 @@
case "$WM_COMPILER_TYPE" in
OpenFOAM | ThirdParty)
# Default versions of GMP, MPFR and MPC, override as necessary
gmp_version=gmp-6.0.1
mpfr_version=mpfr-3.1.4
mpc_version=mpc-1.0.3
gmp_version=gmp-system
mpfr_version=mpfr-system
mpc_version=mpc-system
case "$WM_COMPILER" in
Gcc | Gcc48)

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
@ -198,7 +198,7 @@ _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$
# Compiler settings
# ~~~~~~~~~~~~~~~~~
unset gcc_version gmp_version mpfr_version mpc_version
unset MPFR_ARCH_PATH GMP_ARCH_PATH
unset GMP_ARCH_PATH MPFR_ARCH_PATH
# Location of compiler installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -219,9 +219,9 @@ 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
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" ] || {
@ -237,17 +237,32 @@ OpenFOAM | ThirdParty)
_foamAddMan $gccDir/man
_foamAddPath $gccDir/bin
# Add compiler libraries to run-time environment
# Add ThirdParty compiler libraries to run-time environment
_foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
# Add gmp/mpfr/mpc libraries to run-time environment
_foamAddLib $gmpDir/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $mpcDir/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
fi
if [ "${mpfrDir##*-}" != system ]
then
_foamAddLib $mpfrDir/lib$WM_COMPILER_LIB_ARCH
fi
if [ "${mpcDir##*-}" != system ]
then
_foamAddLib $mpcDir/lib$WM_COMPILER_LIB_ARCH
fi
# Used by boost/CGAL:
export MPFR_ARCH_PATH=$mpfrDir
export GMP_ARCH_PATH=$gmpDir
export MPFR_ARCH_PATH=$mpfrDir
if [ "$FOAM_VERBOSE" -a "$PS1" ]
then
echo "Using ThirdParty compiler"
echo " ${gccDir##*/} (${gmpDir##*/} $${mpfrDir##*/} ${mpcDir##*/})"
fi
fi
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir