Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Mark Olesen 2017-07-20 12:17:26 +02:00
commit 751f11089a
41 changed files with 45 additions and 20 deletions

View File

@ -8,12 +8,17 @@ cd ${0%/*} || exit 1 # Run from this directory
export FOAM_EXT_LIBBIN
# Check for the existence of any of the files
hasAnyFile()
# On success, echoes the file found and returns 0, otherwise returns 2
findFirstFile()
{
local file
for file
do
[ -f "$file" -a -r "$file" ] && return 0
if [ -f "$file" -a -r "$file" ]
then
echo "$file"
return 0
fi
done
return 2
@ -25,6 +30,7 @@ hasAnyFile()
hasMetis()
{
local warning="==> skip metis"
local header label settings
unset METIS_ARCH_PATH METIS_VERSION
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis) || {
@ -40,31 +46,30 @@ hasMetis()
fi
# Header
local header=$METIS_ARCH_PATH/include/metis.h
if [ "${METIS_ARCH_PATH##*-}" = system ]
then
[ -f "$header" ] || header=/usr/include/metis.h
fi
[ -f "$header" ] || {
header=$(findFirstFile \
$METIS_ARCH_PATH/include/metis.h \
/usr/include/metis.h \
) || {
echo "$warning (no header)"
return 2 # file not found
}
# Library
hasAnyFile \
[ "${METIS_ARCH_PATH##*-}" = system ] || \
findFirstFile \
$FOAM_EXT_LIBBIN/libmetis.so \
$METIS_ARCH_PATH/lib/libmetis.a \
$METIS_ARCH_PATH/lib/libmetis.so \
$METIS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmetis.a \
$METIS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libmetis.so \
|| [ "${METIS_ARCH_PATH##*-}" = system ] || {
> /dev/null || {
echo "$warning (missing library)"
return 2
}
# Ensure consistent sizes between OpenFOAM and metis header
# Extract IDXTYPEWIDTH from metis.h: regex as per ThirdParty Allwmake
local label=$(sed -ne 's/^.*#define *IDXTYPEWIDTH *\([1-9][0-9]\).*/\1/p' $header)
label=$(sed -ne 's/^.*#define *IDXTYPEWIDTH *\([1-9][0-9]\).*/\1/p' $header)
: ${label:=unknown}
if [ "$WM_LABEL_SIZE" = "$label" ]
@ -83,6 +88,7 @@ hasMetis()
hasScotch()
{
local warning="==> skip scotch"
local header label settings
unset SCOTCH_ARCH_PATH SCOTCH_VERSION
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch) || {
@ -98,36 +104,54 @@ hasScotch()
fi
# Header
local header=$SCOTCH_ARCH_PATH/include/scotch.h
if [ "${SCOTCH_ARCH_PATH##*-}" = system ]
then
[ -f "$header" ] || header=/usr/include/scotch.h
fi
[ -f "$header" ] || {
header=$(findFirstFile \
$SCOTCH_ARCH_PATH/include/scotch.h \
/usr/include/scotch/scotch.h \
/usr/include/scotch.h
) || {
echo "$warning (no header)"
return 2 # file not found
}
# Library
hasAnyFile \
[ "${SCOTCH_ARCH_PATH##*-}" = system ] || \
findFirstFile \
$FOAM_EXT_LIBBIN/libscotch.so \
$SCOTCH_ARCH_PATH/lib/libscotch.a \
$SCOTCH_ARCH_PATH/lib/libscotch.so \
$SCOTCH_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libscotch.a \
$SCOTCH_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libscotch.so \
|| [ "${SCOTCH_ARCH_PATH##*-}" = system ] || {
> /dev/null || {
echo "$warning (missing library)"
return 2
}
# Ensure consistent sizes between OpenFOAM and scotch header
# extract 'typedef int64_t SCOTCH_Num' or equivalent
local label=$(sed -ne \
label=$(sed -ne \
's/^.*typedef *\([^ ]*\) *SCOTCH_Num.*/\1/ip' \
"$header")
: ${label:=unknown}
# No SCOTCH_VERSION set? Try to obtain from header
# extract #define SCOTCH_VERSION, SCOTCH_RELEASE, SCOTCH_PATCHLEVEL
[ -n "$SCOTCH_VERSION" ] || \
SCOTCH_VERSION=$(
eval $(
sed -ne \
's/^ *#define *SCOTCH_\(VERSION\|RELEASE\|PATCHLEVEL\) *\([0-9][0-9]*\).*$/\1=\2/p' \
"$header"
)
set -- $VERSION $RELEASE $PATCHLEVEL
IFS="."
[ "$#" -gt 0 ] && echo "scotch-$*"
)
# Failsafe value
: ${SCOTCH_VERSION:=scotch}
case "$WM_LABEL_SIZE:$label" in
(32:int32_t | 32:int | 64:int64_t | 64:long)
echo "Scotch (label=$label) - $SCOTCH_ARCH_PATH"
@ -187,4 +211,5 @@ fi
wmake $targetType decompositionMethods
wmake $targetType decompose
#------------------------------------------------------------------------------