#!/bin/sh #------------------------------------------------------------------------------ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation # \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. # # OpenFOAM is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with OpenFOAM. If not, see . # # Script # makeCGAL # # Description # Build script for CGAL # # Note # Normally builds against ThirdParty boost and gmp/mpfr when possible. # To override this behaviour (and use the system boost and/or gmp/mpfr), # simply specify a 'system' version. For example, # makeCGAL boost-system gmp-system # #------------------------------------------------------------------------------ # Get CGAL, boost and gmp/mpfr versions . $WM_PROJECT_DIR/etc/config.sh/functions unset -f _foamAddPath _foamAddLib _foamAddMan # get settings only _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL) _foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler) boostPACKAGE=${boost_version:-boost-system} gmpPACKAGE=${gmp_version:-gmp-system} mpfrPACKAGE=${mpfr_version:-mpfr-system} cgalPACKAGE=$cgal_version #------------------------------------------------------------------------------ # Run from third-party directory only wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 } . etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ Script="${0##*/}" usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat</dev/null) cat< $buildInfoFile # Information from OpenFOAM build on '$(date)' # CGAL=${CGAL_ARCH_PATH##*/} BOOST=${BOOST_ARCH_PATH##*/} GMP=${GMP_ARCH_PATH##*/} MPFR=${MPFR_ARCH_PATH##*/} CGAL_VERSION=$CGAL_VERSION BOOST_VERSION=$BOOST_VERSION CGAL_lib=lib$WM_COMPILER_LIB_ARCH BOOST_lib=lib$WM_COMPILER_LIB_ARCH 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 local libDirName="lib$WM_COMPILER_LIB_ARCH" 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 infoValueEq CGAL_lib "$libDirName" "$info" || return 1 infoValueEq BOOST_lib "$libDirName" "$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 if [ -d $CGAL_BINARY_DIR ] then echo "removing old build directory" echo " $CGAL_BINARY_DIR" rm -rf $CGAL_BINARY_DIR fi mkdir -p $CGAL_BINARY_DIR cd $CGAL_BINARY_DIR || exit 1 unset configBoost configGmp configMpfr echo "----" echo "Configuring $cgalPACKAGE with boost $BOOST_VERSION" echo " Source : $CGAL_SOURCE_DIR" echo " Build : $CGAL_BINARY_DIR" echo " Target : $CGAL_DIR" if [ -d "$BOOST_ARCH_PATH" ] then echo " ThirdParty : boost" configBoost=$(cat <> $CGAL_ARCH_PATH/share/files fi done # record our build-status recordCGALinfo echo "Done CGAL" ) #------------------------------------------------------------------------------