mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
WIP: makeUMPIRE
This commit is contained in:
233
makeUMPIRE
Executable file
233
makeUMPIRE
Executable file
@ -0,0 +1,233 @@
|
||||
#!/bin/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
|
||||
# makeUMPIRE
|
||||
#
|
||||
# Description
|
||||
# Build script for UMPIRE
|
||||
#
|
||||
# ----------------------------------------------
|
||||
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
|
||||
#------------------------------------------------------------------------------
|
||||
# Dynamic library ending (default is .so)
|
||||
[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
|
||||
|
||||
# Short-circuit test for an installation
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
|
||||
dir="${2%/}" # <- *_ARCH_PATH
|
||||
[ -d "$dir/include/umpire" ] || exit 2
|
||||
|
||||
package="umpire"
|
||||
libStatic="libumpire.a"
|
||||
for lib in \
|
||||
"$dir/lib/$libStatic" \
|
||||
"$dir/lib$WM_COMPILER_LIB_ARCH/$libStatic" \
|
||||
;
|
||||
do
|
||||
if [ -r "$lib" ]
|
||||
then
|
||||
echo " $package include: $dir/include"
|
||||
echo " $package library: ${lib%/*}"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
exit 2
|
||||
fi
|
||||
#------------------------------------------------------------------------------
|
||||
if : # Run from third-party directory
|
||||
then
|
||||
cd "${0%/*}" || exit
|
||||
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
||||
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
|
||||
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/CMakeFunctions
|
||||
#------------------------------------------------------------------------------
|
||||
# Obtain version from OpenFOAM etc/config.sh file:
|
||||
_foamConfig umpire
|
||||
|
||||
PACKAGE="${umpire_version:-none}"
|
||||
|
||||
# Hint for cmake findMPI
|
||||
if [ -d "$MPI_ARCH_PATH" ]
|
||||
then
|
||||
export MPI_HOME="$MPI_ARCH_PATH"
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
printVersions() { listPackageVersions umpire; exit 0; }
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTION] [umpire-VERSION]
|
||||
options:
|
||||
-force Force compilation, even if include/library already exists
|
||||
-gcc Force use of gcc/g++
|
||||
-cmake PATH With cmake from the given path
|
||||
-mpi-home PATH With hint for MPI_HOME
|
||||
-DNAME=VALUE add cmake variable
|
||||
-list List available unpacked source versions
|
||||
-help Display usage help
|
||||
|
||||
* Build UMPIRE
|
||||
${PACKAGE:-[unspecified]}
|
||||
|
||||
USAGE
|
||||
showDownloadHint umpire
|
||||
exit 0 # Clean exit
|
||||
}
|
||||
#------------------------------------------------------------------------------
|
||||
exportCompiler minimal # Minimal compiler info for CMake/configure
|
||||
|
||||
unset optForce
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
'') ;; # Ignore empty
|
||||
-h | -help*) printHelp;;
|
||||
-list) printVersions;;
|
||||
-gcc) useGcc ;;
|
||||
-force) optForce=true ;;
|
||||
|
||||
-cmake)
|
||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||
CMAKE_PATH="${2%%/}"
|
||||
shift
|
||||
;;
|
||||
-mpi-home) # mpi with hint
|
||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||
export MPI_HOME="${2%%/}"
|
||||
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
|
||||
shift
|
||||
;;
|
||||
|
||||
umpire/* | sources/umpire* | umpire-[0-9]* | umpire-git*)
|
||||
PACKAGE="${1%%/}"
|
||||
;;
|
||||
-D[A-Z]*=* | [A-Z]*=*) # cmake variables
|
||||
addCMakeVariable "$1"
|
||||
;;
|
||||
*)
|
||||
die "unknown option/argument: '$1'"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$PACKAGE" ]
|
||||
then
|
||||
die "The UMPIRE package/version not specified"
|
||||
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
|
||||
then
|
||||
echo "Using none/system (skip ThirdParty build of UMPIRE)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Known build issues for mingw (various things)
|
||||
case "$WM_COMPILER" in
|
||||
(Mingw*)
|
||||
if [ "$optForce" = true ]
|
||||
then
|
||||
echo "Warning: umpire - not tested with $WM_COMPILER"
|
||||
else
|
||||
echo "Skipping umpire - not tested with $WM_COMPILER"
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Build UMPIRE
|
||||
# *PACKAGE : name-version of the package
|
||||
# *SOURCE : location of original sources
|
||||
# *PREFIX : installation directory
|
||||
|
||||
PKG_SOURCE="$(findSourceDir "$PACKAGE")"
|
||||
PACKAGE="$(basename "$PACKAGE")"
|
||||
PKG_PREFIX="$installBASE/$PACKAGE"
|
||||
export GIT_DIR="$PKG_SOURCE/.git"
|
||||
|
||||
echo
|
||||
echo ========================================
|
||||
echo "Build umpire library $PACKAGE"
|
||||
echo
|
||||
|
||||
if [ -z "$optForce" ] \
|
||||
&& [ -f "$PKG_PREFIX/include/umpire/Umpire.hpp" ] \
|
||||
&& {
|
||||
[ -r "$PKG_PREFIX/lib/libumpire.a" ] \
|
||||
|| [ -r "$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH/libumpire.a" ]
|
||||
}
|
||||
then
|
||||
echo " UMPIRE already built : $PKG_PREFIX"
|
||||
else
|
||||
# CMake options often lag the configure ones
|
||||
echo "Starting build: $PACKAGE (using cmake)"
|
||||
echo
|
||||
(
|
||||
PKG_BUILD="$buildBASE/$PACKAGE"
|
||||
cd "$PKG_SOURCE" || exit
|
||||
|
||||
applyPatch "$PACKAGE" "$PKG_SOURCE"
|
||||
|
||||
# Remove any existing build folder and recreate
|
||||
rm -rf "$PKG_PREFIX"
|
||||
rm -rf "$PKG_BUILD"
|
||||
mkdir -p "$PKG_BUILD"
|
||||
|
||||
# With MPI?
|
||||
# -DENABLE_FIND_MPI=ON
|
||||
|
||||
cmake=$(findCMake)
|
||||
|
||||
# By default installs into lib64/,
|
||||
# but libcamp installs into lib/ so use that here as well !
|
||||
#
|
||||
# Also note that the umpire currently (2025-04-03) doesn't properly
|
||||
# handle a relative directory for CMAKE_INSTALL_LIBDIR
|
||||
# (https://github.com/LLNL/Umpire/issues/952)
|
||||
|
||||
libdir="$PKG_PREFIX/lib"
|
||||
|
||||
cd "$PKG_BUILD" && set -x && \
|
||||
${cmake:?} \
|
||||
-DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
|
||||
-DCMAKE_INSTALL_LIBDIR="$libdir" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCAMP_ENABLE_TESTS=OFF \
|
||||
-DENABLE_ASTYLE=OFF \
|
||||
-DENABLE_DOCS=OFF \
|
||||
-DENABLE_DOXYGEN=OFF \
|
||||
-DENABLE_EXAMPLES=OFF \
|
||||
-DENABLE_FORTRAN=OFF \
|
||||
-DENABLE_TESTS=OFF \
|
||||
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
|
||||
"$PKG_SOURCE" \
|
||||
&& make -j $WM_NCOMPPROCS all \
|
||||
&& make install \
|
||||
&& echo "Built: $PACKAGE"
|
||||
) || {
|
||||
echo "Error building: $PACKAGE"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user