Commit fde551c0 authored by mark's avatar mark
Browse files

ENH: avoid repeated CGAL builds

- now check for existing third-party build and skip if all build
  components are unchanged.

- skip build entirely for boost-none or CGAL-none

This is primarily useful when makeCGAL is called directly and not from
Allwmake.

STYLE: use WM_COMPILER_LIB_ARCH for boost system lib
parent 0b1c7610
...@@ -133,9 +133,24 @@ done ...@@ -133,9 +133,24 @@ done
[ -n "$cgalPACKAGE" ] || die "The cgal-VERSION was not specified" [ -n "$cgalPACKAGE" ] || die "The cgal-VERSION was not specified"
# nothing to build
if _foamIsNone "$boostPACKAGE"
then
echo "Using boost-none (skip ThirdParty build of BOOST/CGAL)"
exit 0
fi
if _foamIsNone "$cgalPACKAGE"
then
echo "Using cgal-none (skip ThirdParty build of CGAL)"
exit 0
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build Boost # Build Boost
# For 64-bit
# - Third-Party builds into 'lib'
# - system is normally built into 'lib64'
# #
# BOOST_SOURCE_DIR : location of the original sources # BOOST_SOURCE_DIR : location of the original sources
...@@ -148,18 +163,10 @@ then ...@@ -148,18 +163,10 @@ then
boostLib="$BOOST_ARCH_PATH/lib" boostLib="$BOOST_ARCH_PATH/lib"
elif _foamIsSystem $BOOST_ARCH_PATH elif _foamIsSystem $BOOST_ARCH_PATH
then then
echo "Using boost-system" echo "Using boost-system (skip ThirdParty build of BOOST)"
boostInc="/usr/include" boostInc="/usr/include"
boostLib="/usr/lib$WM_COMPILER_LIB_ARCH"
# 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 else
echo "Starting build: boost" echo "Starting build: boost"
echo echo
...@@ -184,10 +191,10 @@ else ...@@ -184,10 +191,10 @@ else
} }
fi fi
# nothing to build # nothing left to build
if _foamIsSystem "$cgalPACKAGE" if _foamIsSystem "$cgalPACKAGE"
then then
echo "Using CGAL-system" echo "Using cgal-system (skip ThirdParty build of CGAL)"
exit 0 exit 0
fi fi
...@@ -202,10 +209,13 @@ fi ...@@ -202,10 +209,13 @@ fi
# Retrieve boost version: # Retrieve boost version:
if [ -f "$boostInc/boost/version.hpp" ] if [ -f "$boostInc/boost/version.hpp" ]
then then
BOOST_VERSION_NO=`sed -ne 's/^#define *BOOST_VERSION *\([0-9][0-9]*\).*$/\1/p' $boostInc/boost/version.hpp` BOOST_VERSION=$(sed -ne 's/^ *# *define *BOOST_VERSION *\([0-9][0-9]*\).*$/\1/p' $boostInc/boost/version.hpp)
else else
echo "Boost does not appear to be installed" echo
echo "ERROR: boost does not appear to be installed, but is required to build CGAL"
echo " Change your settings, or disable entirely (with cgal-system, cgal-none, boost-none)"
echo "stopping build" echo "stopping build"
echo
exit 1 exit 1
fi fi
...@@ -224,6 +234,9 @@ SUMMARY ...@@ -224,6 +234,9 @@ SUMMARY
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Build CGAL # Build CGAL
# For 64-bit
# - Third-Party builds into 'lib'
# - system is normally built into 'lib64'
# #
# CGAL_SOURCE_DIR : location of the original sources # CGAL_SOURCE_DIR : location of the original sources
# CGAL_BINARY_DIR : location of the build # CGAL_BINARY_DIR : location of the build
...@@ -241,6 +254,67 @@ installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH ...@@ -241,6 +254,67 @@ installBASE=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH
GMP_ARCH_PATH=$installBASE/$gmpPACKAGE GMP_ARCH_PATH=$installBASE/$gmpPACKAGE
MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
#
# build information recorded for later use
#
buildInfoFile=$CGAL_ARCH_PATH/share/openfoam-build
recordCGALinfo()
{
CGAL_VERSION=$(sed -ne 's/^ *# *define *CGAL_VERSION_NR *\([0-9][0-9]*\).*$/\1/p' $CGAL_ARCH_PATH/include/CGAL/version.h 2>/dev/null)
cat<<BUILD_INFO > $buildInfoFile
CGAL=${CGAL_ARCH_PATH##*/}
BOOST=${BOOST_ARCH_PATH##*/}
GMP=${GMP_ARCH_PATH##*/}
MPFR=${MPFR_ARCH_PATH##*/}
CGAL_VERSION=$CGAL_VERSION
BOOST_VERSION=$BOOST_VERSION
BUILD_INFO
}
# compare expected vs what is extracted as KEY=... in text
# $1 = key
# $2 = expected
# $3 = text to extract from
infoValueEq()
{
local val=$(echo "${3:-unset}" | sed -ne "s/^$1=//p")
if [ "$2" = "$val" ]
then
:
else
echo " $1=$2, previous build had $1='${val:-not-found}'"
return 1
fi
}
# needs build
cgalIsCurrent()
{
local info=$(cat $buildInfoFile 2>/dev/null)
[ -n "$info" ] || return 1
echo "checking information from existing build ..."
echo " ${CGAL_ARCH_PATH}"
infoValueEq CGAL "${CGAL_ARCH_PATH##*/}" "$info" || return 1
infoValueEq BOOST "${BOOST_ARCH_PATH##*/}" "$info" || return 1
infoValueEq GMP "${GMP_ARCH_PATH##*/}" "$info" || return 1
infoValueEq MPFR "${MPFR_ARCH_PATH##*/}" "$info" || return 1
infoValueEq BOOST_VERSION "${BOOST_VERSION}" "$info" || return 1
return 0
}
if cgalIsCurrent
then
echo " ${CGAL_ARCH_PATH##*/} build appears to be up-to-date - skipping"
echo
exit 0
fi
( (
# Remove any existing build folder and recreate # Remove any existing build folder and recreate
if [ -d $CGAL_BINARY_DIR ] if [ -d $CGAL_BINARY_DIR ]
...@@ -255,7 +329,7 @@ MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE ...@@ -255,7 +329,7 @@ MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
unset configBoost configGmp configMpfr unset configBoost configGmp configMpfr
echo "----" echo "----"
echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION_NO" echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION"
echo " Source : $CGAL_SOURCE_DIR" echo " Source : $CGAL_SOURCE_DIR"
echo " Build : $CGAL_BINARY_DIR" echo " Build : $CGAL_BINARY_DIR"
echo " Target : $CGAL_DIR" echo " Target : $CGAL_DIR"
...@@ -271,7 +345,7 @@ MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE ...@@ -271,7 +345,7 @@ MPFR_ARCH_PATH=$installBASE/$mpfrPACKAGE
-DBoost_THREAD_LIBRARY_RELEASE=$boostLib/libboost_thread.so -DBoost_THREAD_LIBRARY_RELEASE=$boostLib/libboost_thread.so
-DBoost_SYSTEM_LIBRARY=$boostLib/libboost_system.so -DBoost_SYSTEM_LIBRARY=$boostLib/libboost_system.so
-DBoost_SYSTEM_LIBRARY_RELEASE=$boostLib/libboost_system.so -DBoost_SYSTEM_LIBRARY_RELEASE=$boostLib/libboost_system.so
-DBoost_VERSION=$BOOST_VERSION_NO -DBoost_VERSION=$BOOST_VERSION
CMAKE_OPTIONS CMAKE_OPTIONS
) )
else else
...@@ -336,6 +410,9 @@ CMAKE_OPTIONS ...@@ -336,6 +410,9 @@ CMAKE_OPTIONS
fi fi
done done
# record our build-status
recordCGALinfo
echo "Done CGAL" echo "Done CGAL"
) )
......
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