- /usr/bin/{gcc,g++} normally just symlinks to clang/clang++ and may have unknown default flags. For a gcc toolchain, it would be better to use a homebrew installation. For these cases, the compiler will need to be specified with version=.. in WM_COMPILE_CONTROL. For example, with "version=14", to select gcc-14, g++-14 from the homebrew installation. - needs a slight hack for locating the FlexLexer.h header. Added into src/OSspecific/POSIX similar to how it is handled in src/OSspecific/MSwindows CONFIG: add simple config/detection support for libumpire (Linux)
170 lines
3.9 KiB
Bash
170 lines
3.9 KiB
Bash
#----------------------------------*-sh-*--------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | www.openfoam.com
|
|
# \\/ M anipulation |
|
|
#------------------------------------------------------------------------------
|
|
# Copyright (C) 2025 OpenCFD Ltd.
|
|
#------------------------------------------------------------------------------
|
|
# License
|
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
|
#
|
|
# Script
|
|
# have_umpire
|
|
#
|
|
# Description
|
|
# Detection/setup of UMPIRE
|
|
#
|
|
# Requires
|
|
# UMPIRE_ARCH_PATH
|
|
#
|
|
# Functions provided
|
|
# have_umpire, no_umpire, echo_umpire, query_umpire, search_umpire
|
|
#
|
|
# Variables set on success
|
|
# HAVE_UMPIRE
|
|
# UMPIRE_ARCH_PATH
|
|
# UMPIRE_INC_DIR
|
|
# UMPIRE_LIB_DIR
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Reset
|
|
no_umpire()
|
|
{
|
|
unset HAVE_UMPIRE UMPIRE_INC_DIR UMPIRE_LIB_DIR
|
|
}
|
|
|
|
|
|
# Report
|
|
echo_umpire()
|
|
{
|
|
echo "umpire=${HAVE_UMPIRE:-false}"
|
|
echo "root=\"$UMPIRE_ARCH_PATH\""
|
|
echo "include=\"$UMPIRE_INC_DIR\""
|
|
echo "library=\"$UMPIRE_LIB_DIR\""
|
|
}
|
|
|
|
|
|
# Search
|
|
# $1 : prefix (*_ARCH_PATH, system, ...)
|
|
#
|
|
# On success, return 0 and export variables
|
|
# -> HAVE_UMPIRE, UMPIRE_INC_DIR, UMPIRE_LIB_DIR
|
|
search_umpire()
|
|
{
|
|
local warn # warn="==> skip umpire"
|
|
local incName="Umpire.hpp"
|
|
local libName="libumpire"
|
|
|
|
local prefix="${1:-system}"
|
|
local header library
|
|
|
|
# ----------------------------------
|
|
if isNone "$prefix"
|
|
then
|
|
[ -n "$warn" ] && echo "$warn (disabled)"
|
|
return 1
|
|
elif hasAbsdir "$prefix"
|
|
then
|
|
header=$(findFirstFile "$prefix/include/umpire/$incName")
|
|
library=$(findExtLib "$libName")
|
|
elif isSystem "$prefix"
|
|
then
|
|
header=$(findFirstFile \
|
|
"/usr/local/include/umpire/$incName" \
|
|
"/usr/include/umpire/$incName" \
|
|
)
|
|
prefix=$(sysPrefix "$header")
|
|
else
|
|
unset prefix
|
|
fi
|
|
# ----------------------------------
|
|
|
|
# Header
|
|
[ -n "$header" ] || {
|
|
[ -n "$warn" ] && echo "$warn (no header)"
|
|
return 2
|
|
}
|
|
|
|
# Library
|
|
[ -n "$library" ] \
|
|
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
|
|| {
|
|
[ -n "$warn" ] && echo "$warn (no library)"
|
|
return 2
|
|
}
|
|
|
|
# ----------------------------------
|
|
|
|
# OK
|
|
export HAVE_UMPIRE=true
|
|
export UMPIRE_ARCH_PATH="$prefix"
|
|
export UMPIRE_INC_DIR="${header%/*}" # Basename
|
|
export UMPIRE_LIB_DIR="${library%/*}" # Basename
|
|
|
|
# Expect path/include/umpire -> path/include
|
|
UMPIRE_INC_DIR="${UMPIRE_INC_DIR%/umpire}"
|
|
}
|
|
|
|
|
|
# Output as per search_* function
|
|
have_umpire()
|
|
{
|
|
local warn # warn="==> skip umpire"
|
|
local config="config.sh/umpire"
|
|
local file
|
|
|
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
|
then
|
|
. "$file"
|
|
else
|
|
[ -n "$warn" ] && echo "$warn (no $config)"
|
|
return 2
|
|
fi
|
|
|
|
search_umpire "$UMPIRE_ARCH_PATH"
|
|
}
|
|
|
|
|
|
# Query settings
|
|
query_umpire()
|
|
{
|
|
local config="config.sh/umpire"
|
|
local file
|
|
|
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
|
then
|
|
. "$file"
|
|
_process_query umpire "$UMPIRE_ARCH_PATH"
|
|
else
|
|
echo "(no $config)" 1>&2
|
|
echo "umpire=unknown"
|
|
fi
|
|
}
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Reset
|
|
no_umpire
|
|
|
|
# Test/query
|
|
case "$1" in
|
|
-test | -debug-test)
|
|
[ "$1" = "-debug-test" ] && set -x
|
|
have_umpire
|
|
[ "$1" = "-debug-test" ] && set +x
|
|
echo_umpire
|
|
;;
|
|
-query)
|
|
query_umpire
|
|
;;
|
|
esac
|
|
|
|
#------------------------------------------------------------------------------
|