mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: split up internals of wmake/scripts/have_XXX functions
- adds some more flexibility
This commit is contained in:
committed by
Andrew Heather
parent
c156125669
commit
f8ef85b72f
@ -20,7 +20,7 @@
|
||||
# config.sh/scotch
|
||||
#
|
||||
# Functions provided
|
||||
# have_scotch, no_scotch, echo_scotch, query_scotch
|
||||
# have_ptscotch, search_ptscotch
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_SCOTCH
|
||||
@ -28,12 +28,21 @@
|
||||
# SCOTCH_INC_DIR
|
||||
# SCOTCH_LIB_DIR
|
||||
#
|
||||
# Functions provided [Must call have_scotch first]
|
||||
# have_ptscotch, search_ptscotch
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_PTSCOTCH
|
||||
# PTSCOTCH_ARCH_PATH
|
||||
# PTSCOTCH_INC_DIR
|
||||
# PTSCOTCH_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_scotch()
|
||||
{
|
||||
unset HAVE_SCOTCH SCOTCH_ARCH_PATH SCOTCH_INC_DIR SCOTCH_LIB_DIR
|
||||
@ -57,44 +66,19 @@ echo_scotch()
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_scotch()
|
||||
{
|
||||
local config="config.sh/scotch"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query scotch "$SCOTCH_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "scotch=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_SCOTCH, SCOTCH_ARCH_PATH, SCOTCH_INC_DIR, SCOTCH_LIB_DIR
|
||||
have_scotch()
|
||||
search_scotch()
|
||||
{
|
||||
local warn="==> skip scotch"
|
||||
local config="config.sh/scotch"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$SCOTCH_ARCH_PATH"
|
||||
local incName="scotch.h"
|
||||
local libName="libscotch"
|
||||
local localDir="scotch-int$WM_LABEL_SIZE"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -192,28 +176,19 @@ have_scotch()
|
||||
}
|
||||
|
||||
|
||||
# Must be called after have_scotch!
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_PTSCOTCH, PTSCOTCH_ARCH_PATH, PTSCOTCH_INC_DIR, PTSCOTCH_LIB_DIR
|
||||
have_ptscotch()
|
||||
search_ptscotch()
|
||||
{
|
||||
local 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"
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$PTSCOTCH_ARCH_PATH"
|
||||
local incName="ptscotch.h"
|
||||
local libName="libptscotch"
|
||||
local localDir="scotch-int$WM_LABEL_SIZE"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -272,7 +247,63 @@ have_ptscotch()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_scotch()
|
||||
{
|
||||
local warn="==> skip scotch"
|
||||
local config="config.sh/scotch"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_scotch "$SCOTCH_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Output as per search_* function
|
||||
have_ptscotch()
|
||||
{
|
||||
local 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"
|
||||
|
||||
search_ptscotch "$PTSCOTCH_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_scotch()
|
||||
{
|
||||
local config="config.sh/scotch"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query scotch "$SCOTCH_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "scotch=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_scotch
|
||||
|
||||
# Test/query
|
||||
|
||||
Reference in New Issue
Block a user