ENH: split up internals of wmake/scripts/have_XXX functions

- adds some more flexibility
This commit is contained in:
Mark Olesen
2020-05-15 13:58:16 +02:00
committed by Andrew Heather
parent c156125669
commit f8ef85b72f
14 changed files with 679 additions and 480 deletions

View File

@ -21,7 +21,7 @@
# or config.sh/CGAL (when BOOST_ARCH_PATH is empty)
#
# Functions provided
# have_boost, no_boost, echo_boost, query_boost
# have_boost, no_boost, echo_boost, query_boost, search_boost
#
# Variables set on success
# HAVE_BOOST
@ -34,7 +34,7 @@
#------------------------------------------------------------------------------
# Reset variables
# Reset
no_boost()
{
unset HAVE_BOOST BOOST_INC_DIR BOOST_LIB_DIR
@ -51,47 +51,18 @@ echo_boost()
}
# Query settings (from CGAL setup)
query_boost()
{
local config="config.sh/CGAL"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query boost "$BOOST_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "boost=unknown"
fi
}
# Search
# $1 : prefix (*_ARCH_PATH, system, ...)
#
# On success, return 0 and export variables
# -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR
have_boost()
search_boost()
{
local warn # warn="==> skip boost"
local config="config.sh/CGAL"
local settings
# Setup - current environment if set
if [ -z "$BOOST_ARCH_PATH" ]
then
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
fi
# Expected location, include/library names
local prefix="$BOOST_ARCH_PATH"
local incName="boost/version.hpp"
local libName="libboost_system"
local prefix="${1:-system}"
local header library
# ----------------------------------
@ -138,7 +109,49 @@ have_boost()
}
# Reset variables
# Output as per search_* function
have_boost()
{
local warn # warn="==> skip boost"
local config="config.sh/CGAL"
local file
# Setup - current environment if set
if [ -z "$BOOST_ARCH_PATH" ]
then
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$file"
else
[ -n "$warn" ] && echo "$warn (no $config)"
return 2
fi
fi
search_boost "$BOOST_ARCH_PATH"
}
# Query settings (from CGAL setup)
query_boost()
{
local config="config.sh/CGAL"
local file
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$file"
_process_query boost "$BOOST_ARCH_PATH"
else
echo "(no $config)" 1>&2
echo "boost=unknown"
fi
}
#------------------------------------------------------------------------------
# Reset
no_boost
# Test/query