Commit 67093bfb authored by Mark Olesen's avatar Mark Olesen

CONFIG: add -with-lib options for makeCGAL

- if not otherwise specified:
  - OpenFOAM-v1912 and older are implicitly `-with-lib`
  - new versions are implicitly `-no-lib`
parent 9de516d3
...@@ -7,11 +7,10 @@ ...@@ -7,11 +7,10 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2012-2016 OpenFOAM Foundation # Copyright (C) 2012-2016 OpenFOAM Foundation
# Copyright (C) 2016-2019 OpenCFD Ltd. # Copyright (C) 2016-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# makeCGAL # makeCGAL
...@@ -35,8 +34,8 @@ ...@@ -35,8 +34,8 @@
if [ "$1" = "-test" ] if [ "$1" = "-test" ]
then then
[ "$#" -eq 3 ] || { echo "${0##*/} -test : needs 2 argument"; exit 1; } [ "$#" -eq 3 ] || { echo "${0##*/} -test : needs 2 argument"; exit 1; }
dir="${2%/}" # <- CGAL_ARCH_PATH dir="${2%/}" # <- *_ARCH_PATH
if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL$EXT_SO" ] if [ -d "$dir/include" ] && [ -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL$EXT_SO" ]
then then
echo " CGAL include: $dir/include" echo " CGAL include: $dir/include"
echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH" echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH"
...@@ -44,8 +43,8 @@ then ...@@ -44,8 +43,8 @@ then
dir="${3%/}" # <- BOOST_ARCH_PATH dir="${3%/}" # <- BOOST_ARCH_PATH
for root in "$dir" /usr for root in "$dir" /usr
do do
if [ -d "$root/include/boost" \ if [ -d "$root/include/boost" ] \
-a -r "$root/lib$WM_COMPILER_LIB_ARCH/libboost_system$EXT_SO" ] && [ -r "$root/lib$WM_COMPILER_LIB_ARCH/libboost_system$EXT_SO" ]
then then
echo " boost include: $root/include" echo " boost include: $root/include"
echo " boost library: $root/lib$WM_COMPILER_LIB_ARCH" echo " boost library: $root/lib$WM_COMPILER_LIB_ARCH"
...@@ -89,7 +88,8 @@ usage: ${0##*/} [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERS ...@@ -89,7 +88,8 @@ usage: ${0##*/} [OPTION] [CGAL-VERSION] [boost-VERSION] [gmp-VERSION] [mpfr-VERS
options: options:
-gcc Force use of gcc/g++ -gcc Force use of gcc/g++
-cmake PATH Use cmake from the given path -cmake PATH Use cmake from the given path
-no-lib Compile CGAL for use in headers only mode (since CGAL 4.9) -no-lib Configure CGAL for headers-only mode (since CGAL 4.9)
-with-lib Configure CGAL with library
-toolset=NAME Use named toolset in bootstrap -toolset=NAME Use named toolset in bootstrap
-system Use system versions for boost/gmp/mpfr -system Use system versions for boost/gmp/mpfr
-help -help
...@@ -114,6 +114,7 @@ USAGE ...@@ -114,6 +114,7 @@ USAGE
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optHeadersOnly optToolset unset optHeadersOnly optToolset
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
...@@ -139,6 +140,9 @@ do ...@@ -139,6 +140,9 @@ do
-no-lib) -no-lib)
optHeadersOnly=true optHeadersOnly=true
;; ;;
-with-lib)
optHeadersOnly=false
;;
gmp-[4-9]* | gmp-system | gmp-none) gmp-[4-9]* | gmp-system | gmp-none)
gmpPACKAGE="${1%%/}" gmpPACKAGE="${1%%/}"
unset GMP_ARCH_PATH unset GMP_ARCH_PATH
...@@ -165,17 +169,36 @@ done ...@@ -165,17 +169,36 @@ done
[ -n "$cgalPACKAGE" ] || die "The cgal-VERSION was not specified" [ -n "$cgalPACKAGE" ] || die "The cgal-VERSION was not specified"
# Nothing to build # Nothing to build
if _foamIsNone $boostPACKAGE if _foamIsNone "$boostPACKAGE"
then then
echo "Using boost-none (skip ThirdParty build of BOOST/CGAL)" echo "Using boost-none (skip ThirdParty build of BOOST/CGAL)"
exit 0 exit 0
fi fi
if _foamIsNone $cgalPACKAGE if _foamIsNone "$cgalPACKAGE"
then then
echo "Using cgal-none (skip ThirdParty build of CGAL)" echo "Using cgal-none (skip ThirdParty build of CGAL)"
exit 0 exit 0
fi fi
# For OpenFOAM 1912 and earlier, no predefined default.
# Force headers-only *after* starting with OpenFOAM-v2006
if [ -z "$optHeadersOnly" ] && foamVersion=$(wmake -version 2>/dev/null)
then
if [ "${foamVersion:-0}" -gt 1912 ]
then
optHeadersOnly=true
fi
fi
# Headers-only - might be able to avoid gmp/mpfr?
## if [ "${optHeadersOnly:-false}" = true ]
## then
## gmpPACKAGE=none
## mpfrPACKAGE=none
## unset GMP_ARCH_PATH MPFR_ARCH_PATH
## fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build Boost # Build Boost
...@@ -187,13 +210,13 @@ fi ...@@ -187,13 +210,13 @@ fi
# BOOST_ARCH_PATH : installation directory # BOOST_ARCH_PATH : installation directory
# BOOST_SOURCE_DIR : location of the original sources # BOOST_SOURCE_DIR : location of the original sources
BOOST_SOURCE_DIR=$sourceBASE/$boostPACKAGE BOOST_SOURCE_DIR="$sourceBASE/$boostPACKAGE"
: ${BOOST_ARCH_PATH:=$installBASE/$boostPACKAGE} # Fallback : "${BOOST_ARCH_PATH:=$installBASE/$boostPACKAGE}"
boostInc="$BOOST_ARCH_PATH/include" boostInc="$BOOST_ARCH_PATH/include"
boostLib="$BOOST_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" boostLib="$BOOST_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
if _foamIsSystem $boostPACKAGE if _foamIsSystem "$boostPACKAGE"
then then
echo "Using boost-system (skip ThirdParty build of BOOST)" echo "Using boost-system (skip ThirdParty build of BOOST)"
...@@ -201,9 +224,9 @@ then ...@@ -201,9 +224,9 @@ then
if [ -d "$boostInc" ] if [ -d "$boostInc" ]
then then
if BOOST_ARCH_PATH=$(cd $BOOST_ARCH_PATH 2>/dev/null && pwd -P) if BOOST_ARCH_PATH=$(cd "$BOOST_ARCH_PATH" 2>/dev/null && pwd -P)
then then
boostPACKAGE=${BOOST_ARCH_PATH##*/} boostPACKAGE="${BOOST_ARCH_PATH##*/}"
else else
echo "ERROR: bad path for BOOST_ARCH_PATH" echo "ERROR: bad path for BOOST_ARCH_PATH"
echo "stopping build" echo "stopping build"
...@@ -282,8 +305,8 @@ else ...@@ -282,8 +305,8 @@ else
esac esac
./bootstrap.sh \ ./bootstrap.sh \
--prefix=$BOOST_ARCH_PATH \ --prefix="$BOOST_ARCH_PATH" \
--libdir=$boostLib \ --libdir="$boostLib" \
--with-libraries=thread \ --with-libraries=thread \
--with-libraries=system \ --with-libraries=system \
--with-toolset="$optToolset" \ --with-toolset="$optToolset" \
...@@ -295,8 +318,9 @@ else ...@@ -295,8 +318,9 @@ else
} }
fi fi
# Nothing left to build # Nothing left to build
if _foamIsSystem $cgalPACKAGE if _foamIsSystem "$cgalPACKAGE"
then then
echo "Using cgal-system (skip ThirdParty build of CGAL)" echo "Using cgal-system (skip ThirdParty build of CGAL)"
exit 0 exit 0
...@@ -328,28 +352,28 @@ fi ...@@ -328,28 +352,28 @@ fi
# CGAL_BUILD_DIR : location of the build # CGAL_BUILD_DIR : location of the build
# CGAL_ARCH_PATH : installation directory # CGAL_ARCH_PATH : installation directory
CGAL_SOURCE_DIR=$sourceBASE/$cgalPACKAGE CGAL_SOURCE_DIR="$sourceBASE/$cgalPACKAGE"
CGAL_BUILD_DIR=$buildBASE/$cgalPACKAGE CGAL_BUILD_DIR="$buildBASE/$cgalPACKAGE"
: ${CGAL_ARCH_PATH:=$installBASE/$cgalPACKAGE} # Fallback : "${CGAL_ARCH_PATH:=$installBASE/$cgalPACKAGE}"
# gmp/mpfr are installed without compiler name # gmp/mpfr are installed without compiler name
mpfrBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH mpfrBASE="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH"
# Enable/disable gmp/mpfr together # Enable/disable gmp/mpfr together
if _foamIsNone $gmpPACKAGE || _foamIsNone $mpfrPACKAGE if _foamIsNone "$gmpPACKAGE" || _foamIsNone "$mpfrPACKAGE"
then then
GMP_ARCH_PATH=none GMP_ARCH_PATH=none
MPFR_ARCH_PATH=none MPFR_ARCH_PATH=none
elif _foamIsSystem $gmpPACKAGE || _foamIsSystem $mpfrPACKAGE elif _foamIsSystem "$gmpPACKAGE" || _foamIsSystem "$mpfrPACKAGE"
then then
# May really be system, but could also by a central installation # May really be system, but could also by a central installation
# Ensure everything is accurately recorded. Resolve paths etc. # Ensure everything is accurately recorded. Resolve paths etc.
if [ -d "$GMP_ARCH_PATH" ] if [ -d "$GMP_ARCH_PATH" ]
then then
if GMP_ARCH_PATH=$(cd $GMP_ARCH_PATH 2>/dev/null && pwd -P) if GMP_ARCH_PATH=$(cd "$GMP_ARCH_PATH" 2>/dev/null && pwd -P)
then then
gmpPACKAGE=${GMP_ARCH_PATH##*/} gmpPACKAGE="${GMP_ARCH_PATH##*/}"
else else
echo "ERROR: bad path for GMP_ARCH_PATH" echo "ERROR: bad path for GMP_ARCH_PATH"
echo "stopping build" echo "stopping build"
...@@ -361,9 +385,9 @@ then ...@@ -361,9 +385,9 @@ then
if [ -d "$MPFR_ARCH_PATH" ] if [ -d "$MPFR_ARCH_PATH" ]
then then
if MPFR_ARCH_PATH=$(cd $MPFR_ARCH_PATH 2>/dev/null && pwd -P) if MPFR_ARCH_PATH=$(cd "$MPFR_ARCH_PATH" 2>/dev/null && pwd -P)
then then
mpfrPACKAGE=${MPFR_ARCH_PATH##*/} mpfrPACKAGE="${MPFR_ARCH_PATH##*/}"
else else
echo "ERROR: bad path for MPFR_ARCH_PATH" echo "ERROR: bad path for MPFR_ARCH_PATH"
echo "stopping build" echo "stopping build"
...@@ -373,8 +397,8 @@ then ...@@ -373,8 +397,8 @@ then
MPFR_ARCH_PATH=system MPFR_ARCH_PATH=system
fi fi
else else
GMP_ARCH_PATH=$mpfrBASE/$gmpPACKAGE GMP_ARCH_PATH="$mpfrBASE/$gmpPACKAGE"
MPFR_ARCH_PATH=$mpfrBASE/$mpfrPACKAGE MPFR_ARCH_PATH="$mpfrBASE/$mpfrPACKAGE"
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
...@@ -410,7 +434,7 @@ BOOST_VERSION=$BOOST_VERSION ...@@ -410,7 +434,7 @@ BOOST_VERSION=$BOOST_VERSION
CGAL_lib=lib$WM_COMPILER_LIB_ARCH CGAL_lib=lib$WM_COMPILER_LIB_ARCH
BOOST_lib=lib$WM_COMPILER_LIB_ARCH BOOST_lib=lib$WM_COMPILER_LIB_ARCH
CGAL_HEADER_ONLY=${optHeadersOnly:-false} CGAL_HEADER_ONLY=${optHeadersOnly:-default}
BUILD_INFO BUILD_INFO
} }
...@@ -464,13 +488,13 @@ fi ...@@ -464,13 +488,13 @@ fi
( (
# Remove any existing build folder and recreate # Remove any existing build folder and recreate
if [ -d $CGAL_BUILD_DIR ] if [ -d "$CGAL_BUILD_DIR" ]
then then
echo "removing old build directory" echo "removing old build directory"
echo " $CGAL_BUILD_DIR" echo " $CGAL_BUILD_DIR"
rm -rf $CGAL_BUILD_DIR rm -rf "$CGAL_BUILD_DIR"
fi fi
mkdir -p $CGAL_BUILD_DIR mkdir -p "$CGAL_BUILD_DIR"
cd "$CGAL_BUILD_DIR" || exit cd "$CGAL_BUILD_DIR" || exit
export GIT_DIR="$CGAL_SOURCE_DIR/.git" # Mask seeing our own git-repo export GIT_DIR="$CGAL_SOURCE_DIR/.git" # Mask seeing our own git-repo
...@@ -484,7 +508,7 @@ fi ...@@ -484,7 +508,7 @@ fi
# See http://doc.cgal.org/latest/Manual/installation.html # See http://doc.cgal.org/latest/Manual/installation.html
if _foamIsSystem $boostPACKAGE if _foamIsSystem "$boostPACKAGE"
then then
# Tagged as 'system' but could actually point to a central location # Tagged as 'system' but could actually point to a central location
if [ -d "$BOOST_ARCH_PATH/include" ] if [ -d "$BOOST_ARCH_PATH/include" ]
...@@ -512,10 +536,10 @@ CMAKE_OPTIONS ...@@ -512,10 +536,10 @@ CMAKE_OPTIONS
) )
fi fi
if _foamIsSystem $GMP_ARCH_PATH if _foamIsSystem "$GMP_ARCH_PATH"
then then
echo " gmp : system" echo " gmp : system"
elif _foamIsNone $GMP_ARCH_PATH elif _foamIsNone "$GMP_ARCH_PATH"
then then
echo " gmp : disabled" echo " gmp : disabled"
configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr
...@@ -543,10 +567,10 @@ CMAKE_OPTIONS ...@@ -543,10 +567,10 @@ CMAKE_OPTIONS
echo " system : gmp (did not find $GMP_ARCH_PATH)" echo " system : gmp (did not find $GMP_ARCH_PATH)"
fi fi
if _foamIsSystem $MPFR_ARCH_PATH if _foamIsSystem "$MPFR_ARCH_PATH"
then then
echo " mpfr : system" echo " mpfr : system"
elif _foamIsNone $MPFR_ARCH_PATH elif _foamIsNone "$MPFR_ARCH_PATH"
then then
echo " mpfr : disabled" echo " mpfr : disabled"
configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr configGmp="-DCGAL_DISABLE_GMP=TRUE" # Also used for mpfr
...@@ -586,6 +610,13 @@ CMAKE_OPTIONS ...@@ -586,6 +610,13 @@ CMAKE_OPTIONS
;; ;;
esac esac
# Headers/library decision
case "$optHeadersOnly" in
(true | false)
cmakeDefs="$cmakeDefs -DCGAL_HEADER_ONLY=${optHeadersOnly}"
;;
esac
# For CGAL < 4.9, for installation into lib64/, not lib/ # For CGAL < 4.9, for installation into lib64/, not lib/
# Name only (not path) for CGAL_INSTALL_LIB_DIR # Name only (not path) for CGAL_INSTALL_LIB_DIR
echo "----" echo "----"
...@@ -598,7 +629,6 @@ CMAKE_OPTIONS ...@@ -598,7 +629,6 @@ CMAKE_OPTIONS
-DWITH_CGAL_ImageIO=OFF \ -DWITH_CGAL_ImageIO=OFF \
-DWITH_CGAL_Qt5=OFF \ -DWITH_CGAL_Qt5=OFF \
$cmakeDefs \ $cmakeDefs \
${optHeadersOnly:+-DCGAL_HEADER_ONLY=TRUE} \
$configBoost $configGmp $configMpfr \ $configBoost $configGmp $configMpfr \
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \ ${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
$CGAL_SOURCE_DIR \ $CGAL_SOURCE_DIR \
......
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