mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve handling of pt-scotch headers/libraries
- provide dedicated detection 'have_ptscotch' function that can be used after the 'have_scotch' function. It sets the PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR and helps when the serial and parallel versions are located with different logic.
This commit is contained in:
committed by
Andrew Heather
parent
693afb5408
commit
cd91a252ac
@ -41,7 +41,8 @@ wmakeLnInclude -u decompositionMethods
|
|||||||
if have_scotch
|
if have_scotch
|
||||||
then
|
then
|
||||||
wmake $targetType scotchDecomp
|
wmake $targetType scotchDecomp
|
||||||
if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ]
|
|
||||||
|
if have_ptscotch
|
||||||
then
|
then
|
||||||
wmakeMpiLib "$SCOTCH_VERSION" ptscotchDecomp
|
wmakeMpiLib "$SCOTCH_VERSION" ptscotchDecomp
|
||||||
fi
|
fi
|
||||||
|
|||||||
@ -1,13 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* NB: mplib PINC must appear after the SCOTCH_ARCH_PATH/include/FOAM_MPI
|
* NB: mplib PINC must appear after PTSCOTCH_INC_DIR to ensure we
|
||||||
* to ensure we do not accidentally get a ptscotch header from the
|
* do not accidentally get a ptscotch header from the MPI distribution.
|
||||||
* mpi distribution.
|
|
||||||
*/
|
*/
|
||||||
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
|
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
|
||||||
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
|
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
|
||||||
|
|
||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \
|
-I$(PTSCOTCH_INC_DIR) \
|
||||||
-I$(SCOTCH_INC_DIR) \
|
-I$(SCOTCH_INC_DIR) \
|
||||||
$(PFLAGS) $(PINC) \
|
$(PFLAGS) $(PINC) \
|
||||||
-I../decompositionMethods/lnInclude
|
-I../decompositionMethods/lnInclude
|
||||||
@ -17,9 +16,8 @@ EXE_INC = \
|
|||||||
* ptscotch 6 requires scotch linked in, but does not declare the dependency
|
* ptscotch 6 requires scotch linked in, but does not declare the dependency
|
||||||
*/
|
*/
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
|
-L$(PTSCOTCH_LIB_DIR) \
|
||||||
-L$(SCOTCH_LIB_DIR) \
|
-L$(SCOTCH_LIB_DIR) \
|
||||||
-L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) \
|
|
||||||
-L$(FOAM_EXT_LIBBIN) \
|
|
||||||
-lptscotch -lptscotcherrexit \
|
-lptscotch -lptscotcherrexit \
|
||||||
-lscotch
|
-lscotch
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ no_scotch()
|
|||||||
{
|
{
|
||||||
unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR
|
unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR
|
||||||
unset SCOTCH_VERSION
|
unset SCOTCH_VERSION
|
||||||
|
unset HAVE_PTSCOTCH PTSCOTCH_ARCH_PATH PTSCOTCH_INC_DIR PTSCOTCH_LIB_DIR
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,6 +49,11 @@ echo_scotch()
|
|||||||
echo "root=$SCOTCH_ARCH_PATH"
|
echo "root=$SCOTCH_ARCH_PATH"
|
||||||
echo "include=$SCOTCH_INC_DIR"
|
echo "include=$SCOTCH_INC_DIR"
|
||||||
echo "library=$SCOTCH_LIB_DIR"
|
echo "library=$SCOTCH_LIB_DIR"
|
||||||
|
echo
|
||||||
|
echo "ptscotch=${HAVE_PTSCOTCH:-false}"
|
||||||
|
echo "root=$PTSCOTCH_ARCH_PATH"
|
||||||
|
echo "include=$PTSCOTCH_INC_DIR"
|
||||||
|
echo "library=$PTSCOTCH_LIB_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,13 +183,105 @@ have_scotch()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Must be called after have_scotch!
|
||||||
|
#
|
||||||
|
# On success, return 0 and export variables
|
||||||
|
# -> HAVE_PTSCOTCH, PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR
|
||||||
|
have_ptscotch()
|
||||||
|
{
|
||||||
|
local prefix header library static settings warn
|
||||||
|
warn="==> skip ptscotch"
|
||||||
|
|
||||||
|
if [ "$HAVE_SCOTCH" != true ]
|
||||||
|
then
|
||||||
|
echo "$warn (no serial scotch available?)"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reuse old settings
|
||||||
|
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
|
||||||
|
|
||||||
|
# Location
|
||||||
|
prefix="$PTSCOTCH_ARCH_PATH"
|
||||||
|
|
||||||
|
# Header/library names
|
||||||
|
header="ptscotch.h"
|
||||||
|
library="libptscotch$extLibso"
|
||||||
|
static="libptscotch$extLiba"
|
||||||
|
|
||||||
|
# ----------------------------------
|
||||||
|
if isNone "$prefix"
|
||||||
|
then
|
||||||
|
[ -n "$warn" ] && echo "$warn (disabled)"
|
||||||
|
return 1
|
||||||
|
elif hasAbsdir "$prefix"
|
||||||
|
then
|
||||||
|
header=$(findFirstFile \
|
||||||
|
"$prefix/include/$FOAM_MPI/$header" \
|
||||||
|
"$prefix/include/$header"
|
||||||
|
)
|
||||||
|
|
||||||
|
library=$(findFirstFile \
|
||||||
|
"$(thirdExtLib $FOAM_MPI/$library)" \
|
||||||
|
"$(thirdExtLib $library)" \
|
||||||
|
"$prefix/lib/$static" \
|
||||||
|
"$prefix/lib/$library" \
|
||||||
|
"$prefix/lib$WM_COMPILER_LIB_ARCH/$static" \
|
||||||
|
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
|
||||||
|
)
|
||||||
|
|
||||||
|
elif isSystem "$prefix"
|
||||||
|
then
|
||||||
|
prefix=/usr
|
||||||
|
|
||||||
|
header=$(findFirstFile \
|
||||||
|
"/usr/local/include/ptscotch/$header" \
|
||||||
|
"/usr/local/include/scotch/$header" \
|
||||||
|
"/usr/local/include/$header" \
|
||||||
|
"/usr/include/ptscotch/$header" \
|
||||||
|
"/usr/include/scotch/$header" \
|
||||||
|
"/usr/include/$header" \
|
||||||
|
)
|
||||||
|
|
||||||
|
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
|
||||||
|
|
||||||
|
library=$(findFirstFile \
|
||||||
|
"$prefix/lib/$library" \
|
||||||
|
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
|
||||||
|
)
|
||||||
|
else
|
||||||
|
unset prefix header library
|
||||||
|
fi
|
||||||
|
# ----------------------------------
|
||||||
|
|
||||||
|
# Header found?
|
||||||
|
[ -n "$header" ] || {
|
||||||
|
[ -n "$warn" ] && echo "$warn (no header)"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Library found?
|
||||||
|
[ -n "$library" ] || {
|
||||||
|
[ -n "$warn" ] && echo "$warn (no library)"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
# OK
|
||||||
|
echo "ptscotch - $prefix"
|
||||||
|
export HAVE_PTSCOTCH=true
|
||||||
|
export PTSCOTCH_ARCH_PATH="$prefix"
|
||||||
|
export PTSCOTCH_INC_DIR="${header%/*}" # Basename
|
||||||
|
export PTSCOTCH_LIB_DIR="${library%/*}" # Basename
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Force reset of old variables
|
# Force reset of old variables
|
||||||
no_scotch
|
no_scotch
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
if [ "$1" = "-test" ]
|
if [ "$1" = "-test" ]
|
||||||
then
|
then
|
||||||
have_scotch
|
have_scotch && have_ptscotch
|
||||||
echo_scotch
|
echo_scotch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -48,14 +48,20 @@ then
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# True if OS is Darwin.
|
# True if target OS is Darwin.
|
||||||
# Uses libso extension to cache the value
|
# Uses cached value from libso extension
|
||||||
# (instead of calling 'uname -s' each time)
|
|
||||||
isDarwin()
|
isDarwin()
|
||||||
{
|
{
|
||||||
test "$extLibso" = ".dylib"
|
test "$extLibso" = ".dylib"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# True if target OS is Windows
|
||||||
|
# Uses cached value from libso extension
|
||||||
|
isWindows()
|
||||||
|
{
|
||||||
|
test "$extLibso" = ".dll"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# True if '$1' begins with '/'
|
# True if '$1' begins with '/'
|
||||||
isAbsdir()
|
isAbsdir()
|
||||||
|
|||||||
Reference in New Issue
Block a user