diff --git a/bin/tools/query-versions b/bin/tools/query-versions new file mode 100755 index 0000000000000000000000000000000000000000..0233d12ede2e163efe294494e76734bc20f9cfa8 --- /dev/null +++ b/bin/tools/query-versions @@ -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 + +#------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_adios2 b/wmake/scripts/have_adios2 index 4397cd8b4116ce08e5324e39aa9ab88e34fd6462..e5503993d6238765e4be160456762cb7835b54b0 100644 --- a/wmake/scripts/have_adios2 +++ b/wmake/scripts/have_adios2 @@ -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 @@ -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 # -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR have_adios2() { + local config="config.sh/adios2" local prefix header library incName libName settings warn # warn="==> skip adios2" # 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 @@ -135,11 +152,15 @@ have_adios2() # Force reset of old variables no_adios2 -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_adios2 echo_adios2 -fi + ;; +-query) + query_adios2 + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_boost b/wmake/scripts/have_boost index aca69a63ed7463958b065041ca81aa07925c71dc..9e9d168ef59a3281973d2717e8be6cd18cca9662 100644 --- a/wmake/scripts/have_boost +++ b/wmake/scripts/have_boost @@ -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_boost # # Description -# Detection/setup of Boost +# Detection/setup of BOOST # # Requires # BOOST_ARCH_PATH # # Functions provided -# have_boost, no_boost, echo_boost +# have_boost, no_boost, echo_boost, query_boost # # Variables set on success # 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 # -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR have_boost() @@ -114,11 +130,15 @@ have_boost() # Force reset of old variables no_boost -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_boost echo_boost -fi + ;; +-query) + query_boost + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_ccmio b/wmake/scripts/have_ccmio index 68e2b2f71869177bf004f3f00143d53ac2418792..c9962fcf0609f96323effb36d5dd6b387e8c7cda 100644 --- a/wmake/scripts/have_ccmio +++ b/wmake/scripts/have_ccmio @@ -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 @@ -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 # -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR have_ccmio() { + local config="config.sh/ccmio" local prefix header library incName libName settings warn warn="==> skip ccmio" - # 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 @@ -140,11 +156,15 @@ have_ccmio() # Force reset of old variables no_ccmio -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_ccmio echo_ccmio -fi + ;; +-query) + query_ccmio + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_cgal b/wmake/scripts/have_cgal index b0a90e7ed2b1219e5ec541abf7f88f9ada0d8494..e4bce0da18caba3ee5193aa4172ca76f64f0834e 100644 --- a/wmake/scripts/have_cgal +++ b/wmake/scripts/have_cgal @@ -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 @@ -21,7 +20,7 @@ # CGAL_ARCH_PATH # # Functions provided -# have_cgal, no_cgal, echo_cgal +# have_cgal, no_cgal, echo_cgal, query_cgal # # Variables set on success # 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 # -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR have_cgal() @@ -114,11 +130,15 @@ have_cgal() # Force reset of old variables no_cgal -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_cgal echo_cgal -fi + ;; +-query) + query_cgal + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_fftw b/wmake/scripts/have_fftw index cfafa54c1e44d95dc0ae96b607f0b78c9c02832d..75f0ce623bd5bedefbc8905e2ddee37dbd5991b0 100644 --- a/wmake/scripts/have_fftw +++ b/wmake/scripts/have_fftw @@ -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 @@ -21,7 +20,7 @@ # FFTW_ARCH_PATH # # Functions provided -# have_fftw, no_fftw, echo_fftw +# have_fftw, no_fftw, echo_fftw, query_fftw # # Variables set on success # 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 # -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR have_fftw() @@ -112,11 +128,15 @@ have_fftw() # Force reset of old variables no_fftw -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_fftw echo_fftw -fi + ;; +-query) + query_fftw + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_hypre b/wmake/scripts/have_hypre index db9f77bbdde9779b070600e5df0ce1148f3662bd..6ab53a8fbb7d1fce2e3888d642a30e9e2976042c 100644 --- a/wmake/scripts/have_hypre +++ b/wmake/scripts/have_hypre @@ -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 @@ -21,7 +20,7 @@ # HYPRE_ARCH_PATH # # Functions provided -# have_hypre, no_hypre, echo_hypre +# have_hypre, no_hypre, echo_hypre, query_hypre # # Variables set on success # 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 # -> HAVE_HYPRE, HYPRE_INC_DIR, HYPRE_LIB_DIR have_hypre() { + local config="config.sh/hypre" local prefix header library incName libName settings warn warn="==> skip hypre" # Setup - prefer current environment value? (TDB) if [ ! -d "$HYPRE_ARCH_PATH" ] then - if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/hypre) + if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$settings" else - [ -n "$warn" ] && echo "$warn (no config.sh/hypre settings)" + [ -n "$warn" ] && echo "$warn (no $config settings)" return 2 fi fi @@ -122,11 +139,15 @@ have_hypre() # Force reset of old variables no_hypre -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_hypre echo_hypre -fi + ;; +-query) + query_hypre + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_kahip b/wmake/scripts/have_kahip index e528d5c100b670207712b1ed5ad296deaa0d9f46..78b0da6d54609fc26b9cf28a15eb87274c41404b 100644 --- a/wmake/scripts/have_kahip +++ b/wmake/scripts/have_kahip @@ -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_kahip @@ -21,7 +20,7 @@ # config.sh/kahip # # Functions provided -# have_kahip, no_kahip, echo_kahip +# have_kahip, no_kahip, echo_kahip, query_kahip # # Variables set on success # 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 # -> HAVE_KAHIP, KAHIP_ARCH_PATH, KAHIP_INC_DIR, KAHIP_LIB_DIR have_kahip() { + local config="config.sh/kahip" local prefix header library incName libName settings warn warn="==> skip kahip" - # Setup - if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/kahip) + if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$settings" else - [ -n "$warn" ] && echo "$warn (no config.sh/kahip settings)" + [ -n "$warn" ] && echo "$warn (no $config settings)" return 1 fi @@ -123,11 +139,15 @@ have_kahip() # Force reset of old variables no_kahip -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_kahip echo_kahip -fi + ;; +-query) + query_kahip + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_metis b/wmake/scripts/have_metis index 373f81079395870e2208e0f7f8c6a5ceb8eca5c0..7f98a420dfa7a0b3d215a5a62c920c6101250ac0 100644 --- a/wmake/scripts/have_metis +++ b/wmake/scripts/have_metis @@ -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_metis # # Description -# Detection/setup of metis +# Detection/setup of METIS # # Requires # config.sh/metis # # Functions provided -# have_metis, no_metis, echo_metis +# have_metis, no_metis, echo_metis, query_metis # # Variables set on success # 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 # -> HAVE_METIS, METIS_ARCH_PATH, METIS_INC_DIR, METIS_LIB_DIR have_metis() { + local config="config.sh/metis" local prefix header library incName libName settings warn warn="==> skip metis" - # Setup - if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis) + if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$settings" else - [ -n "$warn" ] && echo "$warn (no config.sh/metis settings)" + [ -n "$warn" ] && echo "$warn (no $config settings)" return 2 fi @@ -130,11 +146,15 @@ have_metis() # Force reset of old variables no_metis -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_metis echo_metis -fi + ;; +-query) + query_metis + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_mgridgen b/wmake/scripts/have_mgridgen index 4f016c72d2f9010c195ced6cf8cc1f10e857dc9f..f87bd36bde10b6349da7356c9f01c2897a1e8671 100644 --- a/wmake/scripts/have_mgridgen +++ b/wmake/scripts/have_mgridgen @@ -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_mgridgen # # Description -# Detection/setup of mgridgen +# Detection/setup of MGRIDGEN # # Requires # config.sh/mgridgen # # Functions provided -# have_mgridgen, no_mgridgen, echo_mgridgen +# have_mgridgen, no_mgridgen, echo_mgridgen, query_mgridgen # # Variables set on success # 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 # -> HAVE_MGRIDGEN, MGRIDGEN_ARCH_PATH, MGRIDGEN_INC_DIR, MGRIDGEN_LIB_DIR have_mgridgen() { + local config="config.sh/mgridgen" local prefix header library incName libName libName2 settings warn warn="==> skip mgridgen" - # Setup - if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/mgridgen) + if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$settings" else - #silent# [ -n "$warn" ] && echo "$warn (no config.sh/mgridgen settings)" + #silent# [ -n "$warn" ] && echo "$warn (no $config settings)" return 2 fi @@ -168,11 +184,15 @@ have_mgridgen() # Force reset of old variables no_mgridgen -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_mgridgen echo_mgridgen -fi + ;; +-query) + query_mgridgen + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_petsc b/wmake/scripts/have_petsc index 603584011ff61ffd556f5863fb267c8ee03accef..1a6a1d8edcf79285bb637d3b96465c4888d3ee22 100644 --- a/wmake/scripts/have_petsc +++ b/wmake/scripts/have_petsc @@ -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_petsc @@ -21,7 +20,7 @@ # PETSC_ARCH_PATH # # Functions provided -# have_petsc, no_petsc, echo_petsc, hint_petsc +# have_petsc, no_petsc, echo_petsc, hint_petsc, query_petsc # # Variables set on success # 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 # -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR have_petsc() { + local config="config.sh/petsc" local prefix header library incName libName pkgName settings warn warn="==> skip petsc" # Setup - prefer current environment value? (TDB) if [ ! -d "$PETSC_ARCH_PATH" ] then - if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/petsc) + if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$settings" else - [ -n "$warn" ] && echo "$warn (no config.sh/petsc settings)" + [ -n "$warn" ] && echo "$warn (no $config settings)" return 2 fi fi @@ -154,11 +171,15 @@ have_petsc() # Force reset of old variables no_petsc -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_petsc echo_petsc -fi + ;; +-query) + query_petsc + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_readline b/wmake/scripts/have_readline index 21a258bc0487dabaa8ee6da91ea8790b42bfffe2..2e6aec3ae8f1e3105555b1e4dc9c3f6d7beef944 100644 --- a/wmake/scripts/have_readline +++ b/wmake/scripts/have_readline @@ -5,17 +5,16 @@ # \\ / 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_readline # # Description -# Detection/setup of readline +# Detection/setup of READLINE # # Requires # None @@ -109,11 +108,12 @@ have_readline() # Force reset of old variables no_readline -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_readline echo_readline -fi + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_scotch b/wmake/scripts/have_scotch index 78460c8096a8e00e35415658151a7eff999b9eb5..bb830fd9043b1774e616e533524f7c0932e286cd 100644 --- a/wmake/scripts/have_scotch +++ b/wmake/scripts/have_scotch @@ -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_scotch # # Description -# Detection/setup of scotch +# Detection/setup of SCOTCH # # Requires # config.sh/scotch # # Functions provided -# have_scotch, no_scotch, echo_scotch +# have_scotch, no_scotch, echo_scotch, query_scotch # # Variables set on success # 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 # -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR have_scotch() { + local config="config.sh/scotch" local prefix header library incName libName settings warn warn="==> skip scotch" - # Setup - if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch) + if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$settings" else - [ -n "$warn" ] && echo "$warn (no config.sh/scotch settings)" + [ -n "$warn" ] && echo "$warn (no $config settings)" return 2 fi @@ -252,11 +268,15 @@ have_ptscotch() # Force reset of old variables no_scotch -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_scotch && have_ptscotch echo_scotch -fi + ;; +-query) + query_scotch + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_zoltan b/wmake/scripts/have_zoltan index 681abd2bea2e6b10ccd96a9f9fa6c6ef3bfae689..2ae42024c32bce57c1b92b5d7f75b6ef5f97276c 100644 --- a/wmake/scripts/have_zoltan +++ b/wmake/scripts/have_zoltan @@ -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_zoltan # # Description -# Detection/setup of zoltan +# Detection/setup of ZOLTAN # # Requires # config.sh/zoltan # # Functions provided -# have_zoltan, no_zoltan, echo_zoltan +# have_zoltan, no_zoltan, echo_zoltan, query_zoltan # # Variables set on success # 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 # -> HAVE_ZOLTAN, ZOLTAN_INC_DIR, ZOLTAN_LIB_DIR have_zoltan() { + local config="config.sh/zoltan" local prefix header library incName libName settings warn # warn="==> skip zoltan" - # Setup - if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan) + if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$settings" else - [ -n "$warn" ] && echo "$warn (no config.sh/zoltan settings)" + [ -n "$warn" ] && echo "$warn (no $config settings)" return 2 fi @@ -119,11 +135,15 @@ have_zoltan() # Force reset of old variables no_zoltan -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_zoltan echo_zoltan -fi + ;; +-query) + query_zoltan + ;; +esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/paraviewFunctions b/wmake/scripts/paraviewFunctions index 1df8e7945af64b68e86c58f4f84e68d2936440a8..d2bca93c3ff2bccf9914700ac67dfccb62b68946 100644 --- a/wmake/scripts/paraviewFunctions +++ b/wmake/scripts/paraviewFunctions @@ -8,8 +8,7 @@ # 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 # paraviewFunctions @@ -232,11 +231,16 @@ have_pvplugin_support() # Force reset of old variables no_paraview -# Testing -if [ "$1" = "-test" ] -then +# Test/query +case "$1" in +-test) have_pvplugin_support echo_paraview + ;; +-query) + ## query_paraview + ;; +esac fi #------------------------------------------------------------------------------ diff --git a/wmake/scripts/sysFunctions b/wmake/scripts/sysFunctions index 606d958966209196a94760a40e30e67146208494..a0c3daecb6a778421a2561c5cd6aa11c3a895f60 100644 --- a/wmake/scripts/sysFunctions +++ b/wmake/scripts/sysFunctions @@ -8,8 +8,7 @@ # Copyright (C) 2018-2019 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 # 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 # Eg, # sysPrefix "/usr/local/include/fftw3.h" -> "/usr/local"