ENH: wmake have_* script changes

- use local 'prefix' variable for easier override and more consistency
This commit is contained in:
Mark Olesen
2019-01-10 20:14:46 +01:00
parent abf6d57ae8
commit fcf4c5fb22
15 changed files with 458 additions and 481 deletions

View File

@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
@ -54,59 +54,53 @@ echo_adios2()
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
have_adios2()
{
local header library static label settings warn
local prefix header library static settings warn
# warn="==> skip adios2"
# Basic setup/checks
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS2) || {
[ -n "$warn" ] && echo "$warn (no config.sh/ADIOS2 settings)"
return 1
}
. $settings
if isNone "$ADIOS2_ARCH_PATH"
# Setup
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS2)
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no config.sh/ADIOS2 settings)"
return 2
fi
# Location
prefix="$ADIOS2_ARCH_PATH"
# Header/library names
header="adios2.h"
library="libadios2$extLibso"
if hasAbsdir "$ADIOS2_ARCH_PATH"
# ----------------------------------
if isNone "$prefix"
then
header=$(findFirstFile $ADIOS2_ARCH_PATH/include/$header)
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile "$prefix/include/$header")
library=$(findFirstFile \
"$(thirdExtLib $library)" \
$ADIOS2_ARCH_PATH/lib/$library \
$ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
elif isSystem "$ADIOS2_ARCH_PATH"
elif isSystem "$prefix"
then
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
prefix=/usr
header=$(findFirstFile "/usr/local/include/$header" "/usr/include/$header")
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
esac
library=$(findFirstFile \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
else
unset header library
unset prefix header library
fi
# ----------------------------------
# Header found?
[ -n "$header" ] || {
@ -116,14 +110,15 @@ have_adios2()
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
header="${header%/*}" # Strip one-level (include/adios2/...)
header="${header%/*}" # Strip one-level (include/adios2/...)
# OK
export HAVE_ADIOS2=true
export ADIOS2_ARCH_PATH
export ADIOS2_ARCH_PATH="$prefix"
export ADIOS2_INC_DIR="${header%/*}" # Basename
export ADIOS2_LIB_DIR="${library%/*}" # Basename
}