Commit d7db8f82 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

COMP: support cgal header-only configurations

- improve wmake CGAL rule(s) accordingly
parent f8ef85b7
......@@ -14,11 +14,9 @@ EXE_INC = \
${c++CGALWARN} \
-I.. \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I/usr/include/Qt
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-L$(CGAL_ARCH_PATH)/lib \
-L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-L${CGAL_LIBS} \
-lsurfMesh \
-lmeshTools
CGAL_INC = \
-I$(GMP_ARCH_PATH)/include \
-I$(MPFR_ARCH_PATH)/include \
-I$(BOOST_ARCH_PATH)/include \
-I$(CGAL_ARCH_PATH)/include \
-I/usr/local/include \
-I/usr/include
CGAL_LIBS = \
-L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-L$(BOOST_ARCH_PATH)/lib \
-L$(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-L$(CGAL_ARCH_PATH)/lib \
-L$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH) \
-lCGAL \
-lgmp \
-lmpfr
# ----------------------------------------------------------------------------
# CGAL definitions - several possibilities
#
# 0. missing
# 1. header-only
# 2. library, no mpfr
# 3. library, with mpfr (a likely default)
#
# Dispatch according to the defined 'CGAL_FLAVOUR'
# - names may change [see wmake/scripts/have_cgal]
# (no-cgal | cgal-header | cgal-no-mpfr | cgal-mpfr)
cgal_subrule := cgal-mpfr
ifneq (,$(findstring header,$(CGAL_FLAVOUR)))
cgal_subrule := cgal-header-only
endif
ifneq (,$(findstring no-mpfr,$(CGAL_FLAVOUR)))
cgal_subrule := cgal-no-mpfr
endif
# ----------------------------------------------------------------------------
# BOOST include/library directories - synthesize from ARCH_PATH as required
ifeq (,$(strip $(BOOST_INC_DIR)))
ifneq (,$(strip $(BOOST_ARCH_PATH)))
BOOST_INC_DIR = $(BOOST_ARCH_PATH)/include
BOOST_LIB_DIR = $(BOOST_ARCH_PATH)/lib \
$(BOOST_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
endif
endif
# ----------------------------------------------------------------------------
# CGAL include/library directories - synthesize from ARCH_PATH as required
ifeq (,$(strip $(CGAL_INC_DIR)))
ifneq (,$(strip $(CGAL_ARCH_PATH)))
CGAL_INC_DIR = $(CGAL_ARCH_PATH)/include
CGAL_LIB_DIR = $(CGAL_ARCH_PATH)/lib \
$(CGAL_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
endif
endif
# ----------------------------------------------------------------------------
CGAL_INC =
CGAL_LIBS =
include $(GENERAL_RULES)/$(cgal_subrule)
# Override
sinclude $(DEFAULT_RULES)/CGAL
sinclude $(DEFAULT_RULES)/$(cgal_subrule)
# DEBUG
# -----
## $(info CGAL_FLAVOUR $(CGAL_FLAVOUR))
## $(info subrule $(cgal_subrule))
## CGAL_INC += -Wp,-v
## $(info CGAL_INC: $(CGAL_INC))
## $(info CGAL_LIB: $(CGAL_LIBS))
## $(info BOOST_INC_DIR: $(BOOST_INC_DIR))
## $(info BOOST_LIB_DIR: $(BOOST_LIB_DIR))
## $(info CGAL_INC_DIR: $(CGAL_INC_DIR))
## $(info CGAL_LIB_DIR: $(CGAL_LIB_DIR))
# ---------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# CGAL (header-only version)
CGAL_INC = -DCGAL_HEADER_ONLY
CGAL_LIBS =
ifneq (,$(GMP_ARCH_PATH))
CGAL_INC += -I$(GMP_ARCH_PATH)/include
CGAL_LIBS += -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
endif
ifneq (,$(MPFR_ARCH_PATH))
CGAL_INC += -I$(MPFR_ARCH_PATH)/include
CGAL_LIBS += -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
endif
CGAL_INC += \
$(foreach dir,$(BOOST_INC_DIR),-I$(dir)) \
$(foreach dir,$(CGAL_INC_DIR),-I$(dir))
CGAL_LIBS += \
$(foreach dir,$(BOOST_LIB_DIR),-L$(dir)) \
-lmpfr -lgmp
# ----
# Extra failsafe - still needed? (2020-05-15)
## CGAL_INC += -I/usr/local/include -I/usr/include
# -----------------------------------------------------------------------------
# Headers-only CGAL
CGAL_INC = \
-I$(BOOST_ARCH_PATH)/include \
-I$(CGAL_ARCH_PATH)/include
CGAL_LIBS =
#------------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# CGAL (library version) with mpfr/gmp
CGAL_INC =
CGAL_LIBS =
ifneq (,$(strip $(GMP_ARCH_PATH)))
CGAL_INC += -I$(GMP_ARCH_PATH)/include
CGAL_LIBS += -L$(GMP_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
endif
ifneq (,$(strip $(MPFR_ARCH_PATH)))
CGAL_INC += -I$(MPFR_ARCH_PATH)/include
CGAL_LIBS += -L$(MPFR_ARCH_PATH)/lib$(WM_COMPILER_LIB_ARCH)
endif
CGAL_INC += \
$(foreach dir,$(BOOST_INC_DIR),-I$(dir)) \
$(foreach dir,$(CGAL_INC_DIR),-I$(dir))
CGAL_LIBS += \
$(foreach dir,$(BOOST_LIB_DIR),-L$(dir)) \
$(foreach dir,$(CGAL_LIB_DIR),-L$(dir)) \
-lCGAL -lmpfr -lgmp
# ----
# Extra failsafe - still needed? (2020-05-15)
## CGAL_INC += -I/usr/local/include -I/usr/include
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# CGAL (library version) without mpfr
CGAL_INC = \
$(foreach dir,$(BOOST_INC_DIR),-I$(dir)) \
$(foreach dir,$(CGAL_INC_DIR),-I$(dir))
CGAL_LIBS = \
$(foreach dir,$(BOOST_LIB_DIR),-L$(dir)) \
$(foreach dir,$(CGAL_LIB_DIR),-L$(dir)) \
-lCGAL
# ----
# Extra failsafe - still needed? (2020-05-15)
## CGAL_INC += -I/usr/local/include -I/usr/include
# -----------------------------------------------------------------------------
# Empty flags for not compiling/linking with CGAL
#------------------------------------------------------------------------------
# CGAL - empty flags for not compiling/linking
CGAL_INC =
CGAL_LIBS =
......
# Clang build of CGAL on Darwin without mpfr,gmp
# ----------------------------------------------------------------------------
# CGAL on Darwin
# CGAL (library version) without mpfr
CGAL_INC = \
-I$(BOOST_ARCH_PATH)/include \
-I$(CGAL_ARCH_PATH)/include
CGAL_INC = \
$(foreach dir,$(BOOST_INC_DIR),-I$(dir)) \
$(foreach dir,$(CGAL_INC_DIR),-I$(dir))
CGAL_LIBS = \
-L$(BOOST_ARCH_PATH)/lib \
-L$(CGAL_ARCH_PATH)/lib \
$(foreach dir,$(BOOST_LIB_DIR),-L$(dir)) \
$(foreach dir,$(CGAL_LIB_DIR),-L$(dir)) \
-lCGAL
# ----------------------------------------------------------------------------
......@@ -25,19 +25,23 @@
#
# Variables set on success
# HAVE_CGAL
# CGAL_FLAVOUR (header, library, ...)
# CGAL_ARCH_PATH
# CGAL_INC_DIR
# CGAL_LIB_DIR
#
# Uses
# BOOST_ARCH_PATH and have_boost::search_boost()
#
#------------------------------------------------------------------------------
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_boost # boost + system functions
#------------------------------------------------------------------------------
# Reset
no_cgal()
{
unset HAVE_CGAL CGAL_INC_DIR CGAL_LIB_DIR
unset HAVE_CGAL CGAL_FLAVOUR CGAL_INC_DIR CGAL_LIB_DIR
}
......@@ -45,6 +49,7 @@ no_cgal()
echo_cgal()
{
echo "cgal=${HAVE_CGAL:-false}"
echo "flavour=$CGAL_FLAVOUR"
echo "root=$CGAL_ARCH_PATH"
echo "include=$CGAL_INC_DIR"
echo "library=$CGAL_LIB_DIR"
......@@ -55,7 +60,7 @@ echo_cgal()
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR, CGAL_FLAVOUR
search_cgal()
{
local warn # warn="==> skip cgal"
......@@ -63,7 +68,7 @@ search_cgal()
local libName="libCGAL"
local prefix="${1:-system}"
local header library
local header library flavour
# ----------------------------------
if isNone "$prefix"
......@@ -89,12 +94,13 @@ search_cgal()
return 2
}
# Library
# Library may be optional - eg, header-only
[ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|| {
[ -n "$warn" ] && echo "$warn (no library)"
return 2
[ -n "$warn" ] && echo "==> cgal (no library)"
unset library
flavour="header" # Header only
}
# ----------------------------------
......@@ -129,6 +135,9 @@ have_cgal()
fi
fi
# Need boost for cgal
search_boost "$BOOST_ARCH_PATH"
search_cgal "$CGAL_ARCH_PATH"
}
......
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