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