mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: wmake have_* script changes
- use local 'prefix' variable for easier override and more consistency
This commit is contained in:
@ -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
|
||||
@ -55,67 +55,64 @@ echo_scotch()
|
||||
# -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR
|
||||
have_scotch()
|
||||
{
|
||||
local header library static label settings warn
|
||||
local prefix header library static settings warn
|
||||
warn="==> skip scotch"
|
||||
|
||||
# Basic setup/checks
|
||||
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch) || {
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/scotch settings)"
|
||||
return 1
|
||||
}
|
||||
. $settings
|
||||
if isNone "$SCOTCH_ARCH_PATH"
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
|
||||
then
|
||||
[ -n "$warn" ] && echo "$warn (not available)"
|
||||
return 1
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/scotch settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Location
|
||||
prefix="$SCOTCH_ARCH_PATH"
|
||||
|
||||
# Header/library names
|
||||
header="scotch.h"
|
||||
library="libscotch$extLibso"
|
||||
static="libscotch$extLiba"
|
||||
|
||||
|
||||
if hasAbsdir "$SCOTCH_ARCH_PATH"
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
then
|
||||
header=$(findFirstFile $SCOTCH_ARCH_PATH/include/$header)
|
||||
[ -n "$warn" ] && echo "$warn (disabled)"
|
||||
return 1
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$header")
|
||||
|
||||
library=$(findFirstFile \
|
||||
"$(thirdExtLib $library)" \
|
||||
$SCOTCH_ARCH_PATH/lib/$static \
|
||||
$SCOTCH_ARCH_PATH/lib/$library \
|
||||
$SCOTCH_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$static \
|
||||
$SCOTCH_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
|
||||
"$prefix/lib/$static" \
|
||||
"$prefix/lib/$library" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$static" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
|
||||
)
|
||||
elif isSystem "$SCOTCH_ARCH_PATH"
|
||||
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
prefix=/usr
|
||||
|
||||
header=$(findFirstFile \
|
||||
/usr/local/include/$header \
|
||||
/usr/local/include/scotch/$header \
|
||||
/usr/include/$header \
|
||||
/usr/include/scotch/$header \
|
||||
"/usr/local/include/scotch/$header" \
|
||||
"/usr/local/include/$header" \
|
||||
"/usr/include/scotch/$header" \
|
||||
"/usr/include/$header" \
|
||||
)
|
||||
|
||||
case "$header" in
|
||||
/usr/local/*)
|
||||
library=$(findFirstFile \
|
||||
/usr/local/lib/$library \
|
||||
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
|
||||
)
|
||||
;;
|
||||
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
|
||||
|
||||
*)
|
||||
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" ] || {
|
||||
@ -125,17 +122,18 @@ have_scotch()
|
||||
|
||||
# Library found?
|
||||
[ -n "$library" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (missing library)"
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
local good label
|
||||
|
||||
# Ensure consistent sizes between OpenFOAM and scotch header
|
||||
# extract 'typedef int64_t SCOTCH_Num' or equivalent
|
||||
label=$(sed -ne \
|
||||
's/^.*typedef *\([^ ]*\) *SCOTCH_Num.*/\1/p' \
|
||||
"$header")
|
||||
: ${label:=unknown} # Failsafe value
|
||||
: "${label:=unknown}"
|
||||
|
||||
|
||||
# No SCOTCH_VERSION set? Try to obtain from header
|
||||
@ -152,27 +150,30 @@ have_scotch()
|
||||
IFS="."
|
||||
[ "$#" -gt 0 ] && echo "scotch-$*"
|
||||
)
|
||||
: ${SCOTCH_VERSION:=scotch} # Failsafe value
|
||||
|
||||
: "${SCOTCH_VERSION:=scotch}" # Failsafe value
|
||||
|
||||
case "$WM_LABEL_SIZE:$label" in
|
||||
(32:int32_t | 32:int | 64:int64_t | 64:long)
|
||||
echo "Scotch (label=$label) - $SCOTCH_ARCH_PATH"
|
||||
export HAVE_SCOTCH=true
|
||||
export SCOTCH_ARCH_PATH SCOTCH_VERSION
|
||||
export SCOTCH_INC_DIR="${header%/*}" # Basename
|
||||
export SCOTCH_LIB_DIR="${library%/*}" # Basename
|
||||
good=true
|
||||
;;
|
||||
|
||||
*)
|
||||
(*)
|
||||
if [ -n "$warn" ]
|
||||
then
|
||||
echo "$warn (label='$WM_LABEL_SIZE', scotch.h has '$label')"
|
||||
echo "$warn (label='$WM_LABEL_SIZE', ${header##*/} has '$label')"
|
||||
fi
|
||||
no_scotch
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# OK
|
||||
echo "scotch (label=$label) - $prefix"
|
||||
export HAVE_SCOTCH=true
|
||||
export SCOTCH_ARCH_PATH="$prefix"
|
||||
export SCOTCH_INC_DIR="${header%/*}" # Basename
|
||||
export SCOTCH_LIB_DIR="${library%/*}" # Basename
|
||||
export SCOTCH_VERSION
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user