CONFIG: bin/tools/query-versions

- Query the etc/config.sh values for ThirdParty software.
  Usable without an active OpenFOAM environment.
This commit is contained in:
Mark Olesen
2020-02-07 16:28:53 +01:00
parent 739bc3c4af
commit 553c01d52e
16 changed files with 516 additions and 141 deletions

109
bin/tools/query-versions Executable file
View File

@ -0,0 +1,109 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# query-versions
#
# Description
# Query (ThirdParty) versions based on their etc/config.sh values
# Executes their respective -query.
#
# TODO
# cmake, vtk, paraview
#
#------------------------------------------------------------------------------
# Hard-coded value (eg, with autoconfig)
projectDir="@PROJECT_DIR@"
if [ -z "$projectDir" ] || [ "${projectDir#@}" != "$projectDir" ]
then
# Auto-detect from location
toolsDir="${0%/*}" # The bin/tools dir
projectDir="${toolsDir%/bin/tools}" # Project dir
case "$projectDir" in
(/bin | /usr/bin | /usr/local/bin)
# This shouldn't happen.
# If copied to a system dir, should also be using hard-coded values!
echo "Warning: suspicious looking project dir: $projectDir" 1>&2
;;
("$toolsDir")
# Eg, called as ./openfoam etc - need to try harder
projectDir="$(\cd $(dirname $0)/../.. && \pwd -L)" || unset projectDir
;;
esac
fi
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
Usage: ${0##*/} [OPTION]
options:
-h, -help Print the usage
Query (ThirdParty) versions based on their etc/config.sh values.
Uses OpenFOAM wmake/scripts/have_* scripts.
USAGE
exit 1
}
#------------------------------------------------------------------------------
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
# Print help
(-h | -help*)
usage
;;
(*)
echo "Ignore unknown option/argument: $@" 1>&2
break
;;
esac
shift
done
#------------------------------------------------------------------------------
scriptsDir="$projectDir/wmake/scripts"
[ -d "$scriptsDir" ] || {
echo "No such directory: $scriptsDir" 1>&2
exit 2
}
# Allow operation without an active OpenFOAM environment
export WM_PROJECT_DIR="$projectDir"
#------------------------------------------------------------------------------
# Examine the "wmake/scripts/have_..." scripts for query_...() functions,
# assume they also have a -query option
for script in grep -l -e '^query_' "$scriptsDir"/have_*
do
if [ -f "$script" ]
then
bash "$script" -query
fi
done
#------------------------------------------------------------------------------

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
@ -68,19 +67,37 @@ 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 config="config.sh/adios2"
local prefix header library incName libName settings warn local prefix header library incName libName settings warn
# warn="==> skip adios2" # warn="==> skip adios2"
# Setup # Setup
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/adios2) if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
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
@ -135,11 +152,15 @@ have_adios2()
# Force reset of old variables # Force reset of old 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,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_boost # have_boost
# #
# Description # Description
# Detection/setup of Boost # Detection/setup of BOOST
# #
# Requires # Requires
# BOOST_ARCH_PATH # BOOST_ARCH_PATH
# #
# 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
@ -52,6 +51,23 @@ 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()
@ -114,11 +130,15 @@ have_boost()
# Force reset of old variables # Force reset of old 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
@ -51,19 +50,36 @@ 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 config="config.sh/ccmio"
local prefix header library incName libName settings warn local prefix header library incName libName settings warn
warn="==> skip ccmio" warn="==> skip ccmio"
# 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
@ -140,11 +156,15 @@ have_ccmio()
# Force reset of old variables # Force reset of old 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
@ -21,7 +20,7 @@
# CGAL_ARCH_PATH # CGAL_ARCH_PATH
# #
# 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
@ -52,6 +51,23 @@ 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()
@ -114,11 +130,15 @@ have_cgal()
# Force reset of old variables # Force reset of old 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
@ -21,7 +20,7 @@
# FFTW_ARCH_PATH # FFTW_ARCH_PATH
# #
# 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
@ -52,6 +51,23 @@ 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()
@ -112,11 +128,15 @@ have_fftw()
# Force reset of old variables # Force reset of old 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
@ -21,7 +20,7 @@
# HYPRE_ARCH_PATH # HYPRE_ARCH_PATH
# #
# 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
@ -52,21 +51,39 @@ 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 config="config.sh/hypre"
local prefix header library incName libName settings warn local prefix header library incName libName settings warn
warn="==> skip hypre" warn="==> skip hypre"
# 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
@ -122,11 +139,15 @@ have_hypre()
# Force reset of old variables # Force reset of old 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
@ -53,19 +52,36 @@ 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 config="config.sh/kahip"
local prefix header library incName libName settings warn local prefix header library incName libName settings warn
warn="==> skip kahip" warn="==> skip kahip"
# 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
@ -123,11 +139,15 @@ have_kahip()
# Force reset of old variables # Force reset of old 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
@ -53,19 +52,36 @@ 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 config="config.sh/metis"
local prefix header library incName libName settings warn local prefix header library incName libName settings warn
warn="==> skip metis" warn="==> skip metis"
# 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
@ -130,11 +146,15 @@ have_metis()
# Force reset of old variables # Force reset of old 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
@ -53,19 +52,36 @@ 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 config="config.sh/mgridgen"
local prefix header library incName libName libName2 settings warn local prefix header library incName libName libName2 settings warn
warn="==> skip mgridgen" warn="==> skip mgridgen"
# 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
@ -168,11 +184,15 @@ have_mgridgen()
# Force reset of old variables # Force reset of old 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
@ -21,7 +20,7 @@
# PETSC_ARCH_PATH # PETSC_ARCH_PATH
# #
# 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
@ -68,21 +67,39 @@ 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 config="config.sh/petsc"
local prefix header library incName libName pkgName settings warn local prefix header library incName libName pkgName settings warn
warn="==> skip petsc" warn="==> skip petsc"
# 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
@ -154,11 +171,15 @@ have_petsc()
# Force reset of old variables # Force reset of old 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
@ -109,11 +108,12 @@ have_readline()
# Force reset of old variables # Force reset of old 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
@ -59,19 +58,36 @@ 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 config="config.sh/scotch"
local prefix header library incName libName settings warn local prefix header library incName libName settings warn
warn="==> skip scotch" warn="==> skip scotch"
# 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
@ -252,11 +268,15 @@ have_ptscotch()
# Force reset of old variables # Force reset of old 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
@ -52,19 +51,36 @@ 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 config="config.sh/zoltan"
local prefix header library incName libName settings warn local prefix header library incName libName settings warn
# warn="==> skip zoltan" # warn="==> skip zoltan"
# 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
@ -119,11 +135,15 @@ have_zoltan()
# Force reset of old variables # Force reset of old 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

@ -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
# paraviewFunctions # paraviewFunctions
@ -232,11 +231,16 @@ 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
;;
-query)
## query_paraview
;;
esac
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -8,8 +8,7 @@
# Copyright (C) 2018-2019 OpenCFD Ltd. # Copyright (C) 2018-2019 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
@ -91,6 +90,26 @@ then
} }
# 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"