diff --git a/etc/config.csh/adios2 b/etc/config.csh/adios2 index 9fa155c6f7797956477fe26859909273f9582648..85e7e80e51a22e6dbd062776ac8ee42440296986 100644 --- a/etc/config.csh/adios2 +++ b/etc/config.csh/adios2 @@ -5,11 +5,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017-2018 OpenCFD Ltd. +# Copyright (C) 2017-2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License -# This file is part of OpenFOAM, licensed under GNU General Public License -# <http://www.gnu.org/licenses/>. +# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # File # etc/config.csh/adios2 @@ -22,7 +21,7 @@ # USER EDITABLE PART: Changes made here may be lost with the next upgrade set adios2_version=ADIOS2-2.4.0 -setenv ADIOS2_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version +setenv ADIOS2_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version" # END OF (NORMAL) USER EDITABLE PART #------------------------------------------------------------------------------ diff --git a/etc/config.csh/hypre b/etc/config.csh/hypre index 7f509d1cbcbca7a579f11e7fe4a9b24b9d904df6..c3724f918013f7d00a7e1d90b6205e94b5259297 100644 --- a/etc/config.csh/hypre +++ b/etc/config.csh/hypre @@ -5,11 +5,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2018 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. # # File # etc/config.csh/hypre @@ -31,8 +30,8 @@ #------------------------------------------------------------------------------ # USER EDITABLE PART: Changes made here may be lost with the next upgrade -set hypre_version=hypre-2.11.2 -setenv HYPRE_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version +set hypre_version=hypre-2.19.0 +setenv HYPRE_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version" # END OF (NORMAL) USER EDITABLE PART #------------------------------------------------------------------------------ diff --git a/etc/config.sh/adios2 b/etc/config.sh/adios2 index 3840a1ad4a533eb4c46cb3cd4f9797d4001f2bed..0b15b2a5fd344a7b9b4c71e4366cd7f8fb1a682d 100644 --- a/etc/config.sh/adios2 +++ b/etc/config.sh/adios2 @@ -5,11 +5,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2017-2018 OpenCFD Ltd. +# Copyright (C) 2017-2020 OpenCFD Ltd. #------------------------------------------------------------------------------ # License -# This file is part of OpenFOAM, licensed under GNU General Public License -# <http://www.gnu.org/licenses/>. +# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # # File # etc/config.sh/adios2 @@ -23,7 +22,7 @@ # USER EDITABLE PART: Changes made here may be lost with the next upgrade adios2_version=ADIOS2-2.4.0 -export ADIOS2_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version +export ADIOS2_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version" # END OF (NORMAL) USER EDITABLE PART #------------------------------------------------------------------------------ @@ -51,7 +50,10 @@ then if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $ADIOS2_ARCH_PATH 2>/dev/null)" then eval "$output" - PATH="$ADIOS2_ARCH_PATH/bin:$PATH" + if [ -d "$ADIOS2_ARCH_PATH/bin" ] + then + PATH="$ADIOS2_ARCH_PATH/bin:$PATH" + fi fi unset adios2_version output diff --git a/etc/config.sh/hypre b/etc/config.sh/hypre index dd0788c6d32d3e5bc16dde905218e964d45579bd..e401b48247dc9844c38ba930cbee5a4347bd80c8 100644 --- a/etc/config.sh/hypre +++ b/etc/config.sh/hypre @@ -5,11 +5,10 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2018 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. # # File # etc/config.sh/hypre @@ -28,8 +27,8 @@ #------------------------------------------------------------------------------ # USER EDITABLE PART: Changes made here may be lost with the next upgrade -hypre_version=hypre-2.11.2 -export HYPRE_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version +hypre_version=hypre-2.19.0 +export HYPRE_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version" # END OF (NORMAL) USER EDITABLE PART #------------------------------------------------------------------------------ @@ -41,10 +40,22 @@ fi if command -v _foamAddLibAuto >/dev/null then # Normal sourcing (not makeHYPRE) + _foamAddLibAuto $HYPRE_ARCH_PATH unset hypre_version +elif [ "$1" = "-force" ] +then + # Forced command-line sourcing + + if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $HYPRE_ARCH_PATH 2>/dev/null)" + then + eval "$output" + fi + + unset hypre_version output fi + #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_adios2 b/wmake/scripts/have_adios2 index 2283006b4d716fb570ff06ac44f0dba4c8564031..8e76d4fa890d6a682dcc7d687d80965b9df108dd 100644 --- a/wmake/scripts/have_adios2 +++ b/wmake/scripts/have_adios2 @@ -56,9 +56,7 @@ hint_adios2() { /bin/cat<<INFORMATION 1>&2 ==> adios2 not found? - -Enable in the OpenFOAM etc/bashrc, define manually or try with the -following (POSIX shell): +Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]: eval \$(foamEtcFile -sh -config adios2 -- -force) @@ -173,6 +171,9 @@ case "$1" in -query) query_adios2 ;; +-hint) + hint_adios2 + ;; esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_hypre b/wmake/scripts/have_hypre index bfe4c9a76633beee5b2afe6cd567f9448b9908c6..70f60a78c01fa043e4d0c606aa86c7de47b87ddb 100644 --- a/wmake/scripts/have_hypre +++ b/wmake/scripts/have_hypre @@ -22,6 +22,7 @@ # # Functions provided # have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre +# hint_hypre # # Variables set on success # HAVE_HYPRE @@ -51,6 +52,20 @@ echo_hypre() } +# Hint for enabling +hint_hypre() +{ + /bin/cat<<INFORMATION 1>&2 +==> hypre not found? +Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]: + + eval \$(foamEtcFile -sh -config hypre -- -force) + +== +INFORMATION +} + + # Search # $1 : prefix (*_ARCH_PATH, system, ...) # @@ -114,9 +129,12 @@ have_hypre() local config="config.sh/hypre" local file - # Setup - prefer current environment value? (TDB) - if [ ! -d "$HYPRE_ARCH_PATH" ] + # Setup - prefer current environment value + if [ -d "$HYPRE_ARCH_PATH" ] || [ "$HYPRE_ARCH_PATH" = system ] then + : + else + # Use config file if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$file" @@ -161,6 +179,9 @@ case "$1" in -query) query_hypre ;; +-hint) + hint_hypre + ;; esac #------------------------------------------------------------------------------ diff --git a/wmake/scripts/have_petsc b/wmake/scripts/have_petsc index 2524523c75a34f2d9a66ff393622708d0b428f01..dd5edc0c01fcb1a1a18a0b4b7e82e237610932a1 100644 --- a/wmake/scripts/have_petsc +++ b/wmake/scripts/have_petsc @@ -18,6 +18,7 @@ # # Requires # PETSC_ARCH_PATH +# or PETSC_DIR, PETSC_ARCH # or config.sh/petsc # # Functions provided @@ -57,9 +58,7 @@ hint_petsc() { /bin/cat<<INFORMATION 1>&2 ==> petsc not found? - -Enable in the OpenFOAM etc/bashrc, define manually or try with the -following (POSIX shell): +Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]: eval \$(foamEtcFile -sh -config petsc -- -force) @@ -71,7 +70,16 @@ INFORMATION # On success, return 0 and export variables # -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR # -# $1 = prefix (eg, PETSC_ARCH_PATH) +# $1 = prefix (eg, PETSC_DIR, PETSC_ARCH_PATH) +# $2 = [arch] (eg, PETSC_ARCH) +# +# Gets ugly with in-source installation. +# 1) In the simple case, petsc is installed with --prefix +# we find PREFIX/{include,lib} +# +# 2) With in-source installation, +# headers in PETSC_DIR/include and PETSC_DIR/PETSC_ARCH/include +# library is PETSC_DIR/PETSC_ARCH/lib* search_petsc() { local warn="==> skip petsc" @@ -80,7 +88,8 @@ search_petsc() local pkgName="PETSc" local prefix="${1:-system}" - local header library + local arch="$2" + local header library includeDirs libraryDirs # ---------------------------------- if isNone "$prefix" @@ -99,34 +108,56 @@ search_petsc() # No system header, attempt discovery with pkg-config if [ -z "$header" ] && pkg-config --exists "$pkgName" 2>/dev/null then - header=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//') - library=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//') + includeDirs=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;') + libraryDirs=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;') - prefix="${header%/*}" # Basename - - # Artifically adjust names (for later) - [ -n "$header" ] && header="$header/$incName" - [ -n "$library" ] && library="$library/$libName" + prefix="${includeDirs% *}" # First entry (ie, split on space) + prefix="${prefix%/*}" # Basename fi else unset prefix fi # ---------------------------------- - # Header - [ -n "$header" ] || { - [ -n "$warn" ] && echo "$warn (no header)" - return 2 - } + # Header -> directory + if [ -z "$includeDirs" ] + then + includeDirs="${header%/*}" # Basename + + # Header + [ -n "$header" ] || { + [ -n "$warn" ] && echo "$warn (no header)" + return 2 + } + fi + + # Library -> directory + if [ -z "$libraryDirs" ] + then + if [ -n "$arch" ] && [ -d "$prefix/$arch" ] + then + # Prepend with petsc-arch/include + if [ -d "$prefix/$arch/include" ] + then + includeDirs="$prefix/$arch/include${includeDirs:+ }$includeDirs" + fi + + # Prefer with petsc-arch/lib + if [ -z "$library" ] + then + library=$(findLibrary -prefix="$prefix/$arch" -name="$libName") + fi + fi - # Library - [ -n "$library" ] \ - || library=$(findLibrary -prefix="$prefix" -name="$libName") \ - || { - [ -n "$warn" ] && echo "$warn (no library)" - return 2 - } + [ -n "$library" ] \ + || library=$(findLibrary -prefix="$prefix" -name="$libName") \ + || { + [ -n "$warn" ] && echo "$warn (no library)" + return 2 + } + libraryDirs="${library%/*}" # Basename + fi # ---------------------------------- # TODO: check size of petsc integer vs label, real vs double? @@ -134,8 +165,8 @@ search_petsc() # OK export HAVE_PETSC=true export PETSC_ARCH_PATH="$prefix" - export PETSC_INC_DIR="${header%/*}" # Basename - export PETSC_LIB_DIR="${library%/*}" # Basename + export PETSC_INC_DIR="$includeDirs" + export PETSC_LIB_DIR="$libraryDirs" } @@ -147,9 +178,19 @@ have_petsc() local config="config.sh/petsc" local file - # Setup - prefer current environment value? (TDB) - if [ ! -d "$PETSC_ARCH_PATH" ] + # Setup - prefer current environment value + if [ -d "$PETSC_ARCH_PATH" ] || [ "$PETSC_ARCH_PATH" = system ] + then + # OpenFOAM prefix naming, possibly with petsc-arch + search_petsc "$PETSC_ARCH_PATH" $PETSC_ARCH + + elif [ -d "$PETSC_DIR" ] then + # petsc-dir, petsc-arch naming + search_petsc "$PETSC_DIR" $PETSC_ARCH + + else + # Use config file if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")" then . "$file" @@ -157,9 +198,8 @@ have_petsc() [ -n "$warn" ] && echo "$warn (no $config)" return 2 fi + search_petsc "$PETSC_ARCH_PATH" fi - - search_petsc "$PETSC_ARCH_PATH" } @@ -194,6 +234,9 @@ case "$1" in -query) query_petsc ;; +-hint) + hint_petsc + ;; esac #------------------------------------------------------------------------------