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
# \\/ 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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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"