Commit b66ec91d authored by mark's avatar mark
Browse files

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.
parent 5d63dd1b
......@@ -61,6 +61,19 @@ then
fi
# Test if it matches "*-none"
_foamIsNone()
{
test "${1##*-}" = none
}
# Test if it matches "*-system"
_foamIsSystem()
{
test "${1##*-}" = system
}
#
# Download file $1 from url $2 into download/ directory
#
......
......@@ -59,15 +59,17 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
}
. etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
Script="${0##*/}"
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION]
usage: $Script [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERSION]
options:
-gcc force g++ instead of the value from \$WM_CXX
-system use system versions for boost/gmp/mpfr
-help
* build CGAL with
......@@ -77,9 +79,9 @@ options:
$mpfrPACKAGE
Normally builds against ThirdParty boost and gmp/mpfr when possible.
To override this behaviour (and use the system boost and/o gmp/mpfr),
To override this behaviour (and use the system boost and/or gmp/mpfr),
simply specify a 'system' version. For example,
${0##*/} boost-system gmp-system
$Script boost-system gmp-system
Note: mixing system and ThirdParty for gmp/mpfr is not supported.
......@@ -106,11 +108,17 @@ do
export CXX=g++ # use g++
shift
;;
gmp-[4-9]* | gmp-sys*)
-sys*)
gmpPACKAGE="gmp-system"
mpfrPACKAGE="mpfr-system"
boostPACKAGE="boost-system"
shift
;;
gmp-[4-9]* | gmp-system)
gmpPACKAGE="${1%%/}"
shift
;;
mpfr-[2-9]* | mpfr-sys*)
mpfr-[2-9]* | mpfr-system)
mpfrPACKAGE="${1%%/}"
shift
;;
......@@ -118,7 +126,7 @@ do
cgalPACKAGE="${1%%/}"
shift
;;
boost-[0-9]* | boost_[0-9]* | boost-sys* )
boost-[0-9]* | boost_[0-9]* | boost-system )
boostPACKAGE="${1%%/}"
shift
;;
......@@ -146,12 +154,27 @@ if [ -d "$BOOST_ARCH_PATH" ]
then
boostInc="$BOOST_ARCH_PATH/include"
boostLib="$BOOST_ARCH_PATH/lib"
elif [ -d "$BOOST_SOURCE_DIR" ]
elif _foamIsSystem $BOOST_ARCH_PATH
then
echo "Using boost-system"
boostInc="/usr/include"
# For completeness:
# 64-bit needs lib64, but 32-bit needs lib (not lib32)
if [ "$WM_ARCH_OPTION" = 64 ]
then
boostLib="/usr/lib$WM_ARCH_OPTION"
else
boostLib="/usr/lib"
fi
else
echo "Starting build: boost"
echo
boostInc="$BOOST_ARCH_PATH/include"
boostLib="$BOOST_ARCH_PATH/lib"
echo "Starting build: boost"
(
cd $BOOST_SOURCE_DIR || exit 1
......@@ -167,17 +190,13 @@ then
echo "Error building: boost"
exit 1
}
else
boostInc="/usr/include"
fi
# For completeness:
# 64-bit needs lib64, but 32-bit needs lib (not lib32)
if [ "$WM_ARCH_OPTION" = 64 ]
then
boostLib="/usr/lib$WM_ARCH_OPTION"
else
boostLib="/usr/lib"
fi
# nothing to build
if _foamIsSystem "$cgalPACKAGE"
then
echo "Using CGAL-system"
exit 0
fi
# nothing left to build
......@@ -242,7 +261,7 @@ MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
cd $CGAL_BINARY_DIR || exit 1
unset configBoost configGmpMpfr
unset configBoost configGmp configMpfr
echo "----"
echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION_NO"
echo " Source : $CGAL_SOURCE_DIR"
......@@ -271,22 +290,32 @@ CMAKE_OPTIONS
)
fi
if [ -d "$GMP_ARCH_PATH" -a -d "$MPFR_ARCH_PATH" ]
if [ -d "$GMP_ARCH_PATH" ]
then
echo " ThirdParty : gmp/mpfr"
configGmpMpfr=$(cat <<CMAKE_OPTIONS
echo " ThirdParty : gmp"
configGmp=$(cat <<CMAKE_OPTIONS
-DGMP_INCLUDE_DIR=$GMP_ARCH_PATH/include
-DGMP_LIBRARIES_DIR=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
-DGMP_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmp.so
-DGMPXX_INCLUDE_DIR=$GMP_ARCH_PATH/include
-DGMPXX_LIBRARIES=$GMP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libgmpxx.so
CMAKE_OPTIONS
)
else
echo " system : gmp"
fi
if [ -d "$MPFR_ARCH_PATH" ]
then
echo " ThirdParty : mpfr"
configMpfr=$(cat <<CMAKE_OPTIONS
-DMPFR_INCLUDE_DIR=$MPFR_ARCH_PATH/include
-DMPFR_LIBRARIES_DIR=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
-DMPFR_LIBRARIES=$MPFR_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmpfr.so
CMAKE_OPTIONS
)
else
echo " system : gmp/mpfr"
echo " system : mpfr"
fi
echo "----"
......@@ -295,7 +324,7 @@ CMAKE_OPTIONS
-DCMAKE_INSTALL_PREFIX=$CGAL_ARCH_PATH \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_CGAL_Qt5=OFF \
$configBoost $configGmpMpfr \
$configBoost $configGmp $configMpfr \
$CGAL_SOURCE_DIR \
&& make -j $WM_NCOMPPROCS \
&& make install || exit 1
......
......@@ -28,6 +28,10 @@
# Description
# Build script gcc and gmp, mpfr, mpc.
#
# Normally builds against ThirdParty gmp/mpfr when possible.
# To override this behaviour (and use the system gmp/mpfr/mpc),
# simply specify a 'system' version. For example,
# makeGcc gmp-system
#
#------------------------------------------------------------------------------
# get default GCC, mpfr, gmp and mpc versions
......@@ -62,6 +66,7 @@ usage() {
usage: $Script [OPTION] [gcc-VERSION] [gmp-VERSION] [mpfr-VERSION] [mpc-VERSION]
options:
-no-multilib for 64-bit systems without 32-bit support
-system use system versions for gmp/mpfr/mpc
-help
* build combinations of gmp, mpfr, mpc and gcc
......@@ -88,15 +93,21 @@ do
GCC_BUILD_OPTIONS="--disable-multilib"
shift
;;
gmp-[4-9]*)
-sys*)
gmpPACKAGE="gmp-system"
mpfrPACKAGE="mpfr-system"
mpcPACKAGE="mpc-system"
shift
;;
gmp-[4-9]* | gmp-system)
gmpPACKAGE="${1%%/}"
shift
;;
mpfr-[2-9]*)
mpfr-[2-9]* | mpfr-system)
mpfrPACKAGE="${1%%/}"
shift
;;
mpc-[0-9]*)
mpc-[0-9]* | mpc-system)
mpcPACKAGE="${1%%/}"
shift
;;
......@@ -116,6 +127,15 @@ then
exit 1
fi
cat<<SUMMARY
GCC configuration
------------------
GCC = $gccPACKAGE
GMP = $gmpPACKAGE
MPFR = $mpfrPACKAGE
MPC = $mpcPACKAGE
------------------
SUMMARY
# Set 32 or 64 bit ABI
case "$WM_ARCH_OPTION" in
......@@ -138,6 +158,7 @@ GMP_ARCH_PATH=$installBASE/$gmpPACKAGE
MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
MPC_ARCH_PATH=$installBASE/$mpcPACKAGE
# ================
# Build GMP
# ================
......@@ -145,6 +166,9 @@ echo "---------------"
if [ -d $GMP_ARCH_PATH ]
then
echo "Already built: $gmpPACKAGE"
elif _foamIsSystem $GMP_ARCH_PATH
then
echo "Using gmp-system"
else
echo "Starting build: $gmpPACKAGE"
echo
......@@ -186,6 +210,9 @@ echo "---------------"
if [ -d $MPFR_ARCH_PATH ]
then
echo "Already built: $mpfrPACKAGE"
elif _foamIsSystem $MPFR_ARCH_PATH
then
echo "Using mpfr-system"
else
echo "Starting build: $mpfrPACKAGE"
echo
......@@ -228,6 +255,9 @@ echo "---------------"
if [ -d $MPC_ARCH_PATH ]
then
echo "Already built: $mpcPACKAGE"
elif _foamIsSystem $MPC_ARCH_PATH
then
echo "Using mpc-system"
else
echo "Starting build: $mpcPACKAGE"
echo
......@@ -290,6 +320,10 @@ else
mkdir -p $buildDIR
cd $buildDIR
_foamIsSystem "$GMP_ARCH_PATH" && GMP_ARCH_PATH=/usr # revert to system
_foamIsSystem "$MPFR_ARCH_PATH" && MPFR_ARCH_PATH=/usr # revert to system
_foamIsSystem "$MPC_ARCH_PATH" && MPC_ARCH_PATH=/usr # revert to system
set -x
$sourceDIR/configure \
--prefix=$GCC_ARCH_PATH \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment