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.
This commit is contained in:
Mark Olesen
2020-04-15 12:45:26 +02:00
parent 4200774d35
commit 06333efd2d
16 changed files with 617 additions and 265 deletions

View File

@ -5,17 +5,17 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2019 OpenCFD Ltd. # Copyright (C) 2017-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# cmakeFunctions # cmakeFunctions
# #
# Description # Description
# Helper functions for CMake # Helper functions for CMake
#
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions . ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
@ -61,6 +61,22 @@ sameDependency()
fi 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 with output suppressed according to WM_QUIET
_cmake() _cmake()
@ -98,7 +114,7 @@ cmakeVersioned()
mkdir -p "$objectsDir" \ mkdir -p "$objectsDir" \
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make) \ && (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make) \
&& echo "$depend" >| "${sentinel:-/dev/null}" && storeDependency "$depend" "$sentinel"
} }
@ -124,7 +140,7 @@ cmakeVersionedInstall()
mkdir -p "$objectsDir" \ mkdir -p "$objectsDir" \
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make install) \ && (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make install) \
&& echo "$depend" >| "${sentinel:-/dev/null}" && storeDependency "$depend" "$sentinel"
} }
@ -151,7 +167,7 @@ wmakeVersioned()
mkdir -p "$objectsDir" \ mkdir -p "$objectsDir" \
&& wmake "$@" \ && wmake "$@" \
&& echo "$depend" >| "${sentinel:-/dev/null}" && storeDependency "$depend" "$sentinel"
} }

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_adios2 # have_adios2
@ -21,7 +20,7 @@
# ADIOS2_ARCH_PATH # ADIOS2_ARCH_PATH
# #
# Functions provided # Functions provided
# have_adios2, no_adios2, echo_adios2, hint_adios2 # have_adios2, no_adios2, echo_adios2, hint_adios2, query_adios2
# #
# Variables set on success # Variables set on success
# HAVE_ADIOS2 # HAVE_ADIOS2
@ -38,7 +37,6 @@
no_adios2() no_adios2()
{ {
unset HAVE_ADIOS2 ADIOS2_INC_DIR ADIOS2_LIB_DIR 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 # On success, return 0 and export variables
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR # -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
have_adios2() have_adios2()
{ {
local prefix header library incName libName settings warn local warn # warn="==> skip adios2"
# warn="==> skip adios2" local config="config.sh/adios2"
local settings
# Setup if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/adios2)
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/adios2 settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$ADIOS2_ARCH_PATH" local prefix="$ADIOS2_ARCH_PATH"
incName="adios2.h" local incName="adios2.h"
libName="libadios2" local libName="libadios2"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -134,11 +150,15 @@ have_adios2()
# Reset variables # Reset variables
no_adios2 no_adios2
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_adios2 have_adios2
echo_adios2 echo_adios2
fi ;;
-query)
query_adios2
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,23 +5,23 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_boost # have_boost
# #
# Description # Description
# Detection/setup of Boost # Detection/setup of BOOST
# #
# Requires # Requires
# BOOST_ARCH_PATH # BOOST_ARCH_PATH
# or config.sh/CGAL (when BOOST_ARCH_PATH is empty)
# #
# Functions provided # Functions provided
# have_boost, no_boost, echo_boost # have_boost, no_boost, echo_boost, query_boost
# #
# Variables set on success # Variables set on success
# HAVE_BOOST # HAVE_BOOST
@ -38,7 +38,6 @@
no_boost() no_boost()
{ {
unset HAVE_BOOST BOOST_INC_DIR BOOST_LIB_DIR 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 # On success, return 0 and export variables
# -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR # -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR
have_boost() have_boost()
{ {
local prefix header library incName libName settings warn local warn # warn="==> skip boost"
# 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 # Expected location, include/library names
prefix="$BOOST_ARCH_PATH" local prefix="$BOOST_ARCH_PATH"
incName="boost/version.hpp" local incName="boost/version.hpp"
libName="libboost_system" local libName="libboost_system"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -113,11 +141,15 @@ have_boost()
# Reset variables # Reset variables
no_boost no_boost
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_boost have_boost
echo_boost echo_boost
fi ;;
-query)
query_boost
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,23 +5,22 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_ccmio # have_ccmio
# #
# Description # Description
# Detection/setup of ccmio # Detection/setup of CCMIO
# #
# Requires # Requires
# config.sh/ccmio # config.sh/ccmio
# #
# Functions provided # Functions provided
# have_ccmio, no_ccmio, echo_ccmio # have_ccmio, no_ccmio, echo_ccmio, query_ccmio
# #
# Variables set on success # Variables set on success
# HAVE_CCMIO # HAVE_CCMIO
@ -38,9 +37,9 @@
no_ccmio() no_ccmio()
{ {
unset HAVE_CCMIO CCMIO_INC_DIR CCMIO_LIB_DIR unset HAVE_CCMIO CCMIO_INC_DIR CCMIO_LIB_DIR
return 0
} }
# Report # Report
echo_ccmio() 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 # On success, return 0 and export variables
# -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR # -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR
have_ccmio() have_ccmio()
{ {
local prefix header library incName libName settings warn local warn="==> skip ccmio"
warn="==> skip ccmio" local config="config.sh/ccmio"
local settings
# Setup if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/ccmio settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
# Expected location, include/library names # Expected location, include/library names
# Link with static libccmio only (fewer issues) # Link with static libccmio only (fewer issues)
prefix="$CCMIO_ARCH_PATH" local prefix="$CCMIO_ARCH_PATH"
incName="libccmio/ccmio.h" local incName="libccmio/ccmio.h"
libName="libccmio.a" local libName="libccmio.a"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -139,11 +156,15 @@ have_ccmio()
# Reset variables # Reset variables
no_ccmio no_ccmio
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_ccmio have_ccmio
echo_ccmio echo_ccmio
fi ;;
-query)
query_ccmio
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_cgal # have_cgal
@ -19,9 +18,10 @@
# #
# Requires # Requires
# CGAL_ARCH_PATH # CGAL_ARCH_PATH
# or config.sh/CGAL (when CGAL_ARCH_PATH is empty)
# #
# Functions provided # Functions provided
# have_cgal, no_cgal, echo_cgal # have_cgal, no_cgal, echo_cgal, query_cgal
# #
# Variables set on success # Variables set on success
# HAVE_CGAL # HAVE_CGAL
@ -38,7 +38,6 @@
no_cgal() no_cgal()
{ {
unset HAVE_CGAL CGAL_INC_DIR CGAL_LIB_DIR 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 # On success, return 0 and export variables
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR # -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
have_cgal() have_cgal()
{ {
local prefix header library incName libName settings warn local warn # warn="==> skip cgal"
# 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 # Expected location, include/library names
prefix="$CGAL_ARCH_PATH" local prefix="$CGAL_ARCH_PATH"
incName="CGAL/version.h" local incName="CGAL/version.h"
libName="libCGAL" local libName="libCGAL"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -113,11 +141,15 @@ have_cgal()
# Reset variables # Reset variables
no_cgal no_cgal
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_cgal have_cgal
echo_cgal echo_cgal
fi ;;
-query)
query_cgal
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_fftw # have_fftw
@ -19,9 +18,10 @@
# #
# Requires # Requires
# FFTW_ARCH_PATH # FFTW_ARCH_PATH
# or config.sh/FFTW (when FFTW_ARCH_PATH is empty)
# #
# Functions provided # Functions provided
# have_fftw, no_fftw, echo_fftw # have_fftw, no_fftw, echo_fftw, query_fftw
# #
# Variables set on success # Variables set on success
# HAVE_FFTW # HAVE_FFTW
@ -38,7 +38,6 @@
no_fftw() no_fftw()
{ {
unset HAVE_FFTW FFTW_INC_DIR FFTW_LIB_DIR 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 # On success, return 0 and export variables
# -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR # -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR
have_fftw() have_fftw()
{ {
local prefix header library incName libName settings warn local warn # warn="==> skip fftw"
# 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 # Expected location, include/library names
prefix="$FFTW_ARCH_PATH" local prefix="$FFTW_ARCH_PATH"
incName="fftw3.h" local incName="fftw3.h"
libName="libfftw3" local libName="libfftw3"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -111,11 +139,15 @@ have_fftw()
# Reset variables # Reset variables
no_fftw no_fftw
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_fftw have_fftw
echo_fftw echo_fftw
fi ;;
-query)
query_fftw
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_hypre # have_hypre
@ -19,9 +18,10 @@
# #
# Requires # Requires
# HYPRE_ARCH_PATH # HYPRE_ARCH_PATH
# or config.sh/hypre
# #
# Functions provided # Functions provided
# have_hypre, no_hypre, echo_hypre # have_hypre, no_hypre, echo_hypre, query_hypre
# #
# Variables set on success # Variables set on success
# HAVE_HYPRE # HAVE_HYPRE
@ -38,7 +38,6 @@
no_hypre() no_hypre()
{ {
unset HAVE_HYPRE HYPRE_INC_DIR HYPRE_LIB_DIR 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"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query hypre "$HYPRE_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "hypre=unknown"
fi
}
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_HYPRE, HYPRE_INC_DIR, HYPRE_LIB_DIR # -> HAVE_HYPRE, HYPRE_INC_DIR, HYPRE_LIB_DIR
have_hypre() have_hypre()
{ {
local prefix header library incName libName settings warn local warn="==> skip hypre"
warn="==> skip hypre" local config="config.sh/hypre"
local settings
# Setup - prefer current environment value? (TDB) # Setup - prefer current environment value? (TDB)
if [ ! -d "$HYPRE_ARCH_PATH" ] if [ ! -d "$HYPRE_ARCH_PATH" ]
then then
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/hypre) if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/hypre settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$HYPRE_ARCH_PATH" local prefix="$HYPRE_ARCH_PATH"
incName="HYPRE.h" local incName="HYPRE.h"
libName="libHYPRE" local libName="libHYPRE"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -121,11 +139,15 @@ have_hypre()
# Reset variables # Reset variables
no_hypre no_hypre
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_hypre have_hypre
echo_hypre echo_hypre
fi ;;
-query)
query_hypre
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_kahip # have_kahip
@ -21,7 +20,7 @@
# config.sh/kahip # config.sh/kahip
# #
# Functions provided # Functions provided
# have_kahip, no_kahip, echo_kahip # have_kahip, no_kahip, echo_kahip, query_kahip
# #
# Variables set on success # Variables set on success
# HAVE_KAHIP # HAVE_KAHIP
@ -39,7 +38,6 @@ no_kahip()
{ {
unset HAVE_KAHIP KAHIP_ARCH_PATH KAHIP_INC_DIR KAHIP_LIB_DIR unset HAVE_KAHIP KAHIP_ARCH_PATH KAHIP_INC_DIR KAHIP_LIB_DIR
unset KAHIP_VERSION unset KAHIP_VERSION
return 0
} }
@ -53,26 +51,44 @@ echo_kahip()
} }
# Query settings
query_kahip()
{
local config="config.sh/kahip"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query kahip "$KAHIP_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "kahip=unknown"
fi
}
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_KAHIP, KAHIP_ARCH_PATH, KAHIP_INC_DIR, KAHIP_LIB_DIR # -> HAVE_KAHIP, KAHIP_ARCH_PATH, KAHIP_INC_DIR, KAHIP_LIB_DIR
have_kahip() have_kahip()
{ {
local prefix header library incName libName settings warn local warn="==> skip kahip"
warn="==> skip kahip" local config="config.sh/kahip"
local settings
# Setup if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/kahip)
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/kahip settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 1 return 1
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$KAHIP_ARCH_PATH" local prefix="$KAHIP_ARCH_PATH"
incName="kaHIP_interface.h" local incName="kaHIP_interface.h"
libName="libkahip" local libName="libkahip"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -122,11 +138,15 @@ have_kahip()
# Reset variables # Reset variables
no_kahip no_kahip
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_kahip have_kahip
echo_kahip echo_kahip
fi ;;
-query)
query_kahip
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,23 +5,22 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_metis # have_metis
# #
# Description # Description
# Detection/setup of metis # Detection/setup of METIS
# #
# Requires # Requires
# config.sh/metis # config.sh/metis
# #
# Functions provided # Functions provided
# have_metis, no_metis, echo_metis # have_metis, no_metis, echo_metis, query_metis
# #
# Variables set on success # Variables set on success
# HAVE_METIS # HAVE_METIS
@ -39,7 +38,6 @@ no_metis()
{ {
unset HAVE_METIS METIS_ARCH_PATH METIS_INC_DIR METIS_LIB_DIR unset HAVE_METIS METIS_ARCH_PATH METIS_INC_DIR METIS_LIB_DIR
unset METIS_VERSION unset METIS_VERSION
return 0
} }
@ -53,26 +51,44 @@ echo_metis()
} }
# Query settings
query_metis()
{
local config="config.sh/metis"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query metis "$METIS_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "metis=unknown"
fi
}
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_METIS, METIS_ARCH_PATH, METIS_INC_DIR, METIS_LIB_DIR # -> HAVE_METIS, METIS_ARCH_PATH, METIS_INC_DIR, METIS_LIB_DIR
have_metis() have_metis()
{ {
local prefix header library incName libName settings warn local warn="==> skip metis"
warn="==> skip metis" local config="config.sh/metis"
local settings
# Setup if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis)
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/metis settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$METIS_ARCH_PATH" local prefix="$METIS_ARCH_PATH"
incName="metis.h" local incName="metis.h"
libName="libmetis" local libName="libmetis"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -129,11 +145,15 @@ have_metis()
# Reset variables # Reset variables
no_metis no_metis
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_metis have_metis
echo_metis echo_metis
fi ;;
-query)
query_metis
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,23 +5,22 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_mgridgen # have_mgridgen
# #
# Description # Description
# Detection/setup of mgridgen # Detection/setup of MGRIDGEN
# #
# Requires # Requires
# config.sh/mgridgen # config.sh/mgridgen
# #
# Functions provided # Functions provided
# have_mgridgen, no_mgridgen, echo_mgridgen # have_mgridgen, no_mgridgen, echo_mgridgen, query_mgridgen
# #
# Variables set on success # Variables set on success
# HAVE_MGRIDGEN # HAVE_MGRIDGEN
@ -39,7 +38,6 @@ no_mgridgen()
{ {
unset HAVE_MGRIDGEN MGRIDGEN_ARCH_PATH MGRIDGEN_INC_DIR MGRIDGEN_LIB_DIR unset HAVE_MGRIDGEN MGRIDGEN_ARCH_PATH MGRIDGEN_INC_DIR MGRIDGEN_LIB_DIR
unset MGRIDGEN_VERSION unset MGRIDGEN_VERSION
return 0
} }
@ -53,27 +51,45 @@ echo_mgridgen()
} }
# Query settings
query_mgridgen()
{
local config="config.sh/mgridgen"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query mgridgen "$MGRIDGEN_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "mgridgen=unknown"
fi
}
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_MGRIDGEN, MGRIDGEN_ARCH_PATH, MGRIDGEN_INC_DIR, MGRIDGEN_LIB_DIR # -> HAVE_MGRIDGEN, MGRIDGEN_ARCH_PATH, MGRIDGEN_INC_DIR, MGRIDGEN_LIB_DIR
have_mgridgen() have_mgridgen()
{ {
local prefix header library incName libName libName2 settings warn local warn="==> skip mgridgen"
warn="==> skip mgridgen" local config="config.sh/mgridgen"
local settings
# Setup if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/mgridgen)
then then
. "$settings" . "$settings"
else else
#silent# [ -n "$warn" ] && echo "$warn (no config.sh/mgridgen settings)" #silent# [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$MGRIDGEN_ARCH_PATH" local prefix="$MGRIDGEN_ARCH_PATH"
incName="mgridgen.h" local incName="mgridgen.h"
libName="libMGridGen" local libName="libMGridGen"
libName2="libmgrid" local libName2="libmgrid"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -110,7 +126,7 @@ have_mgridgen()
# ---------------------------------- # ----------------------------------
local good label scalar local label scalar
# Ensure consistent sizes with OpenFOAM and mgridgen header # Ensure consistent sizes with OpenFOAM and mgridgen header
# Extract typedef for idxtype, realtype # Extract typedef for idxtype, realtype
@ -126,7 +142,6 @@ have_mgridgen()
case "$WM_LABEL_SIZE:$label" in case "$WM_LABEL_SIZE:$label" in
(32:int32_t | 32:int | 64:int64_t | 64:long) (32:int32_t | 32:int | 64:int64_t | 64:long)
good=true
;; ;;
(*) (*)
@ -140,7 +155,6 @@ have_mgridgen()
esac esac
case "$WM_PRECISION_OPTION:$scalar" in case "$WM_PRECISION_OPTION:$scalar" in
(SP:float | SPDP:float | DP:double) (SP:float | SPDP:float | DP:double)
good=true
;; ;;
(*) (*)
@ -166,11 +180,15 @@ have_mgridgen()
# Reset variables # Reset variables
no_mgridgen no_mgridgen
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_mgridgen have_mgridgen
echo_mgridgen echo_mgridgen
fi ;;
-query)
query_mgridgen
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_petsc # have_petsc
@ -19,9 +18,10 @@
# #
# Requires # Requires
# PETSC_ARCH_PATH # PETSC_ARCH_PATH
# or config.sh/petsc
# #
# Functions provided # Functions provided
# have_petsc, no_petsc, echo_petsc, hint_petsc # have_petsc, no_petsc, echo_petsc, hint_petsc, query_petsc
# #
# Variables set on success # Variables set on success
# HAVE_PETSC # HAVE_PETSC
@ -38,7 +38,6 @@
no_petsc() no_petsc()
{ {
unset HAVE_PETSC PETSC_INC_DIR PETSC_LIB_DIR unset HAVE_PETSC PETSC_INC_DIR PETSC_LIB_DIR
return 0
} }
@ -68,30 +67,49 @@ INFORMATION
} }
# Query settings
query_petsc()
{
local config="config.sh/petsc"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query petsc "$PETSC_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "petsc=unknown"
fi
}
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR # -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
have_petsc() have_petsc()
{ {
local prefix header library incName libName pkgName settings warn local warn="==> skip petsc"
warn="==> skip petsc" local config="config.sh/petsc"
local settings
# Setup - prefer current environment value? (TDB) # Setup - prefer current environment value? (TDB)
if [ ! -d "$PETSC_ARCH_PATH" ] if [ ! -d "$PETSC_ARCH_PATH" ]
then then
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/petsc) if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/petsc settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$PETSC_ARCH_PATH" local prefix="$PETSC_ARCH_PATH"
incName="petsc.h" local incName="petsc.h"
libName="libpetsc" local libName="libpetsc"
pkgName="PETSc" local pkgName="PETSc"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -153,11 +171,15 @@ have_petsc()
# Reset variables # Reset variables
no_petsc no_petsc
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_petsc have_petsc
echo_petsc echo_petsc
fi ;;
-query)
query_petsc
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,17 +5,16 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_readline # have_readline
# #
# Description # Description
# Detection/setup of readline # Detection/setup of READLINE
# #
# Requires # Requires
# None # None
@ -37,7 +36,6 @@
no_readline() no_readline()
{ {
unset HAVE_LIBREADLINE READLINE_INC_DIR READLINE_LIB_DIR unset HAVE_LIBREADLINE READLINE_INC_DIR READLINE_LIB_DIR
return 0
} }
@ -54,13 +52,14 @@ echo_readline()
# -> HAVE_LIBREADLINE, READLINE_INC_DIR, READLINE_LIB_DIR # -> HAVE_LIBREADLINE, READLINE_INC_DIR, READLINE_LIB_DIR
have_readline() have_readline()
{ {
local prefix header library incName libName settings warn local warn # warn="==> skip readline"
# warn="==> skip readline" local settings
# Expected location, include/library names # Expected location, include/library names
prefix=system local prefix=system
incName="readline/readline.h" local incName="readline/readline.h"
libName="libreadline" local libName="libreadline"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -108,11 +107,12 @@ have_readline()
# Reset variables # Reset variables
no_readline no_readline
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_readline have_readline
echo_readline echo_readline
fi ;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,23 +5,22 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_scotch # have_scotch
# #
# Description # Description
# Detection/setup of scotch # Detection/setup of SCOTCH
# #
# Requires # Requires
# config.sh/scotch # config.sh/scotch
# #
# Functions provided # Functions provided
# have_scotch, no_scotch, echo_scotch # have_scotch, no_scotch, echo_scotch, query_scotch
# #
# Variables set on success # Variables set on success
# HAVE_SCOTCH # HAVE_SCOTCH
@ -40,7 +39,6 @@ no_scotch()
unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR
unset SCOTCH_VERSION unset SCOTCH_VERSION
unset HAVE_PTSCOTCH PTSCOTCH_ARCH_PATH PTSCOTCH_INC_DIR PTSCOTCH_LIB_DIR unset HAVE_PTSCOTCH PTSCOTCH_ARCH_PATH PTSCOTCH_INC_DIR PTSCOTCH_LIB_DIR
return 0
} }
@ -59,26 +57,45 @@ echo_scotch()
} }
# Query settings
query_scotch()
{
local config="config.sh/scotch"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query scotch "$SCOTCH_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "scotch=unknown"
fi
}
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR # -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR
have_scotch() have_scotch()
{ {
local prefix header library incName libName settings warn local warn="==> skip scotch"
warn="==> skip scotch" local config="config.sh/scotch"
local settings
# Setup if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/scotch settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$SCOTCH_ARCH_PATH" local prefix="$SCOTCH_ARCH_PATH"
incName="scotch.h" local incName="scotch.h"
libName="libscotch" local libName="libscotch"
local localDir="scotch-int$WM_LABEL_SIZE"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -87,13 +104,18 @@ have_scotch()
return 1 return 1
elif hasAbsdir "$prefix" elif hasAbsdir "$prefix"
then then
header=$(findFirstFile "$prefix/include/$incName") header=$(findFirstFile \
"$prefix/include/$localDir/$incName" \
"$prefix/include/$incName" \
)
library=$(findExtLib "$libName") library=$(findExtLib "$libName")
elif isSystem "$prefix" elif isSystem "$prefix"
then then
header=$(findFirstFile \ header=$(findFirstFile \
"/usr/local/include/$localDir/$incName" \
"/usr/local/include/scotch/$incName" \ "/usr/local/include/scotch/$incName" \
"/usr/local/include/$incName" \ "/usr/local/include/$incName" \
"/usr/include/$localDir/$incName" \
"/usr/include/scotch/$incName" \ "/usr/include/scotch/$incName" \
"/usr/include/$incName" \ "/usr/include/$incName" \
) )
@ -102,6 +124,7 @@ have_scotch()
unset prefix unset prefix
fi fi
# ---------------------------------- # ----------------------------------
equalBaseName "${header%/*}" "$localDir" || unset localDir
# Header # Header
[ -n "$header" ] || { [ -n "$header" ] || {
@ -111,7 +134,7 @@ have_scotch()
# Library # Library
[ -n "$library" ] \ [ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \ || library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \
|| { || {
[ -n "$warn" ] && echo "$warn (no library)" [ -n "$warn" ] && echo "$warn (no library)"
return 2 return 2
@ -119,7 +142,7 @@ have_scotch()
# ---------------------------------- # ----------------------------------
local good label local label
# Ensure consistent sizes between OpenFOAM and scotch header # Ensure consistent sizes between OpenFOAM and scotch header
# extract 'typedef int64_t SCOTCH_Num' or equivalent # extract 'typedef int64_t SCOTCH_Num' or equivalent
@ -147,7 +170,6 @@ have_scotch()
case "$WM_LABEL_SIZE:$label" in case "$WM_LABEL_SIZE:$label" in
(32:int32_t | 32:int | 64:int64_t | 64:long) (32:int32_t | 32:int | 64:int64_t | 64:long)
good=true
;; ;;
(*) (*)
@ -176,8 +198,7 @@ have_scotch()
# -> HAVE_PTSCOTCH, PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR # -> HAVE_PTSCOTCH, PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR
have_ptscotch() have_ptscotch()
{ {
local prefix header library incName libName settings warn local warn="==> skip ptscotch"
warn="==> skip ptscotch"
if [ "$HAVE_SCOTCH" != true ] if [ "$HAVE_SCOTCH" != true ]
then then
@ -189,9 +210,11 @@ have_ptscotch()
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH" [ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
# Expected location, include/library names # Expected location, include/library names
prefix="$PTSCOTCH_ARCH_PATH" local prefix="$PTSCOTCH_ARCH_PATH"
incName="ptscotch.h" local incName="ptscotch.h"
libName="libptscotch" local libName="libptscotch"
local localDir="scotch-int$WM_LABEL_SIZE"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -202,25 +225,27 @@ have_ptscotch()
then then
header=$(findFirstFile \ header=$(findFirstFile \
"$prefix/include/$FOAM_MPI/$incName" \ "$prefix/include/$FOAM_MPI/$incName" \
"$prefix/include/$localDir/$incName" \
"$prefix/include/$incName" "$prefix/include/$incName"
) )
library="$(findExtLib $FOAM_MPI/$libName $libName)" library="$(findExtLib $FOAM_MPI/$libName $libName)"
elif isSystem "$prefix" elif isSystem "$prefix"
then then
prefix=/usr
header=$(findFirstFile \ header=$(findFirstFile \
"/usr/local/include/ptscotch/$incName" \ "/usr/local/include/ptscotch/$incName" \
"/usr/local/include/scotch/$incName" \ "/usr/local/include/scotch/$incName" \
"/usr/local/include/$incName" \ "/usr/local/include/$incName" \
"/usr/include/$localDir/$incName" \
"/usr/include/ptscotch/$incName" \ "/usr/include/ptscotch/$incName" \
"/usr/include/scotch/$incName" \ "/usr/include/scotch/$incName" \
"/usr/include/$incName" \ "/usr/include/$incName" \
) )
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac prefix=$(sysPrefix "$header")
else else
unset prefix unset prefix
fi fi
# ---------------------------------- # ----------------------------------
equalBaseName "${header%/*}" "$localDir" || unset localDir
# Header # Header
[ -n "$header" ] || { [ -n "$header" ] || {
@ -230,7 +255,7 @@ have_ptscotch()
# Library # Library
[ -n "$library" ] \ [ -n "$library" ] \
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \ || library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \
|| { || {
[ -n "$warn" ] && echo "$warn (no library)" [ -n "$warn" ] && echo "$warn (no library)"
return 2 return 2
@ -250,11 +275,15 @@ have_ptscotch()
# Reset variables # Reset variables
no_scotch no_scotch
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_scotch && have_ptscotch have_scotch && have_ptscotch
echo_scotch echo_scotch
fi ;;
-query)
query_scotch
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,23 +5,22 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# have_zoltan # have_zoltan
# #
# Description # Description
# Detection/setup of zoltan # Detection/setup of ZOLTAN
# #
# Requires # Requires
# config.sh/zoltan # config.sh/zoltan
# #
# Functions provided # Functions provided
# have_zoltan, no_zoltan, echo_zoltan # have_zoltan, no_zoltan, echo_zoltan, query_zoltan
# #
# Variables set on success # Variables set on success
# HAVE_ZOLTAN # HAVE_ZOLTAN
@ -38,7 +37,6 @@
no_zoltan() no_zoltan()
{ {
unset HAVE_ZOLTAN ZOLTAN_INC_DIR ZOLTAN_LIB_DIR unset HAVE_ZOLTAN ZOLTAN_INC_DIR ZOLTAN_LIB_DIR
return 0
} }
@ -52,26 +50,44 @@ echo_zoltan()
} }
# Query settings
query_zoltan()
{
local config="config.sh/zoltan"
local settings
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
then
. "$settings"
_process_query zoltan "$ZOLTAN_ARCH_PATH"
else
echo "(no $config settings)" 1>&2
echo "zoltan=unknown"
fi
}
# On success, return 0 and export variables # On success, return 0 and export variables
# -> HAVE_ZOLTAN, ZOLTAN_INC_DIR, ZOLTAN_LIB_DIR # -> HAVE_ZOLTAN, ZOLTAN_INC_DIR, ZOLTAN_LIB_DIR
have_zoltan() have_zoltan()
{ {
local prefix header library incName libName settings warn local warn # warn="==> skip zoltan"
# warn="==> skip zoltan" local config="config.sh/zoltan"
local settings
# Setup if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan)
then then
. "$settings" . "$settings"
else else
[ -n "$warn" ] && echo "$warn (no config.sh/zoltan settings)" [ -n "$warn" ] && echo "$warn (no $config settings)"
return 2 return 2
fi fi
# Expected location, include/library names # Expected location, include/library names
prefix="$ZOLTAN_ARCH_PATH" local prefix="$ZOLTAN_ARCH_PATH"
incName="zoltan.h" local incName="zoltan.h"
libName="libzoltan" local libName="libzoltan"
local header library
# ---------------------------------- # ----------------------------------
if isNone "$prefix" if isNone "$prefix"
@ -118,11 +134,15 @@ have_zoltan()
# Reset variables # Reset variables
no_zoltan no_zoltan
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_zoltan have_zoltan
echo_zoltan echo_zoltan
fi ;;
-query)
query_zoltan
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -5,11 +5,10 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# paraviewFunctions # paraviewFunctions
@ -47,7 +46,6 @@ no_paraview()
{ {
unset HAVE_PVPLUGIN_SUPPORT FOAM_PV_PLUGIN_LIBBIN unset HAVE_PVPLUGIN_SUPPORT FOAM_PV_PLUGIN_LIBBIN
unset PARAVIEW_API PARAVIEW_INC_DIR unset PARAVIEW_API PARAVIEW_INC_DIR
return 0
} }
@ -93,15 +91,15 @@ cmakePvInstall()
wmakeLibPv() wmakeLibPv()
{ {
local depend="ParaView_DIR=$ParaView_DIR" local depend="ParaView_DIR=$ParaView_DIR"
local sentinel local sentinel libName
for libName for libName
do do
sentinel=$(sameDependency "$depend" $libName) || \ sentinel=$(sameDependency "$depend" "$libName") || \
wclean $libName wclean $libName
wmake $targetType $libName \ wmake $targetType $libName \
&& echo "$depend" > ${sentinel:-/dev/null} && storeDependency "$depend" "$sentinel"
done done
} }
@ -148,8 +146,8 @@ get_pvplugin_api()
# #
have_pvplugin_support() have_pvplugin_support()
{ {
local header settings warn pv_api installDir binDir includeDir targetDir local warn="==> skip paraview-plugin"
warn="==> skip paraview-plugin" local settings pv_api installDir binDir includeDir targetDir
# Trivial check # Trivial check
command -v cmake >/dev/null || { command -v cmake >/dev/null || {
@ -172,7 +170,7 @@ have_pvplugin_support()
fi fi
# Include/library names # Include/library names
header="pqServerManagerModel.h" local header="pqServerManagerModel.h"
if [ -n "$ParaView_DIR" ] if [ -n "$ParaView_DIR" ]
then then
@ -232,11 +230,15 @@ have_pvplugin_support()
# Force reset of old variables # Force reset of old variables
no_paraview no_paraview
# Testing # Test/query
if [ "$1" = "-test" ] case "$1" in
then -test)
have_pvplugin_support have_pvplugin_support
echo_paraview echo_paraview
fi ;;
-query)
## query_paraview
;;
esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -8,8 +8,7 @@
# Copyright (C) 2018-2020 OpenCFD Ltd. # Copyright (C) 2018-2020 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, licensed under GNU General Public License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
# <http://www.gnu.org/licenses/>.
# #
# Script # Script
# sysFunctions # sysFunctions
@ -40,7 +39,7 @@ then
# Load once, but do not rely on this variable elsewhere # Load once, but do not rely on this variable elsewhere
WMAKE_SCRIPTS_SYSFUNCTIONS=loaded WMAKE_SCRIPTS_SYSFUNCTIONS=loaded
# Handle Debian multi-arch, ignore missing/bad dpkg-architecture. # Debian multi-arch, ignore missing/bad dpkg-architecture.
if [ -z "$DEB_TARGET_MULTIARCH" ] if [ -z "$DEB_TARGET_MULTIARCH" ]
then then
DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true) DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true)
@ -101,6 +100,35 @@ then
} }
# True if '$1' and '$2' have the same directory basename
# Eg,
# equalBaseName "/usr/include/scotch-int32" "scotch-int32"
equalBaseName()
{
test "${1##*/}" = "${2##*/}"
}
# Simple output for -query
# $1 = software
# $2 = setting
_process_query()
{
if isNone "$2"
then
echo "$1=none"
elif isAbsdir "$2" ## not hasAbsdir
then
echo "$1=${2##*/}"
elif isSystem "$2"
then
echo "$1=system"
else
echo "$1=unknown"
fi
}
# Return system prefix (/usr, /usr/local, ...) based on hint provided # Return system prefix (/usr, /usr/local, ...) based on hint provided
# Eg, # Eg,
# sysPrefix "/usr/local/include/fftw3.h" -> "/usr/local" # sysPrefix "/usr/local/include/fftw3.h" -> "/usr/local"
@ -170,15 +198,15 @@ then
# This function has two modes of operation. # This function has two modes of operation.
# #
# 1) Automated search. # 1) Automated search.
# Specify -prefix=dirName -name=libName and search for # Specify -prefix=dirName -name=libName, optionally -local=subdirName
# (lib, lib64, lib/x86_64..) etc. # and search for (lib, lib64, lib/x86_64..) etc.
# #
# 2) Directed search. # 2) Directed search.
# specify the fully qualified names to search on the parameter list # specify the fully qualified names to search on the parameter list
# #
findLibrary() findLibrary()
{ {
local prefixDir searchDir searchName local prefixDir localDir searchDir searchName
local file ext local file ext
searchDir=true searchDir=true
@ -191,6 +219,12 @@ then
shift shift
;; ;;
-local=*)
# Prefix with directory separator
localDir="/${1#*=}"
shift
;;
-name=*) -name=*)
searchName="${1#*=}" searchName="${1#*=}"
shift shift
@ -204,18 +238,30 @@ then
if [ -n "$searchName" ] if [ -n "$searchName" ]
then then
# Automated search # Automated search (eg, lib/ lib64/, lib/x86_64-linux-gnu)
# Eg, lib/ lib64/, lib/x86_64-linux-gnu # but also handle possible local versions (eg, lib/scotch-int32)
: "${prefixDir:=/usr}" # A reasonable default : "${prefixDir:=/usr}" # A reasonable default
[ -d "$prefixDir" ] || return 2 [ -d "$prefixDir" ] || return 2
for searchDir in \ # Local and regular search paths
lib \ set -- \
"${WM_COMPILER_LIB_ARCH:+lib}$WM_COMPILER_LIB_ARCH" \ "lib${localDir}" \
"${DEB_TARGET_MULTIARCH:+lib/}${DEB_TARGET_MULTIARCH}" \ "${WM_COMPILER_LIB_ARCH:+lib${WM_COMPILER_LIB_ARCH}${localDir}}" \
"${DEB_TARGET_MULTIARCH:+lib/${DEB_TARGET_MULTIARCH}${localDir}}" \
"lib" \
"${WM_COMPILER_LIB_ARCH:+lib${WM_COMPILER_LIB_ARCH}}" \
"${DEB_TARGET_MULTIARCH:+lib/${DEB_TARGET_MULTIARCH}}" \
; ;
# Ignore empty local search path ("/")
[ "${#localDir}" -gt 1 ] || shift 3
## echo "search: $# $@" 1>&2
for searchDir in "$@"
do do
[ -n "$searchDir" ] || continue
for ext in '' $extLibraries for ext in '' $extLibraries
do do
file="$prefixDir/$searchDir/$searchName$ext" file="$prefixDir/$searchDir/$searchName$ext"