Commit 06333efd authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: improve detection of scotch system include/libraries

- align wmake have_* scripts to support version query as per current
  develop branch

- use config.sh/ fallbacks when the corresponding *_ARCH_PATH is empty
  (eg, BOOST, CGAL, FFTW).
  This aids when building outside of the regular OpenFOAM environment.
parent 4200774d
......@@ -5,17 +5,17 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2017-2019 OpenCFD Ltd.
# Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# cmakeFunctions
#
# Description
# Helper functions for CMake
#
#------------------------------------------------------------------------------
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
......@@ -61,6 +61,22 @@ sameDependency()
fi
}
#
# Save dependency information into sentinel file
#
storeDependency()
{
local depend="$1"
local sentinel="$2"
if [ -n "$sentinel" ]
then
mkdir -p "$(dirname "$sentinel")"
echo "$depend" >| "$sentinel"
fi
return 0
}
# CMake with output suppressed according to WM_QUIET
_cmake()
......@@ -98,7 +114,7 @@ cmakeVersioned()
mkdir -p "$objectsDir" \
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make) \
&& echo "$depend" >| "${sentinel:-/dev/null}"
&& storeDependency "$depend" "$sentinel"
}
......@@ -124,7 +140,7 @@ cmakeVersionedInstall()
mkdir -p "$objectsDir" \
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make install) \
&& echo "$depend" >| "${sentinel:-/dev/null}"
&& storeDependency "$depend" "$sentinel"
}
......@@ -151,7 +167,7 @@ wmakeVersioned()
mkdir -p "$objectsDir" \
&& wmake "$@" \
&& echo "$depend" >| "${sentinel:-/dev/null}"
&& storeDependency "$depend" "$sentinel"
}
......
......@@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# have_adios2
......@@ -21,7 +20,7 @@
# ADIOS2_ARCH_PATH
#
# Functions provided
# have_adios2, no_adios2, echo_adios2, hint_adios2
# have_adios2, no_adios2, echo_adios2, hint_adios2, query_adios2
#
# Variables set on success
# HAVE_ADIOS2
......@@ -38,7 +37,6 @@
no_adios2()
{
unset HAVE_ADIOS2 ADIOS2_INC_DIR ADIOS2_LIB_DIR
return 0
}
......@@ -68,26 +66,44 @@ INFORMATION
}
# Query settings
query_adios2()
{
local config="config.sh/adios2"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query adios2 "$ADIOS2_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "adios2=unknown"
fi
}
# On success, return 0 and export variables
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
have_adios2()
{
local prefix header library incName libName settings warn
# warn="==> skip adios2"
local warn # warn="==> skip adios2"
local config="config.sh/adios2"
local settings
# Setup
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/adios2)
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no config.sh/adios2 settings)"
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
prefix="$ADIOS2_ARCH_PATH"
incName="adios2.h"
libName="libadios2"
local prefix="$ADIOS2_ARCH_PATH"
local incName="adios2.h"
local libName="libadios2"
local header library
# ----------------------------------
if isNone "$prefix"
......@@ -134,11 +150,15 @@ have_adios2()
# Reset variables
no_adios2
# Testing
if [ "$1" = "-test" ]
then
# Test/query
case "$1" in
-test)
have_adios2
echo_adios2
fi
;;
-query)
query_adios2
;;
esac
#------------------------------------------------------------------------------
......@@ -5,23 +5,23 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# have_boost
#
# Description
# Detection/setup of Boost
# Detection/setup of BOOST
#
# Requires
# BOOST_ARCH_PATH
# or config.sh/CGAL (when BOOST_ARCH_PATH is empty)
#
# Functions provided
# have_boost, no_boost, echo_boost
# have_boost, no_boost, echo_boost, query_boost
#
# Variables set on success
# HAVE_BOOST
......@@ -38,7 +38,6 @@
no_boost()
{
unset HAVE_BOOST BOOST_INC_DIR BOOST_LIB_DIR
return 0
}
......@@ -52,19 +51,48 @@ 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
}
# On success, return 0 and export variables
# -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR
have_boost()
{
local prefix header library incName libName settings warn
# warn="==> skip boost"
local warn # warn="==> skip boost"
local config="config.sh/CGAL"
local settings
# Setup - from the current environment
# 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
prefix="$BOOST_ARCH_PATH"
incName="boost/version.hpp"
libName="libboost_system"
local prefix="$BOOST_ARCH_PATH"
local incName="boost/version.hpp"
local libName="libboost_system"
local header library
# ----------------------------------
if isNone "$prefix"
......@@ -113,11 +141,15 @@ have_boost()
# Reset variables
no_boost
# Testing
if [ "$1" = "-test" ]
then
# Test/query
case "$1" in
-test)
have_boost
echo_boost
fi
;;
-query)
query_boost
;;
esac
#------------------------------------------------------------------------------
......@@ -5,23 +5,22 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# have_ccmio
#
# Description
# Detection/setup of ccmio
# Detection/setup of CCMIO
#
# Requires
# config.sh/ccmio
#
# Functions provided
# have_ccmio, no_ccmio, echo_ccmio
# have_ccmio, no_ccmio, echo_ccmio, query_ccmio
#
# Variables set on success
# HAVE_CCMIO
......@@ -38,9 +37,9 @@
no_ccmio()
{
unset HAVE_CCMIO CCMIO_INC_DIR CCMIO_LIB_DIR
return 0
}
# Report
echo_ccmio()
{
......@@ -51,27 +50,45 @@ echo_ccmio()
}
# Query settings
query_ccmio()
{
local config="config.sh/ccmio"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query ccmio "$CCMIO_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "ccmio=unknown"
fi
}
# On success, return 0 and export variables
# -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR
have_ccmio()
{
local prefix header library incName libName settings warn
warn="==> skip ccmio"
local warn="==> skip ccmio"
local config="config.sh/ccmio"
local settings
# Setup
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no config.sh/ccmio settings)"
[ -n "$warn" ] && echo "$warn (no $config settings)"
return 2
fi
# Expected location, include/library names
# Link with static libccmio only (fewer issues)
prefix="$CCMIO_ARCH_PATH"
incName="libccmio/ccmio.h"
libName="libccmio.a"
local prefix="$CCMIO_ARCH_PATH"
local incName="libccmio/ccmio.h"
local libName="libccmio.a"
local header library
# ----------------------------------
if isNone "$prefix"
......@@ -139,11 +156,15 @@ have_ccmio()
# Reset variables
no_ccmio
# Testing
if [ "$1" = "-test" ]
then
# Test/query
case "$1" in
-test)
have_ccmio
echo_ccmio
fi
;;
-query)
query_ccmio
;;
esac
#------------------------------------------------------------------------------
......@@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# have_cgal
......@@ -19,9 +18,10 @@
#
# Requires
# CGAL_ARCH_PATH
# or config.sh/CGAL (when CGAL_ARCH_PATH is empty)
#
# Functions provided
# have_cgal, no_cgal, echo_cgal
# have_cgal, no_cgal, echo_cgal, query_cgal
#
# Variables set on success
# HAVE_CGAL
......@@ -38,7 +38,6 @@
no_cgal()
{
unset HAVE_CGAL CGAL_INC_DIR CGAL_LIB_DIR
return 0
}
......@@ -52,19 +51,48 @@ echo_cgal()
}
# Query settings (from CGAL setup)
query_cgal()
{
local config="config.sh/CGAL"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query cgal "$CGAL_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "cgal=unknown"
fi
}
# On success, return 0 and export variables
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
have_cgal()
{
local prefix header library incName libName settings warn
# warn="==> skip cgal"
local warn # warn="==> skip cgal"
local config="config.sh/CGAL"
local settings
# Setup - from the current environment
# Setup - current environment if set
if [ -z "$CGAL_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
prefix="$CGAL_ARCH_PATH"
incName="CGAL/version.h"
libName="libCGAL"
local prefix="$CGAL_ARCH_PATH"
local incName="CGAL/version.h"
local libName="libCGAL"
local header library
# ----------------------------------
if isNone "$prefix"
......@@ -113,11 +141,15 @@ have_cgal()
# Reset variables
no_cgal
# Testing
if [ "$1" = "-test" ]
then
# Test/query
case "$1" in
-test)
have_cgal
echo_cgal
fi
;;
-query)
query_cgal
;;
esac
#------------------------------------------------------------------------------
......@@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# have_fftw
......@@ -19,9 +18,10 @@
#
# Requires
# FFTW_ARCH_PATH
# or config.sh/FFTW (when FFTW_ARCH_PATH is empty)
#
# Functions provided
# have_fftw, no_fftw, echo_fftw
# have_fftw, no_fftw, echo_fftw, query_fftw
#
# Variables set on success
# HAVE_FFTW
......@@ -38,7 +38,6 @@
no_fftw()
{
unset HAVE_FFTW FFTW_INC_DIR FFTW_LIB_DIR
return 0
}
......@@ -52,19 +51,48 @@ echo_fftw()
}
# Query settings
query_fftw()
{
local config="config.sh/FFTW"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query fftw "$FFTW_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "fftw=unknown"
fi
}
# On success, return 0 and export variables
# -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR
have_fftw()
{
local prefix header library incName libName settings warn
# warn="==> skip fftw"
local warn # warn="==> skip fftw"
local config="config.sh/FFTW"
local settings
# Setup - from the current environment
# Setup - current environment if set
if [ -z "$FFTW_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
prefix="$FFTW_ARCH_PATH"
incName="fftw3.h"
libName="libfftw3"
local prefix="$FFTW_ARCH_PATH"
local incName="fftw3.h"
local libName="libfftw3"
local header library
# ----------------------------------
if isNone "$prefix"
......@@ -111,11 +139,15 @@ have_fftw()
# Reset variables
no_fftw
# Testing
if [ "$1" = "-test" ]
then
# Test/query
case "$1" in
-test)
have_fftw
echo_fftw
fi
;;
-query)
query_fftw
;;
esac
#------------------------------------------------------------------------------
......@@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
# Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# have_hypre
......@@ -19,9 +18,10 @@
#
# Requires
# HYPRE_ARCH_PATH
# or config.sh/hypre
#
# Functions provided
# have_hypre, no_hypre, echo_hypre
# have_hypre, no_hypre, echo_hypre, query_hypre
#
# Variables set on success
# HAVE_HYPRE
......@@ -38,7 +38,6 @@
no_hypre()
{
unset HAVE_HYPRE HYPRE_INC_DIR HYPRE_LIB_DIR
return 0
}
......@@ -52,29 +51,48 @@ echo_hypre()
}
# Query settings
query_hypre()
{
local config="config.sh/hypre"