From 4cf44850a73497a18a14eb79fbc3e8e0b77ac600 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 4 Nov 2020 19:16:13 +0100 Subject: [PATCH] CONFIG: detect newer adios library name (fixes #1911) ENH: provide fallback prefix for cmake detection STYLE: simplify some shell syntax, avoid uname call in sysFunctions STYLE: report FOAM_MPI during mpiLib builds --- wmake/scripts/have_adios2 | 2 ++ wmake/scripts/have_cmake | 25 ++++++++++++------------- wmake/scripts/sysFunctions | 24 ++++++++++++++---------- wmake/scripts/wmakeFunctions | 2 +- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/wmake/scripts/have_adios2 b/wmake/scripts/have_adios2 index 8e76d4fa89..25491fe579 100644 --- a/wmake/scripts/have_adios2 +++ b/wmake/scripts/have_adios2 @@ -75,6 +75,7 @@ search_adios2() local warn # warn="==> skip adios2" local incName="adios2.h" local libName="libadios2" + local libName2="libadios2_cxx11_mpi" local prefix="${1:-system}" local header library @@ -106,6 +107,7 @@ search_adios2() # Library [ -n "$library" ] \ || library=$(findLibrary -prefix="$prefix" -name="$libName") \ + || library=$(findLibrary -prefix="$prefix" -name="$libName2") \ || { [ -n "$warn" ] && echo "$warn (no library)" return 2 diff --git a/wmake/scripts/have_cmake b/wmake/scripts/have_cmake index 9199b0e910..34b568507d 100644 --- a/wmake/scripts/have_cmake +++ b/wmake/scripts/have_cmake @@ -60,16 +60,15 @@ search_cmake() # Treat previous queries as "sticky" if [ -n "$CMAKE_EXE" ] then - test "$CMAKE_EXE" != "false" + [ "$CMAKE_EXE" != "false" ] return $? fi - local prefix="$1" - local candidate foundExe + local prefix="${1:-/usr}" + local candidate="$prefix"/bin/cmake + local foundExe - candidate="$prefix"/bin/cmake - - if [ -d "$prefix" ] && [ -f "$candidate" ] && [ -x "$candidate" ] + if [ -f "$candidate" ] && [ -x "$candidate" ] then foundExe="$candidate" elif candidate="$(command -v cmake 2>/dev/null)" @@ -77,17 +76,17 @@ search_cmake() # Resolved from PATH foundExe="$candidate" fi + # ---------------------------------- - if [ -n "$foundExe" ] + if [ -z "$foundExe" ] then - # OK - export HAVE_CMAKE=true - export CMAKE_EXE="$foundExe" - else - # Failure export CMAKE_EXE="false" # Avoid repeated calls? return 2 fi + + # OK + export HAVE_CMAKE=true + export CMAKE_EXE="$foundExe" } @@ -97,7 +96,7 @@ have_cmake() # Treat previous queries as "sticky" if [ -n "$CMAKE_EXE" ] then - test "$CMAKE_EXE" != "false" + [ "$CMAKE_EXE" != "false" ] return $? fi diff --git a/wmake/scripts/sysFunctions b/wmake/scripts/sysFunctions index fd7aba9642..d5e30f8a13 100644 --- a/wmake/scripts/sysFunctions +++ b/wmake/scripts/sysFunctions @@ -46,18 +46,21 @@ then DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true) fi - # True if OS is Darwin. + # True if OS is . + # Test WM_ARCH for "darwin*" (lowercase) - avoid uname system call isDarwin() { - test Darwin = "$(uname -s 2>/dev/null || true)" + [ "${WM_ARCH#darwin}" != "${WM_ARCH}" ] } - # True if target OS is Windows + # True if target OS is + # Test WM_OSTYPE for or '*windows' (or '*Windows') isWindows() { - test MSwindows = "$WM_OSTYPE" + [ "${WM_OSTYPE%indows}" != "${WM_OSTYPE}" ] } + # Static, dynamic library extensions extLibraries=".a .so" @@ -69,26 +72,27 @@ then extLibraries=".a .dll .dll.a" # including cross-compiling fi + # True if '$1' begins with '/' isAbsdir() { - test "$1" = "/${1#/}" + [ "$1" = "/${1#/}" ] } # True if '$1' begins with '/' and also exists as a directory hasAbsdir() { - test "$1" = "/${1#/}" -a -d "$1" + [ "$1" = "/${1#/}" ] && [ -d "$1" ] } # True if '$1' is an empty string, "none" or ends in "-none" # Eg, - # if isNone "$BOOST_ARCH_PATH" ... + # if isNone "$BOOST_ARCH_PATH" isNone() { - test -z "$1" -o "${1##*-}" = none + [ -z "$1" ] || [ "${1##*-}" = none ] } @@ -97,7 +101,7 @@ then # if isSystem "$BOOST_ARCH_PATH" isSystem() { - test "${1##*-}" = system + [ "${1##*-}" = system ] } @@ -106,7 +110,7 @@ then # equalBaseName "/usr/include/scotch-int32" "scotch-int32" equalBaseName() { - test "${1##*/}" = "${2##*/}" + [ "${1##*/}" = "${2##*/}" ] } diff --git a/wmake/scripts/wmakeFunctions b/wmake/scripts/wmakeFunctions index 89134c835a..d078e2db9a 100644 --- a/wmake/scripts/wmakeFunctions +++ b/wmake/scripts/wmakeFunctions @@ -310,7 +310,7 @@ wmakeLibMpi() sentinel=$(sameDependency "$libName" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@) || \ wclean "$libName" - echo "wmake $targetType $libName (mpi=$WM_MPLIB)" + echo "wmake $targetType $libName (mpi=$WM_MPLIB:$FOAM_MPI)" wmake $targetType "$libName" && \ storeDependency "$sentinel" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@ )