mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
CONFIG: additional test for mpfr library in cgal config (#2664)
- other systems (eg, ARM64 linux with clang) do not have a separate mpfr library configured so also check for mpfr (gmp is assumed to be the same) and return corresponding cgal flavour (eg, header-no-mpfr)
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -14,12 +14,16 @@
|
||||
# have_cgal
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of CGAL
|
||||
# Detection/setup of CGAL (with/without mpfr support)
|
||||
#
|
||||
# Requires
|
||||
# CGAL_ARCH_PATH
|
||||
# or config.sh/CGAL (when CGAL_ARCH_PATH is empty)
|
||||
#
|
||||
# Optional
|
||||
# MPFR_ARCH_PATH
|
||||
# or config.sh/CGAL (when CGAL_ARCH_PATH is empty)
|
||||
#
|
||||
# Functions provided
|
||||
# have_cgal, no_cgal, echo_cgal, query_cgal
|
||||
#
|
||||
@ -42,6 +46,7 @@
|
||||
no_cgal()
|
||||
{
|
||||
unset HAVE_CGAL CGAL_FLAVOUR CGAL_INC_DIR CGAL_LIB_DIR
|
||||
unset HAVE_MPFR MPFR_INC_DIR MPFR_LIB_DIR
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +61,62 @@ echo_cgal()
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_MPFR, MPFR_INC_DIR, MPFR_LIB_DIR
|
||||
search_mpfr()
|
||||
{
|
||||
local warn # warn="==> skip mpfr"
|
||||
local incName="mpfr.h"
|
||||
local libName="libmpfr"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
then
|
||||
[ -n "$warn" ] && echo "$warn (disabled)"
|
||||
return 1
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# Library may be optional - eg, header-only
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "==> $warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
# OK
|
||||
export HAVE_MPFR=true
|
||||
export MPFR_ARCH_PATH="$prefix"
|
||||
export MPFR_INC_DIR="${header%/*}" # Basename
|
||||
export MPFR_LIB_DIR="${library%/*}" # Basename
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
@ -110,6 +171,10 @@ search_cgal()
|
||||
# OK
|
||||
export HAVE_CGAL=true
|
||||
export CGAL_FLAVOUR="${flavour:-library}"
|
||||
if [ "$HAVE_MPFR" != true ]
|
||||
then
|
||||
CGAL_FLAVOUR="${CGAL_FLAVOUR}-no-mpfr"
|
||||
fi
|
||||
export CGAL_ARCH_PATH="$prefix"
|
||||
export CGAL_INC_DIR="${header%/*}" # Basename
|
||||
export CGAL_LIB_DIR="${library%/*}" # Basename
|
||||
@ -138,6 +203,9 @@ have_cgal()
|
||||
# Need boost for cgal
|
||||
search_boost "$BOOST_ARCH_PATH"
|
||||
|
||||
# May need mpfr/gmp for cgal
|
||||
search_mpfr "$MPFR_ARCH_PATH"
|
||||
|
||||
search_cgal "$CGAL_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user