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/kahip
|
||||
#
|
||||
# Functions provided
|
||||
# have_kahip, no_kahip, echo_kahip, query_kahip
|
||||
# have_kahip, no_kahip, echo_kahip, query_kahip, search_kahip
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_KAHIP
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_kahip()
|
||||
{
|
||||
unset HAVE_KAHIP KAHIP_ARCH_PATH KAHIP_INC_DIR KAHIP_LIB_DIR
|
||||
@ -51,43 +51,18 @@ echo_kahip()
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_kahip()
|
||||
{
|
||||
local config="config.sh/kahip"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
_process_query kahip "$KAHIP_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config settings)" 1>&2
|
||||
echo "kahip=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_KAHIP, KAHIP_ARCH_PATH, KAHIP_INC_DIR, KAHIP_LIB_DIR
|
||||
have_kahip()
|
||||
search_kahip()
|
||||
{
|
||||
local warn="==> skip kahip"
|
||||
local config="config.sh/kahip"
|
||||
local settings
|
||||
|
||||
if settings="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config settings)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local prefix="$KAHIP_ARCH_PATH"
|
||||
local incName="kaHIP_interface.h"
|
||||
local libName="libkahip"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
@ -124,7 +99,7 @@ have_kahip()
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
# kahip itself is 32-bit int, but our interface itself handles some
|
||||
# kahip itself is 32-bit int, but our interface handles some
|
||||
# 64-bit conversion (mesh size).
|
||||
|
||||
echo "kahip (label=32) - $prefix"
|
||||
@ -135,7 +110,45 @@ have_kahip()
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Output as per search_* function
|
||||
have_kahip()
|
||||
{
|
||||
local warn="==> skip kahip"
|
||||
local config="config.sh/kahip"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
search_kahip "$KAHIP_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_kahip()
|
||||
{
|
||||
local config="config.sh/kahip"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query kahip "$KAHIP_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "kahip=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_kahip
|
||||
|
||||
# Test/query
|
||||
|
||||
Reference in New Issue
Block a user