Compare commits
4 Commits
maintenanc
...
rpmbuild-1
| Author | SHA1 | Date | |
|---|---|---|---|
| f7c8f4a467 | |||
| 4bb4e1bbd0 | |||
| 049b9c60c9 | |||
| ba6479bfe0 |
317
bin/tools/install-platform
Executable file
317
bin/tools/install-platform
Executable file
@ -0,0 +1,317 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# install-platform
|
||||
#
|
||||
# Example usage
|
||||
# install-platform -prefix=/opt/openfoam2006
|
||||
#
|
||||
# Description
|
||||
# Simple installer for binary bin/, lib/ directories
|
||||
# (platforms directories), to simplify packaging.
|
||||
#
|
||||
# Note
|
||||
# The platforms/tools directory must be handled separately
|
||||
#
|
||||
# Layout of OpenFOAM platforms
|
||||
#
|
||||
# platforms
|
||||
# |-- <WM_OPTIONS>
|
||||
# |-- bin
|
||||
# | |-- ...
|
||||
# `-- lib
|
||||
# |-- ...
|
||||
# |-- dummy
|
||||
# | `-- ...
|
||||
# |-- openmpi-system
|
||||
# | |-- libPstream.so
|
||||
# | `-- libptscotchDecomp.so
|
||||
# `-- paraview-MAJ.MIN
|
||||
# `-- ...
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
printHelp() {
|
||||
cat<<USAGE
|
||||
|
||||
Usage: ${0##*/} [OPTION]
|
||||
|
||||
input options:
|
||||
-source=DIR Source directory (default: $WM_PROJECT_DIR)
|
||||
-platform=NAME Platform name (default: $WM_OPTIONS)
|
||||
-foam-mpi=NAME OpenFOAM mpi name (default: $FOAM_MPI)
|
||||
|
||||
target options:
|
||||
-prefix=DIR Top-level installation directory (eg, /opt/openfoamVER)
|
||||
-bindir=DIR bin directory [<prefix>/platforms/<platform>/bin]
|
||||
-libdir=DIR lib directory [<prefix>/platforms/<platform>/lib]
|
||||
-mpi-libdir=DIR mpi lib directory [<prefix>/platforms/<platform>/lib/<foam-mpi>]
|
||||
|
||||
tuning options:
|
||||
-no-bin Do not install bin directory
|
||||
-no-lib Do not install lib directory
|
||||
-no-mpi Do not install mpi lib directory
|
||||
-mpi-only Only install mpi lib directory
|
||||
-mpi-mkdir Create foam-mpi directory within libdir
|
||||
|
||||
general options:
|
||||
-dry-run, -n Do not perform any operations
|
||||
-verbose, -v Additional verbosity
|
||||
-help Print the help and exit
|
||||
|
||||
|
||||
Simple installer for binary bin/, lib/ directories (platforms directories),
|
||||
to simplify packaging.
|
||||
|
||||
USAGE
|
||||
exit 0 # A clean exit
|
||||
}
|
||||
|
||||
unset optDryRun hadError
|
||||
# Report error and exit
|
||||
die()
|
||||
{
|
||||
exec 1>&2
|
||||
echo
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '%{0##*/} -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Report error and exit
|
||||
warnOrDie()
|
||||
{
|
||||
if [ -n "$optDryRun" ]
|
||||
then
|
||||
hadError=true
|
||||
while [ "$#" -ge 1 ]; do echo "Error: $1" 1>&2; shift; done
|
||||
else
|
||||
die "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Get the option's value (argument), or die on missing or empty value
|
||||
# $1 option=value
|
||||
getOptionValue()
|
||||
{
|
||||
local value="${1#*=}"
|
||||
# Remove any surrounding double quotes
|
||||
value="${value%\"}"
|
||||
value="${value#\"}"
|
||||
|
||||
[ -n "$value" ] || die "'${1%=}' option requires a value"
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Defaults from current OpenFOAM environment
|
||||
sourceDir="$WM_PROJECT_DIR"
|
||||
platform="$WM_OPTIONS"
|
||||
foam_mpi="$FOAM_MPI"
|
||||
|
||||
unset optInstall_bin optInstall_lib
|
||||
unset optMpi_mkdir
|
||||
optInstall_mpi=true
|
||||
|
||||
unset prefix bindir libdir libdir_mpi optVerbose
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help*) printHelp ;;
|
||||
-n | -dry-run) optDryRun="(dry-run) " ;;
|
||||
-v | -verbose) optVerbose=true ;;
|
||||
|
||||
# Inputs
|
||||
-source=*) sourceDir="$(getOptionValue "$1")" ;;
|
||||
-platform=*) platform="$(getOptionValue "$1")" ;;
|
||||
-foam-mpi=*) foam_mpi="$(getOptionValue "$1")" ;;
|
||||
|
||||
# Targets
|
||||
-prefix=*) prefix="$(getOptionValue "$1")" ;;
|
||||
-bindir=*) bindir="$(getOptionValue "$1")" ;;
|
||||
-libdir=*) libdir="$(getOptionValue "$1")" ;;
|
||||
-mpi-libdir=*) libdir_mpi="$(getOptionValue "$1")" ;;
|
||||
|
||||
-no-bin) optInstall_bin=false ;;
|
||||
-no-lib) optInstall_lib=false ;;
|
||||
-no-mpi) optInstall_mpi=false ;;
|
||||
-mpi-only) optInstall_mpi=exclusive ;;
|
||||
|
||||
-mpi-mkdir) optMpi_mkdir=true ;;
|
||||
|
||||
*)
|
||||
die "Unknown option/argument: $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Report settings
|
||||
|
||||
echo "Preparing install with the following parameters" 1>&2
|
||||
echo "source:" 1>&2
|
||||
echo " directory $sourceDir" 1>&2
|
||||
echo " platform $platform" 1>&2
|
||||
echo " foam-mpi $foam_mpi" 1>&2
|
||||
echo 1>&2
|
||||
echo "target (mpi-install: $optInstall_mpi)" 1>&2
|
||||
echo " directory $prefix" 1>&2
|
||||
echo " bindir ${bindir:-[default]}" 1>&2
|
||||
echo " libdir ${libdir:-[default]}" 1>&2
|
||||
echo " libdir(mpi) ${libdir_mpi:-[default]}" 1>&2
|
||||
echo 1>&2
|
||||
|
||||
# Input checks
|
||||
|
||||
[ -d "$sourceDir" ] || warnOrDie "Invalid -source directory: $sourceDir"
|
||||
[ -n "$platform" ] || warnOrDie "No -platform detected or specified"
|
||||
[ -n "$foam_mpi" ] || warnOrDie "No -foam-mpi detected or specified"
|
||||
|
||||
sourcePlatform="$sourceDir/platforms/$platform"
|
||||
|
||||
[ -d "$sourcePlatform" ] || \
|
||||
warnOrDie "Missing platforms directory for: $platform"
|
||||
|
||||
|
||||
# Installation directories
|
||||
if [ -n "$prefix" ]
|
||||
then
|
||||
installPlatform="$prefix/platforms/$platform"
|
||||
|
||||
# Set defaults based on -prefix
|
||||
[ -n "$bindir" ] || bindir="$installPlatform/bin"
|
||||
[ -n "$libdir" ] || libdir="$installPlatform/lib"
|
||||
fi
|
||||
|
||||
# Default mpi libdir based on libdir
|
||||
if [ -z "$libdir_mpi" ] && [ -n "$libdir" ]
|
||||
then
|
||||
libdir_mpi="$libdir/$foam_mpi"
|
||||
fi
|
||||
|
||||
# Check sanity
|
||||
[ -n "$bindir$libdir$libdir_mpi" ] || \
|
||||
warnOrDie "Must specify at least one of -prefix, -bindir, -libdir, -mpi-libdir"
|
||||
|
||||
|
||||
if [ -n "$hadError" ]
|
||||
then
|
||||
echo "Errors encounters in dry-run. Stopping" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ "$optInstall_bin" = false ] || [ "$optInstall_mpi" = exclusive ]
|
||||
then
|
||||
unset bindir
|
||||
fi
|
||||
if [ "$optInstall_lib" = false ] || [ "$optInstall_mpi" = exclusive ]
|
||||
then
|
||||
unset libdir
|
||||
fi
|
||||
if [ "$optInstall_mpi" = false ]
|
||||
then
|
||||
unset libdir_mpi
|
||||
fi
|
||||
|
||||
|
||||
# bin/
|
||||
if [ -n "$bindir" ]
|
||||
then
|
||||
echo "${optDryRun}Install bindir: $bindir" 1>&2
|
||||
if [ -z "$optDryRun" ]
|
||||
then
|
||||
mkdir -p "$bindir" 2>/dev/null
|
||||
|
||||
[ -n "$optVerbose" ] && echo "Copy $sourcePlatform/bin" 1>&2
|
||||
for i in "$sourcePlatform/bin/"*
|
||||
do
|
||||
if [ -e "$i" ]
|
||||
then
|
||||
cp -a ${optVerbose:+-v} "$i" "$bindir"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "${optDryRun}Install bindir: [disabled]" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
# lib/ without mpi
|
||||
if [ -n "$libdir" ]
|
||||
then
|
||||
echo "${optDryRun}Install libdir(non-mpi): $libdir" 1>&2
|
||||
if [ -z "$optDryRun" ]
|
||||
then
|
||||
mkdir -p "$libdir" 2>/dev/null
|
||||
|
||||
[ -n "$optVerbose" ] && echo "Copy $sourcePlatform/lib" 1>&2
|
||||
for i in "$sourcePlatform/lib/"*
|
||||
do
|
||||
if [ "${i##*/}" = "$foam_mpi" ]
|
||||
then
|
||||
if [ "$optMpi_mkdir" = true ]
|
||||
then
|
||||
mkdir -p "$libdir/$foam_mpi"
|
||||
fi
|
||||
elif [ -e "$i" ]
|
||||
then
|
||||
cp -a ${optVerbose:+-v} "$i" "$libdir"
|
||||
else
|
||||
echo "bogus lib entry? $i" 1>&2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "${optDryRun}Install libdir: [disabled]" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
# lib/mpi
|
||||
if [ -n "$libdir_mpi" ]
|
||||
then
|
||||
echo "${optDryRun}Install libdir(mpi): $libdir_mpi" 1>&2
|
||||
if [ -z "$optDryRun" ]
|
||||
then
|
||||
mkdir -p "$libdir_mpi" 2>/dev/null
|
||||
|
||||
[ -n "$optVerbose" ] && echo "Copy $sourcePlatform/lib/$foam_mpi" 1>&2
|
||||
for i in "$sourcePlatform/lib/$foam_mpi"/*
|
||||
do
|
||||
if [ -e "$i" ]
|
||||
then
|
||||
# Always verbose (not many files anyhow)
|
||||
cp -a -v "$i" "$libdir_mpi"
|
||||
else
|
||||
echo "bogus mpi-lib entry? $i" 1>&2
|
||||
fi
|
||||
done
|
||||
fi
|
||||
else
|
||||
echo "${optDryRun}Install libdir(mpi): [disabled]" 1>&2
|
||||
fi
|
||||
|
||||
|
||||
exit 0 # clean exit
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
75
bin/tools/update-mpi-links.in
Normal file
75
bin/tools/update-mpi-links.in
Normal file
@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
FOAM_MPI="@FOAM_MPI@"
|
||||
FOAM_SYSTEM_MPI_LIBBIN="@FOAM_SYSTEM_MPI_LIBBIN@"
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Description
|
||||
# Local update of links from system mpi lib/ to local lib/mpi-name
|
||||
#
|
||||
# Note
|
||||
# Normally located as a trigger within the platforms/ directory
|
||||
# Uses hard-code values (eg, generated with autoconfig).
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
# Local values
|
||||
FOAM_LIBBIN="$(pwd -P)/lib"
|
||||
FOAM_MPI_LIBBIN="$FOAM_LIBBIN/$FOAM_MPI"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
echo "Link OpenFOAM ($FOAM_MPI) from system mpi locations"
|
||||
echo "Target: $FOAM_MPI_LIBBIN"
|
||||
echo "Source: $FOAM_SYSTEM_MPI_LIBBIN"
|
||||
|
||||
if [ -z "$FOAM_MPI" ]
|
||||
then
|
||||
echo "FOAM_MPI not defined - skipping"
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$FOAM_SYSTEM_MPI_LIBBIN" ]
|
||||
then
|
||||
echo "FOAM_SYSTEM_MPI_LIBBIN not defined - skipping"
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -d "$FOAM_SYSTEM_MPI_LIBBIN" ]
|
||||
then
|
||||
echo "No system mpi lib: $FOAM_SYSTEM_MPI_LIBBIN"
|
||||
echo "... not updating"
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -d "$FOAM_LIBBIN" ]
|
||||
then
|
||||
echo "Missing $FOAM_LIBBIN"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
mkdir -p "$FOAM_MPI_LIBBIN"
|
||||
|
||||
# Create symlinks
|
||||
(
|
||||
cd "$FOAM_MPI_LIBBIN" || exit
|
||||
|
||||
for i in "$FOAM_SYSTEM_MPI_LIBBIN"/*
|
||||
do
|
||||
if [ -f "$i" ]
|
||||
then
|
||||
ln -svf "$i" "${i##*/}"
|
||||
fi
|
||||
done
|
||||
)
|
||||
|
||||
exit 0 # clean exit
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -17,7 +17,7 @@ GLIB_LIBS =
|
||||
COMPILER_TYPE = $(shell echo "$(WM_COMPILER)" | sed -e 's/[0-9].*//')
|
||||
DEFAULT_RULES = $(WM_DIR)/rules/$(WM_ARCH)$(COMPILER_TYPE)
|
||||
RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
|
||||
WMAKE_BIN = $(WM_DIR)/platforms/$(WM_ARCH)$(WM_COMPILER)
|
||||
WMAKE_BIN = $(WM_PROJECT_DIR)/platforms/tools/$(WM_ARCH)$(WM_COMPILER)
|
||||
|
||||
ifeq ($(WM_SCHEDULER),)
|
||||
AND = &&
|
||||
|
||||
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||
# Copyright (C) 2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# wmake/scripts/AllwmakeParseArguments
|
||||
@ -20,16 +19,37 @@
|
||||
#
|
||||
# Usage
|
||||
# # Parse the arguments by sourcing this script
|
||||
# . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
# . ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
|
||||
#
|
||||
# Parsed options (make)
|
||||
# -k | -keep-going | -non-stop
|
||||
# -j | -jN | -j N
|
||||
#
|
||||
# Parsed options (wmake)
|
||||
# -debug
|
||||
# -q | -queue
|
||||
# -module-prefix=...
|
||||
# Exports FOAM_MODULE_PREFIX value.
|
||||
# Unsets FOAM_MODULE_APPBIN, FOAM_MODULE_LIBBIN.
|
||||
# Handles (user|group|openfoam) or (u|g|o) as per foamEtcFile,
|
||||
# or absolute/relative paths
|
||||
#
|
||||
# Parsed options (special)
|
||||
# -l | -log | -log=FILE
|
||||
# -prefix=... same as -module-prefix=...
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
echo "$Script error: The OpenFOAM environment is not set."
|
||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
||||
# Check environment
|
||||
[ -d "$WM_PROJECT_DIR" ] || {
|
||||
exec 1>&2
|
||||
echo "$0"
|
||||
echo "Error encountered:"
|
||||
echo " The OpenFOAM environment not set or incorrect."
|
||||
echo " Check your setup."
|
||||
echo
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
exec 1>&2
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
@ -40,13 +60,18 @@ Executing ${0##*/} is equivalent to
|
||||
|
||||
wmake -all [OPTIONS]
|
||||
|
||||
With these additional options:
|
||||
-l | -log | -log=name
|
||||
With additional options:
|
||||
-l | -log Tee output to log.\$WM_OPTIONS
|
||||
-log=NAME Tee output to given filename
|
||||
-prefix=... Define FOAM_MODULE_PREFIX (same as wmake -module-prefix)
|
||||
-no-recursion Prevent recursive call (do NOT call 'wmake -all')
|
||||
-fromWmake Same as -no-recursion
|
||||
|
||||
See
|
||||
wmake -help (or wmake -help-full)
|
||||
|
||||
USAGE
|
||||
|
||||
wmake -help
|
||||
exit 0
|
||||
exit 0 # clean exit
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +79,7 @@ USAGE
|
||||
# Parse the arguments and options
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset fromWmake optDebug optLog optQueue
|
||||
unset optDebug optLog optNonRecursive optPrefix optQueue
|
||||
|
||||
for arg in "$@"
|
||||
do
|
||||
@ -65,41 +90,83 @@ do
|
||||
-h | -help*)
|
||||
usage
|
||||
;;
|
||||
-fromWmake)
|
||||
# If called from wmake (to avoid recursion)
|
||||
fromWmake=true
|
||||
|
||||
-no-recurs* | -fromWmake)
|
||||
# Avoid recursion (eg, if called from wmake)
|
||||
optNonRecursive=true
|
||||
# Pass onwards to other Allwmake scripts
|
||||
;;
|
||||
|
||||
-module-prefix=* | -prefix=* | --prefix=*)
|
||||
optPrefix="${arg#*=}"
|
||||
case "$optPrefix" in
|
||||
# Prefix: user
|
||||
(u | user)
|
||||
export FOAM_MODULE_PREFIX="${FOAM_USER_LIBBIN%/*}"
|
||||
;;
|
||||
|
||||
# Prefix: group
|
||||
(g | group)
|
||||
export FOAM_MODULE_PREFIX="${FOAM_SITE_LIBBIN%/*}"
|
||||
;;
|
||||
|
||||
# Prefix: openfoam (other)
|
||||
(o | openfoam)
|
||||
export FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}"
|
||||
;;
|
||||
|
||||
# Prefix: custom (absolute or relative)
|
||||
(*)
|
||||
export FOAM_MODULE_PREFIX="$optPrefix"
|
||||
: "${FOAM_MODULE_PREFIX:=/usr/local}" # Default (autoconf)
|
||||
|
||||
# Require absolute path
|
||||
[ "${FOAM_MODULE_PREFIX#/}" != "${FOAM_MODULE_PREFIX}" ] || \
|
||||
FOAM_MODULE_PREFIX="${PWD}/${FOAM_MODULE_PREFIX}"
|
||||
;;
|
||||
esac
|
||||
|
||||
unset FOAM_MODULE_APPBIN FOAM_MODULE_LIBBIN
|
||||
echo "Module prefix = $FOAM_MODULE_PREFIX" 1>&2
|
||||
continue # Handled argument
|
||||
;;
|
||||
|
||||
-k | -keep-going | -non-stop)
|
||||
# Keep going, ignoring errors
|
||||
export WM_CONTINUE_ON_ERROR=true
|
||||
continue # Permanently remove arg
|
||||
;;
|
||||
|
||||
-l | -log)
|
||||
optLog="log.${WM_OPTIONS:-Allwmake}"
|
||||
optLog="log.${WM_OPTIONS:-build}"
|
||||
continue # Permanently remove arg
|
||||
;;
|
||||
|
||||
-log=*)
|
||||
optLog="${arg##*=}"
|
||||
if [ -d "$optLog" ]
|
||||
then
|
||||
optLog="${optLog%/}/log.${WM_OPTIONS:-Allwmake}"
|
||||
optLog="${optLog%/}/log.${WM_OPTIONS:-build}"
|
||||
elif [ -z "$optLog" ]
|
||||
then
|
||||
optLog="log.${WM_OPTIONS:-Allwmake}"
|
||||
optLog="log.${WM_OPTIONS:-build}"
|
||||
fi
|
||||
continue # Permanently remove arg
|
||||
;;
|
||||
|
||||
-debug)
|
||||
optDebug="-debug"
|
||||
continue # Permanently remove arg
|
||||
;;
|
||||
|
||||
-q | -queue)
|
||||
optQueue="-queue"
|
||||
continue # Permanently remove arg
|
||||
;;
|
||||
|
||||
lib | libo | libso | dep | objects)
|
||||
# Target type
|
||||
targetType=$arg
|
||||
targetType="$arg"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -112,11 +179,11 @@ done
|
||||
# Execute wmake -all if not called from wmake
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$fromWmake" ]
|
||||
if [ -z "$optNonRecursive" ]
|
||||
then
|
||||
if [ -z "$optLog" ]
|
||||
then
|
||||
exec wmake -all $optQueue $*
|
||||
exec wmake -all $optDebug $optQueue $*
|
||||
exit $? # Unneeded, but just in case something went wrong
|
||||
else
|
||||
echo "Logging wmake -all output to '$optLog'" 1>&2
|
||||
@ -125,7 +192,7 @@ then
|
||||
# Need to cleanup after the tee
|
||||
rc=$? # Error code from tee (not wmake), but not entirely important
|
||||
echo "Done logging to '$optLog'" 1>&2
|
||||
exit $rc
|
||||
exit "$rc"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -144,7 +211,7 @@ fi
|
||||
# Cleanup local variables and functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
unset fromWmake optDebug optLog optQueue
|
||||
unset optNonRecursive optDebug optLog optPrefix optQueue
|
||||
unset -f usage
|
||||
|
||||
|
||||
|
||||
@ -5,19 +5,23 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# cmakeFunctions
|
||||
#
|
||||
# Description
|
||||
# Helper functions for CMake
|
||||
#
|
||||
# Environment
|
||||
# Consider CMAKE_INSTALL_PREFIX as a reserved name, although it is not
|
||||
# set/unset here.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions # Require some wmake functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
|
||||
|
||||
# Export compiler information for cmake
|
||||
export CC="$(wmake -show-c)"
|
||||
@ -28,48 +32,17 @@ export CXXFLAGS="$(wmake -show-cxxflags)"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Check sentinel file(s) to handle paraview / vtk version changes
|
||||
#
|
||||
sameDependency()
|
||||
|
||||
# Resolve the location of cmake (if needed) and call with output
|
||||
# suppressed according to WM_QUIET
|
||||
call_cmake()
|
||||
{
|
||||
local depend="$1"
|
||||
local sourceDir="$2"
|
||||
local objectsDir sentinel prev
|
||||
|
||||
# Where generated files are stored
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
sentinel="$objectsDir/ThirdParty"
|
||||
|
||||
echo "$sentinel"
|
||||
|
||||
if read -r prev 2>/dev/null < $sentinel
|
||||
then
|
||||
if [ "$prev" = "$depend" ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
echo "${depend%=*} changed between builds" 1>&2
|
||||
return 1
|
||||
fi
|
||||
elif [ -f "$objectsDir/CMakeCache.txt" ]
|
||||
then
|
||||
echo "previous build was incomplete" 1>&2
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# CMake with output suppressed according to WM_QUIET
|
||||
_cmake()
|
||||
{
|
||||
echo "cmake..."
|
||||
if [ -n "$WM_QUIET" ]
|
||||
then
|
||||
echo "cmake..."
|
||||
cmake -DCMAKE_RULE_MESSAGES=OFF $@ >/dev/null
|
||||
else
|
||||
echo "cmake $@"
|
||||
cmake $@
|
||||
fi
|
||||
}
|
||||
@ -93,12 +66,13 @@ cmakeVersioned()
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
|
||||
# Version changed
|
||||
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||
sentinel=$(sameDependency "$sourceDir" "$depend" $@) || \
|
||||
rm -rf "$objectsDir" 2>/dev/null
|
||||
|
||||
mkdir -p "$objectsDir" \
|
||||
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make) \
|
||||
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
||||
&& ( cd "$objectsDir" && call_cmake "$@" "$sourceDir" && \
|
||||
make ) \
|
||||
&& storeDependency "$sentinel" "$depend" $@
|
||||
}
|
||||
|
||||
|
||||
@ -119,12 +93,13 @@ cmakeVersionedInstall()
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
|
||||
# Version changed
|
||||
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||
sentinel=$(sameDependency "$sourceDir" "$depend" $@) || \
|
||||
rm -rf "$objectsDir" 2>/dev/null
|
||||
|
||||
mkdir -p "$objectsDir" \
|
||||
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make install) \
|
||||
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
||||
&& ( cd "$objectsDir" && call_cmake "$@" "$sourceDir" && \
|
||||
make install ) \
|
||||
&& storeDependency "$sentinel" "$depend" $@
|
||||
}
|
||||
|
||||
|
||||
@ -146,12 +121,12 @@ wmakeVersioned()
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
|
||||
# Version changed
|
||||
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||
sentinel=$(sameDependency "$sourceDir" "$depend" $@) || \
|
||||
rm -rf "$objectsDir" 2>/dev/null
|
||||
|
||||
mkdir -p "$objectsDir" \
|
||||
&& wmake "$@" \
|
||||
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
||||
&& storeDependency "$sentinel" "$depend" $@
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_adios2
|
||||
@ -21,7 +20,8 @@
|
||||
# ADIOS2_ARCH_PATH
|
||||
#
|
||||
# Functions provided
|
||||
# have_adios2, no_adios2, echo_adios2
|
||||
# have_adios2, no_adios2, echo_adios2, query_adios2, search_adios2
|
||||
# hint_adios2
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_ADIOS2
|
||||
@ -30,15 +30,14 @@
|
||||
# ADIOS2_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_adios2()
|
||||
{
|
||||
unset HAVE_ADIOS2 ADIOS2_INC_DIR ADIOS2_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -46,32 +45,40 @@ no_adios2()
|
||||
echo_adios2()
|
||||
{
|
||||
echo "adios2=${HAVE_ADIOS2:-false}"
|
||||
echo "root=$ADIOS2_ARCH_PATH"
|
||||
echo "include=$ADIOS2_INC_DIR"
|
||||
echo "library=$ADIOS2_LIB_DIR"
|
||||
echo "root=\"$ADIOS2_ARCH_PATH\""
|
||||
echo "include=\"$ADIOS2_INC_DIR\""
|
||||
echo "library=\"$ADIOS2_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Hint for enabling
|
||||
hint_adios2()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> adios2 not found?
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
eval \$(foamEtcFile -sh -config adios2 -- -force)
|
||||
|
||||
==
|
||||
INFORMATION
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
|
||||
have_adios2()
|
||||
search_adios2()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
# warn="==> skip adios2"
|
||||
local warn # warn="==> skip adios2"
|
||||
local incName="adios2.h"
|
||||
local libName="libadios2"
|
||||
local libName2="libadios2_cxx11_mpi"
|
||||
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS2)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/ADIOS2 settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$ADIOS2_ARCH_PATH"
|
||||
incName="adios2.h"
|
||||
libName="libadios2"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -81,10 +88,10 @@ have_adios2()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -98,10 +105,10 @@ have_adios2()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName2") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -116,14 +123,59 @@ have_adios2()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_adios2
|
||||
# Output as per search_* function
|
||||
have_adios2()
|
||||
{
|
||||
local warn # warn="==> skip adios2"
|
||||
local config="config.sh/adios2"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_adios2 "$ADIOS2_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_adios2()
|
||||
{
|
||||
local config="config.sh/adios2"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query adios2 "$ADIOS2_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "adios2=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_adios2
|
||||
echo_adios2
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_adios2
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_adios2
|
||||
echo_adios2
|
||||
;;
|
||||
-query)
|
||||
query_adios2
|
||||
;;
|
||||
-hint)
|
||||
hint_adios2
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,23 +5,23 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_boost
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of Boost
|
||||
# Detection/setup of BOOST
|
||||
#
|
||||
# Requires
|
||||
# BOOST_ARCH_PATH
|
||||
# or config.sh/CGAL (when BOOST_ARCH_PATH is empty)
|
||||
#
|
||||
# Functions provided
|
||||
# have_boost, no_boost, echo_boost
|
||||
# have_boost, no_boost, echo_boost, query_boost, search_boost
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_BOOST
|
||||
@ -30,15 +30,14 @@
|
||||
# BOOST_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_boost()
|
||||
{
|
||||
unset HAVE_BOOST BOOST_INC_DIR BOOST_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -46,25 +45,25 @@ no_boost()
|
||||
echo_boost()
|
||||
{
|
||||
echo "boost=${HAVE_BOOST:-false}"
|
||||
echo "root=$BOOST_ARCH_PATH"
|
||||
echo "include=$BOOST_INC_DIR"
|
||||
echo "library=$BOOST_LIB_DIR"
|
||||
echo "root=\"$BOOST_ARCH_PATH\""
|
||||
echo "include=\"$BOOST_INC_DIR\""
|
||||
echo "library=\"$BOOST_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR
|
||||
have_boost()
|
||||
search_boost()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
# warn="==> skip boost"
|
||||
local warn # warn="==> skip boost"
|
||||
local incName="boost/version.hpp"
|
||||
local libName="libboost_system"
|
||||
|
||||
# Setup - from the current environment
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$BOOST_ARCH_PATH"
|
||||
incName="boost/version.hpp"
|
||||
libName="libboost_system"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -74,10 +73,10 @@ have_boost()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -91,10 +90,9 @@ have_boost()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -111,14 +109,60 @@ have_boost()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_boost
|
||||
# Output as per search_* function
|
||||
have_boost()
|
||||
{
|
||||
local warn # warn="==> skip boost"
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$BOOST_ARCH_PATH" ]
|
||||
then
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
search_boost "$BOOST_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings (from CGAL setup)
|
||||
query_boost()
|
||||
{
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query boost "$BOOST_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "boost=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_boost
|
||||
echo_boost
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_boost
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_boost
|
||||
echo_boost
|
||||
;;
|
||||
-query)
|
||||
query_boost
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,23 +5,22 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_ccmio
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of ccmio
|
||||
# Detection/setup of CCMIO
|
||||
#
|
||||
# Requires
|
||||
# config.sh/ccmio
|
||||
#
|
||||
# Functions provided
|
||||
# have_ccmio, no_ccmio, echo_ccmio
|
||||
# have_ccmio, no_ccmio, echo_ccmio, query_ccmio, search_ccmio
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_CCMIO
|
||||
@ -30,48 +29,41 @@
|
||||
# CCMIO_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_ccmio()
|
||||
{
|
||||
unset HAVE_CCMIO CCMIO_INC_DIR CCMIO_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# Report
|
||||
echo_ccmio()
|
||||
{
|
||||
echo "ccmio=${HAVE_CCMIO:-false}"
|
||||
echo "root=$CCMIO_ARCH_PATH"
|
||||
echo "include=$CCMIO_INC_DIR"
|
||||
echo "library=$CCMIO_LIB_DIR"
|
||||
echo "root=\"$CCMIO_ARCH_PATH\""
|
||||
echo "include=\"$CCMIO_INC_DIR\""
|
||||
echo "library=\"$CCMIO_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR
|
||||
have_ccmio()
|
||||
search_ccmio()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
warn="==> skip ccmio"
|
||||
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/ccmio settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
local warn="==> skip ccmio"
|
||||
local incName="libccmio/ccmio.h"
|
||||
local libName="libccmio.a"
|
||||
# Link with static libccmio only (fewer issues)
|
||||
prefix="$CCMIO_ARCH_PATH"
|
||||
incName="libccmio/ccmio.h"
|
||||
libName="libccmio.a"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -81,7 +73,7 @@ have_ccmio()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
else
|
||||
unset prefix
|
||||
fi
|
||||
@ -94,10 +86,9 @@ have_ccmio()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -137,14 +128,56 @@ have_ccmio()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_ccmio
|
||||
# Output as per search_* function
|
||||
have_ccmio()
|
||||
{
|
||||
local warn="==> skip ccmio"
|
||||
local config="config.sh/ccmio"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_ccmio "$CCMIO_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_ccmio()
|
||||
{
|
||||
local config="config.sh/ccmio"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query ccmio "$CCMIO_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "ccmio=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_ccmio
|
||||
echo_ccmio
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_ccmio
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_ccmio
|
||||
echo_ccmio
|
||||
;;
|
||||
-query)
|
||||
query_ccmio
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_cgal
|
||||
@ -19,26 +18,30 @@
|
||||
#
|
||||
# Requires
|
||||
# CGAL_ARCH_PATH
|
||||
# or config.sh/CGAL (when CGAL_ARCH_PATH is empty)
|
||||
#
|
||||
# Functions provided
|
||||
# have_cgal, no_cgal, echo_cgal
|
||||
# have_cgal, no_cgal, echo_cgal, query_cgal
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_CGAL
|
||||
# CGAL_FLAVOUR (header, library, ...)
|
||||
# CGAL_ARCH_PATH
|
||||
# CGAL_INC_DIR
|
||||
# CGAL_LIB_DIR
|
||||
#
|
||||
# Uses
|
||||
# BOOST_ARCH_PATH and have_boost::search_boost()
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_boost # boost + system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_cgal()
|
||||
{
|
||||
unset HAVE_CGAL CGAL_INC_DIR CGAL_LIB_DIR
|
||||
return 0
|
||||
unset HAVE_CGAL CGAL_FLAVOUR CGAL_INC_DIR CGAL_LIB_DIR
|
||||
}
|
||||
|
||||
|
||||
@ -46,25 +49,26 @@ no_cgal()
|
||||
echo_cgal()
|
||||
{
|
||||
echo "cgal=${HAVE_CGAL:-false}"
|
||||
echo "root=$CGAL_ARCH_PATH"
|
||||
echo "include=$CGAL_INC_DIR"
|
||||
echo "library=$CGAL_LIB_DIR"
|
||||
echo "flavour=$CGAL_FLAVOUR"
|
||||
echo "root=\"$CGAL_ARCH_PATH\""
|
||||
echo "include=\"$CGAL_INC_DIR\""
|
||||
echo "library=\"$CGAL_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
|
||||
have_cgal()
|
||||
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR, CGAL_FLAVOUR
|
||||
search_cgal()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
# warn="==> skip cgal"
|
||||
local warn # warn="==> skip cgal"
|
||||
local incName="CGAL/version.h"
|
||||
local libName="libCGAL"
|
||||
|
||||
# Setup - from the current environment
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$CGAL_ARCH_PATH"
|
||||
incName="CGAL/version.h"
|
||||
libName="libCGAL"
|
||||
local prefix="${1:-system}"
|
||||
local header library flavour
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -74,10 +78,10 @@ have_cgal()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -90,13 +94,13 @@ have_cgal()
|
||||
return 2
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
# Library may be optional - eg, header-only
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "==> cgal (no library)"
|
||||
unset library
|
||||
flavour="header" # Header only
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
@ -105,20 +109,70 @@ have_cgal()
|
||||
|
||||
# OK
|
||||
export HAVE_CGAL=true
|
||||
export CGAL_FLAVOUR="${flavour:-library}"
|
||||
export CGAL_ARCH_PATH="$prefix"
|
||||
export CGAL_INC_DIR="${header%/*}" # Basename
|
||||
export CGAL_LIB_DIR="${library%/*}" # Basename
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_cgal
|
||||
# Output as per search_* function
|
||||
have_cgal()
|
||||
{
|
||||
local warn # warn="==> skip cgal"
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$CGAL_ARCH_PATH" ]
|
||||
then
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Need boost for cgal
|
||||
search_boost "$BOOST_ARCH_PATH"
|
||||
|
||||
search_cgal "$CGAL_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings (from CGAL setup)
|
||||
query_cgal()
|
||||
{
|
||||
local config="config.sh/CGAL"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query cgal "$CGAL_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "cgal=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_cgal
|
||||
echo_cgal
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_cgal
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_cgal
|
||||
echo_cgal
|
||||
;;
|
||||
-query)
|
||||
query_cgal
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_fftw
|
||||
@ -19,9 +18,10 @@
|
||||
#
|
||||
# Requires
|
||||
# FFTW_ARCH_PATH
|
||||
# or config.sh/FFTW (when FFTW_ARCH_PATH is empty)
|
||||
#
|
||||
# Functions provided
|
||||
# have_fftw, no_fftw, echo_fftw
|
||||
# have_fftw, no_fftw, echo_fftw, query_fftw, search_fftw
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_FFTW
|
||||
@ -30,15 +30,14 @@
|
||||
# FFTW_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_fftw()
|
||||
{
|
||||
unset HAVE_FFTW FFTW_INC_DIR FFTW_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -46,25 +45,26 @@ no_fftw()
|
||||
echo_fftw()
|
||||
{
|
||||
echo "fftw=${HAVE_FFTW:-false}"
|
||||
echo "root=$FFTW_ARCH_PATH"
|
||||
echo "include=$FFTW_INC_DIR"
|
||||
echo "library=$FFTW_LIB_DIR"
|
||||
echo "root=\"$FFTW_ARCH_PATH\""
|
||||
echo "include=\"$FFTW_INC_DIR\""
|
||||
echo "library=\"$FFTW_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR
|
||||
have_fftw()
|
||||
search_fftw()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
# warn="==> skip fftw"
|
||||
local warn # warn="==> skip fftw"
|
||||
local incName="fftw3.h"
|
||||
local libName="libfftw3"
|
||||
|
||||
# Setup - from the current environment
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$FFTW_ARCH_PATH"
|
||||
incName="fftw3.h"
|
||||
libName="libfftw3"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -74,10 +74,10 @@ have_fftw()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -91,10 +91,9 @@ have_fftw()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -109,14 +108,60 @@ have_fftw()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_fftw
|
||||
# Output as per search_* function
|
||||
have_fftw()
|
||||
{
|
||||
local warn # warn="==> skip fftw"
|
||||
local config="config.sh/FFTW"
|
||||
local file
|
||||
|
||||
# Setup - current environment if set
|
||||
if [ -z "$FFTW_ARCH_PATH" ]
|
||||
then
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
search_fftw "$FFTW_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_fftw()
|
||||
{
|
||||
local config="config.sh/FFTW"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query fftw "$FFTW_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "fftw=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_fftw
|
||||
echo_fftw
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_fftw
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_fftw
|
||||
echo_fftw
|
||||
;;
|
||||
-query)
|
||||
query_fftw
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_hypre
|
||||
@ -19,9 +18,11 @@
|
||||
#
|
||||
# Requires
|
||||
# HYPRE_ARCH_PATH
|
||||
# or config.sh/hypre
|
||||
#
|
||||
# Functions provided
|
||||
# have_hypre, no_hypre, echo_hypre
|
||||
# have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre
|
||||
# hint_hypre
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_HYPRE
|
||||
@ -30,15 +31,14 @@
|
||||
# HYPRE_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_hypre()
|
||||
{
|
||||
unset HAVE_HYPRE HYPRE_INC_DIR HYPRE_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -46,35 +46,39 @@ no_hypre()
|
||||
echo_hypre()
|
||||
{
|
||||
echo "hypre=${HAVE_HYPRE:-false}"
|
||||
echo "root=$HYPRE_ARCH_PATH"
|
||||
echo "include=$HYPRE_INC_DIR"
|
||||
echo "library=$HYPRE_LIB_DIR"
|
||||
echo "root=\"$HYPRE_ARCH_PATH\""
|
||||
echo "include=\"$HYPRE_INC_DIR\""
|
||||
echo "library=\"$HYPRE_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Hint for enabling
|
||||
hint_hypre()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> hypre not found?
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
eval \$(foamEtcFile -sh -config hypre -- -force)
|
||||
|
||||
==
|
||||
INFORMATION
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_HYPRE, HYPRE_INC_DIR, HYPRE_LIB_DIR
|
||||
have_hypre()
|
||||
search_hypre()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
warn="==> skip hypre"
|
||||
local warn="==> skip hypre"
|
||||
local incName="HYPRE.h"
|
||||
local libName="libHYPRE"
|
||||
|
||||
# Setup - prefer current environment value? (TDB)
|
||||
if [ ! -d "$HYPRE_ARCH_PATH" ]
|
||||
then
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/hypre)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/hypre settings)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$HYPRE_ARCH_PATH"
|
||||
incName="HYPRE.h"
|
||||
libName="libHYPRE"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -84,10 +88,10 @@ have_hypre()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -101,10 +105,9 @@ have_hypre()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -119,14 +122,66 @@ have_hypre()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_hypre
|
||||
# Output as per search_* function
|
||||
have_hypre()
|
||||
{
|
||||
local warn="==> skip hypre"
|
||||
local config="config.sh/hypre"
|
||||
local file
|
||||
|
||||
# Setup - prefer current environment value
|
||||
if [ -d "$HYPRE_ARCH_PATH" ] || [ "$HYPRE_ARCH_PATH" = system ]
|
||||
then
|
||||
:
|
||||
else
|
||||
# Use config file
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
search_hypre "$HYPRE_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_hypre()
|
||||
{
|
||||
local config="config.sh/hypre"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query hypre "$HYPRE_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "hypre=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_hypre
|
||||
echo_hypre
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_hypre
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_hypre
|
||||
echo_hypre
|
||||
;;
|
||||
-query)
|
||||
query_hypre
|
||||
;;
|
||||
-hint)
|
||||
hint_hypre
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_kahip
|
||||
@ -21,7 +20,7 @@
|
||||
# config.sh/kahip
|
||||
#
|
||||
# Functions provided
|
||||
# have_kahip, no_kahip, echo_kahip
|
||||
# have_kahip, no_kahip, echo_kahip, query_kahip, search_kahip
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_KAHIP
|
||||
@ -30,16 +29,15 @@
|
||||
# KAHIP_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_kahip()
|
||||
{
|
||||
unset HAVE_KAHIP KAHIP_ARCH_PATH KAHIP_INC_DIR KAHIP_LIB_DIR
|
||||
unset KAHIP_VERSION
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -47,32 +45,25 @@ no_kahip()
|
||||
echo_kahip()
|
||||
{
|
||||
echo "kahip=${HAVE_KAHIP:-false}"
|
||||
echo "root=$KAHIP_ARCH_PATH"
|
||||
echo "include=$KAHIP_INC_DIR"
|
||||
echo "library=$KAHIP_LIB_DIR"
|
||||
echo "root=\"$KAHIP_ARCH_PATH\""
|
||||
echo "include=\"$KAHIP_INC_DIR\""
|
||||
echo "library=\"$KAHIP_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# 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 prefix header library incName libName settings warn
|
||||
warn="==> skip kahip"
|
||||
local warn="==> skip kahip"
|
||||
local incName="kaHIP_interface.h"
|
||||
local libName="libkahip"
|
||||
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/kahip)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/kahip settings)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$KAHIP_ARCH_PATH"
|
||||
incName="kaHIP_interface.h"
|
||||
libName="libkahip"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -82,10 +73,10 @@ have_kahip()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -99,17 +90,16 @@ have_kahip()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
# 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"
|
||||
@ -120,14 +110,56 @@ have_kahip()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_kahip
|
||||
# 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
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_kahip
|
||||
echo_kahip
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_kahip
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_kahip
|
||||
echo_kahip
|
||||
;;
|
||||
-query)
|
||||
query_kahip
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,23 +5,22 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_metis
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of metis
|
||||
# Detection/setup of METIS
|
||||
#
|
||||
# Requires
|
||||
# config.sh/metis
|
||||
#
|
||||
# Functions provided
|
||||
# have_metis, no_metis, echo_metis
|
||||
# have_metis, no_metis, echo_metis, query_metis, search_metis
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_METIS
|
||||
@ -30,16 +29,15 @@
|
||||
# METIS_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_metis()
|
||||
{
|
||||
unset HAVE_METIS METIS_ARCH_PATH METIS_INC_DIR METIS_LIB_DIR
|
||||
unset METIS_VERSION
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -47,32 +45,25 @@ no_metis()
|
||||
echo_metis()
|
||||
{
|
||||
echo "metis=${HAVE_METIS:-false}"
|
||||
echo "root=$METIS_ARCH_PATH"
|
||||
echo "include=$METIS_INC_DIR"
|
||||
echo "library=$METIS_LIB_DIR"
|
||||
echo "root=\"$METIS_ARCH_PATH\""
|
||||
echo "include=\"$METIS_INC_DIR\""
|
||||
echo "library=\"$METIS_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_METIS, METIS_ARCH_PATH, METIS_INC_DIR, METIS_LIB_DIR
|
||||
have_metis()
|
||||
search_metis()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
warn="==> skip metis"
|
||||
local warn="==> skip metis"
|
||||
local incName="metis.h"
|
||||
local libName="libmetis"
|
||||
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/metis settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$METIS_ARCH_PATH"
|
||||
incName="metis.h"
|
||||
libName="libmetis"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -82,10 +73,10 @@ have_metis()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -99,10 +90,9 @@ have_metis()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -127,14 +117,56 @@ have_metis()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_metis
|
||||
# Output as per search_* function
|
||||
have_metis()
|
||||
{
|
||||
local warn="==> skip metis"
|
||||
local config="config.sh/metis"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_metis "$METIS_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_metis()
|
||||
{
|
||||
local config="config.sh/metis"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query metis "$METIS_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "metis=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_metis
|
||||
echo_metis
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
no_metis
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_metis
|
||||
echo_metis
|
||||
;;
|
||||
-query)
|
||||
query_metis
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,23 +5,22 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_mgridgen
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of mgridgen
|
||||
# Detection/setup of MGRIDGEN
|
||||
#
|
||||
# Requires
|
||||
# config.sh/mgridgen
|
||||
#
|
||||
# Functions provided
|
||||
# have_mgridgen, no_mgridgen, echo_mgridgen
|
||||
# have_mgridgen, no_mgridgen, echo_mgridgen, query_mgridgen, search_mgridgen
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_MGRIDGEN
|
||||
@ -30,16 +29,15 @@
|
||||
# MGRIDGEN_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_mgridgen()
|
||||
{
|
||||
unset HAVE_MGRIDGEN MGRIDGEN_ARCH_PATH MGRIDGEN_INC_DIR MGRIDGEN_LIB_DIR
|
||||
unset MGRIDGEN_VERSION
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -47,33 +45,26 @@ no_mgridgen()
|
||||
echo_mgridgen()
|
||||
{
|
||||
echo "mgridgen=${HAVE_MGRIDGEN:-false}"
|
||||
echo "root=$MGRIDGEN_ARCH_PATH"
|
||||
echo "include=$MGRIDGEN_INC_DIR"
|
||||
echo "library=$MGRIDGEN_LIB_DIR"
|
||||
echo "root=\"$MGRIDGEN_ARCH_PATH\""
|
||||
echo "include=\"$MGRIDGEN_INC_DIR\""
|
||||
echo "library=\"$MGRIDGEN_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_MGRIDGEN, MGRIDGEN_ARCH_PATH, MGRIDGEN_INC_DIR, MGRIDGEN_LIB_DIR
|
||||
have_mgridgen()
|
||||
search_mgridgen()
|
||||
{
|
||||
local prefix header library incName libName libName2 settings warn
|
||||
warn="==> skip mgridgen"
|
||||
local warn="==> skip mgridgen"
|
||||
local incName="mgridgen.h"
|
||||
local libName="libMGridGen"
|
||||
local libName2="libmgrid"
|
||||
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/mgridgen)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
#silent# [ -n "$warn" ] && echo "$warn (no config.sh/mgridgen settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$MGRIDGEN_ARCH_PATH"
|
||||
incName="mgridgen.h"
|
||||
libName="libMGridGen"
|
||||
libName2="libmgrid"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -83,10 +74,10 @@ have_mgridgen()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName $libName2)"
|
||||
library=$(findExtLib "$libName" "$libName2")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -100,19 +91,17 @@ have_mgridgen()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib/$libName2" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName2" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName2") \
|
||||
|| {
|
||||
#silent# [ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
local good label scalar
|
||||
local label scalar
|
||||
|
||||
# Ensure consistent sizes with OpenFOAM and mgridgen header
|
||||
# Extract typedef for idxtype, realtype
|
||||
@ -128,7 +117,6 @@ have_mgridgen()
|
||||
|
||||
case "$WM_LABEL_SIZE:$label" in
|
||||
(32:int32_t | 32:int | 64:int64_t | 64:long)
|
||||
good=true
|
||||
;;
|
||||
|
||||
(*)
|
||||
@ -142,7 +130,6 @@ have_mgridgen()
|
||||
esac
|
||||
case "$WM_PRECISION_OPTION:$scalar" in
|
||||
(SP:float | SPDP:float | DP:double)
|
||||
good=true
|
||||
;;
|
||||
|
||||
(*)
|
||||
@ -165,14 +152,56 @@ have_mgridgen()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_mgridgen
|
||||
# Output as per search_* function
|
||||
have_mgridgen()
|
||||
{
|
||||
local warn="==> skip mgridgen"
|
||||
local config="config.sh/mgridgen"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
#silent# [ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_mgridgen "$MGRIDGEN_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_mgridgen()
|
||||
{
|
||||
local config="config.sh/mgridgen"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query mgridgen "$MGRIDGEN_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "mgridgen=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_mgridgen
|
||||
echo_mgridgen
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_mgridgen
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_mgridgen
|
||||
echo_mgridgen
|
||||
;;
|
||||
-query)
|
||||
query_mgridgen
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_petsc
|
||||
@ -19,9 +18,12 @@
|
||||
#
|
||||
# Requires
|
||||
# PETSC_ARCH_PATH
|
||||
# or PETSC_DIR, PETSC_ARCH
|
||||
# or config.sh/petsc
|
||||
#
|
||||
# Functions provided
|
||||
# have_petsc, no_petsc, echo_petsc
|
||||
# have_petsc, no_petsc, echo_petsc, query_petsc, search_petsc
|
||||
# hint_petsc
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_PETSC
|
||||
@ -30,51 +32,64 @@
|
||||
# PETSC_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_petsc()
|
||||
{
|
||||
unset HAVE_PETSC PETSC_INC_DIR PETSC_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# Reset variables
|
||||
# Report
|
||||
echo_petsc()
|
||||
{
|
||||
echo "petsc=${HAVE_PETSC:-false}"
|
||||
echo "root=$PETSC_ARCH_PATH"
|
||||
echo "include=$PETSC_INC_DIR"
|
||||
echo "library=$PETSC_LIB_DIR"
|
||||
echo "root=\"$PETSC_ARCH_PATH\""
|
||||
echo "include=\"$PETSC_INC_DIR\""
|
||||
echo "library=\"$PETSC_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Hint for enabling
|
||||
hint_petsc()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> petsc not found?
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
eval \$(foamEtcFile -sh -config petsc -- -force)
|
||||
|
||||
==
|
||||
INFORMATION
|
||||
}
|
||||
|
||||
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
|
||||
have_petsc()
|
||||
#
|
||||
# $1 = prefix (eg, PETSC_DIR, PETSC_ARCH_PATH)
|
||||
# $2 = [arch] (eg, PETSC_ARCH)
|
||||
#
|
||||
# Gets ugly with in-source installation.
|
||||
# 1) In the simple case, petsc is installed with --prefix
|
||||
# we find PREFIX/{include,lib}
|
||||
#
|
||||
# 2) With in-source installation,
|
||||
# headers in PETSC_DIR/include and PETSC_DIR/PETSC_ARCH/include
|
||||
# library is PETSC_DIR/PETSC_ARCH/lib*
|
||||
search_petsc()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
warn="==> skip petsc"
|
||||
local warn="==> skip petsc"
|
||||
local incName="petsc.h"
|
||||
local libName="libpetsc"
|
||||
local pkgName="PETSc"
|
||||
|
||||
# Setup - prefer current environment value? (TDB)
|
||||
if [ ! -d "$PETSC_ARCH_PATH" ]
|
||||
then
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/petsc)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/petsc settings)"
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$PETSC_ARCH_PATH"
|
||||
incName="petsc.h"
|
||||
libName="libpetsc"
|
||||
local prefix="${1:-system}"
|
||||
local arch="$2"
|
||||
local header library includeDirs libraryDirs
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -84,51 +99,144 @@ have_petsc()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
|
||||
# No system header, attempt discovery with pkg-config
|
||||
if [ -z "$header" ] && pkg-config --exists "$pkgName" 2>/dev/null
|
||||
then
|
||||
includeDirs=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||
libraryDirs=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||
|
||||
prefix="${includeDirs% *}" # First entry (ie, split on space)
|
||||
prefix="${prefix%/*}" # Basename
|
||||
fi
|
||||
else
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
# Header -> directory
|
||||
if [ -z "$includeDirs" ]
|
||||
then
|
||||
includeDirs="${header%/*}" # Basename
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
fi
|
||||
|
||||
# Library -> directory
|
||||
if [ -z "$libraryDirs" ]
|
||||
then
|
||||
if [ -n "$arch" ] && [ -d "$prefix/$arch" ]
|
||||
then
|
||||
# Prepend with petsc-arch/include
|
||||
if [ -d "$prefix/$arch/include" ]
|
||||
then
|
||||
includeDirs="$prefix/$arch/include${includeDirs:+ }$includeDirs"
|
||||
fi
|
||||
|
||||
# Prefer with petsc-arch/lib
|
||||
if [ -z "$library" ]
|
||||
then
|
||||
library=$(findLibrary -prefix="$prefix/$arch" -name="$libName")
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
libraryDirs="${library%/*}" # Basename
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# TODO: check size of petsc integer vs label
|
||||
# TODO: check size of petsc integer vs label, real vs double?
|
||||
|
||||
# OK
|
||||
export HAVE_PETSC=true
|
||||
export PETSC_ARCH_PATH="$prefix"
|
||||
export PETSC_INC_DIR="${header%/*}" # Basename
|
||||
export PETSC_LIB_DIR="${library%/*}" # Basename
|
||||
export PETSC_INC_DIR="$includeDirs"
|
||||
export PETSC_LIB_DIR="$libraryDirs"
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_petsc
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
|
||||
have_petsc()
|
||||
{
|
||||
local warn="==> skip petsc"
|
||||
local config="config.sh/petsc"
|
||||
local file
|
||||
|
||||
# Setup - prefer current environment value
|
||||
if [ -d "$PETSC_ARCH_PATH" ] || [ "$PETSC_ARCH_PATH" = system ]
|
||||
then
|
||||
# OpenFOAM prefix naming, possibly with petsc-arch
|
||||
search_petsc "$PETSC_ARCH_PATH" $PETSC_ARCH
|
||||
|
||||
elif [ -d "$PETSC_DIR" ]
|
||||
then
|
||||
# petsc-dir, petsc-arch naming
|
||||
search_petsc "$PETSC_DIR" $PETSC_ARCH
|
||||
|
||||
else
|
||||
# Use config file
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
search_petsc "$PETSC_ARCH_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_petsc()
|
||||
{
|
||||
local config="config.sh/petsc"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query petsc "$PETSC_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "petsc=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_petsc
|
||||
echo_petsc
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_petsc
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_petsc
|
||||
echo_petsc
|
||||
;;
|
||||
-query)
|
||||
query_petsc
|
||||
;;
|
||||
-hint)
|
||||
hint_petsc
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,23 +5,22 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_readline
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of readline
|
||||
# Detection/setup of READLINE
|
||||
#
|
||||
# Requires
|
||||
# None
|
||||
#
|
||||
# Functions provided
|
||||
# have_readline, no_readline, echo_readline
|
||||
# have_readline, no_readline, echo_readline, search_readline
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_LIBREADLINE - as per GNU autoconf
|
||||
@ -29,15 +28,14 @@
|
||||
# READLINE_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_readline()
|
||||
{
|
||||
unset HAVE_LIBREADLINE READLINE_INC_DIR READLINE_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -45,22 +43,24 @@ no_readline()
|
||||
echo_readline()
|
||||
{
|
||||
echo "readline=${HAVE_LIBREADLINE:-false}"
|
||||
echo "include=$READLINE_INC_DIR"
|
||||
echo "library=$READLINE_LIB_DIR"
|
||||
echo "include=\"$READLINE_INC_DIR\""
|
||||
echo "library=\"$READLINE_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_LIBREADLINE, READLINE_INC_DIR, READLINE_LIB_DIR
|
||||
have_readline()
|
||||
search_readline()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
# warn="==> skip readline"
|
||||
local warn # warn="==> skip readline"
|
||||
local incName="readline/readline.h"
|
||||
local libName="libreadline"
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix=system
|
||||
incName="readline/readline.h"
|
||||
libName="libreadline"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -70,10 +70,10 @@ have_readline()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -87,10 +87,9 @@ have_readline()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -106,14 +105,24 @@ have_readline()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_readline
|
||||
# Output as per search_* function
|
||||
have_readline()
|
||||
{
|
||||
search_readline system
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_readline
|
||||
echo_readline
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_readline
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_readline
|
||||
echo_readline
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,23 +5,22 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_scotch
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of scotch
|
||||
# Detection/setup of SCOTCH
|
||||
#
|
||||
# Requires
|
||||
# config.sh/scotch
|
||||
#
|
||||
# Functions provided
|
||||
# have_scotch, no_scotch, echo_scotch
|
||||
# have_ptscotch, search_ptscotch
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_SCOTCH
|
||||
@ -29,18 +28,67 @@
|
||||
# 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
|
||||
#
|
||||
#
|
||||
# System files can be hiding in a large variety of locations
|
||||
#
|
||||
# ArchLinux
|
||||
# ---------
|
||||
# scotch include=/usr/include/ptscotch
|
||||
#
|
||||
# ptscotch include=/usr/include/ptscotch
|
||||
#
|
||||
#
|
||||
# Debian/Ubuntu
|
||||
# -------------
|
||||
# scotch include=/usr/include/scotch-int32
|
||||
# scotch library=/usr/lib/x86_64-linux-gnu
|
||||
#
|
||||
# ptscotch include=/usr/include/scotch-int32
|
||||
# ptscotch library=/usr/lib/x86_64-linux-gnu
|
||||
#
|
||||
#
|
||||
# RedHat
|
||||
# ------
|
||||
# scotch include=/usr/include
|
||||
# scotch library=/usr/lib64
|
||||
#
|
||||
# ptscotch include=/usr/include/openmpi-x86_64
|
||||
# ptscotch library=/usr/lib64/openmpi/lib
|
||||
#
|
||||
# when MPI_ARCH_PATH=/usr/lib64/openmpi
|
||||
# and mpicc --showme:compile -> -I/usr/include/openmpi-x86_64
|
||||
#
|
||||
#
|
||||
# openSUSE
|
||||
# --------
|
||||
# scotch include=/usr/include
|
||||
# scotch library=/usr/lib64
|
||||
#
|
||||
# ptscotch include=/usr/lib64/mpi/gcc/openmpi2/include
|
||||
# ptscotch library=/usr/lib64/mpi/gcc/openmpi2/lib64
|
||||
#
|
||||
# when MPI_ARCH_PATH=/usr/lib64/mpi/gcc/openmpi2
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${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
|
||||
unset SCOTCH_VERSION
|
||||
unset HAVE_PTSCOTCH PTSCOTCH_ARCH_PATH PTSCOTCH_INC_DIR PTSCOTCH_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -48,37 +96,31 @@ no_scotch()
|
||||
echo_scotch()
|
||||
{
|
||||
echo "scotch=${HAVE_SCOTCH:-false}"
|
||||
echo "root=$SCOTCH_ARCH_PATH"
|
||||
echo "include=$SCOTCH_INC_DIR"
|
||||
echo "library=$SCOTCH_LIB_DIR"
|
||||
echo "root=\"$SCOTCH_ARCH_PATH\""
|
||||
echo "include=\"$SCOTCH_INC_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"
|
||||
echo "root=\"$PTSCOTCH_ARCH_PATH\""
|
||||
echo "include=\"$PTSCOTCH_INC_DIR\""
|
||||
echo "library=\"$PTSCOTCH_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# 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 prefix header library incName libName settings warn
|
||||
warn="==> skip scotch"
|
||||
local warn="==> skip scotch"
|
||||
local incName="scotch.h"
|
||||
local libName="libscotch"
|
||||
local localDir="scotch-int$WM_LABEL_SIZE"
|
||||
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/scotch settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$SCOTCH_ARCH_PATH"
|
||||
incName="scotch.h"
|
||||
libName="libscotch"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -87,13 +129,19 @@ have_scotch()
|
||||
return 1
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
header=$(findFirstFile \
|
||||
"$prefix/include/$localDir/$incName" \
|
||||
"$prefix/include/scotch/$incName" \
|
||||
"$prefix/include/$incName" \
|
||||
)
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile \
|
||||
"/usr/local/include/$localDir/$incName" \
|
||||
"/usr/local/include/scotch/$incName" \
|
||||
"/usr/local/include/$incName" \
|
||||
"/usr/include/$localDir/$incName" \
|
||||
"/usr/include/scotch/$incName" \
|
||||
"/usr/include/$incName" \
|
||||
)
|
||||
@ -102,6 +150,7 @@ have_scotch()
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
equalBaseName "${header%/*}" "$localDir" || unset localDir
|
||||
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
@ -110,17 +159,16 @@ have_scotch()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
|
||||
# ----------------------------------
|
||||
|
||||
local good label
|
||||
local label
|
||||
|
||||
# Ensure consistent sizes between OpenFOAM and scotch header
|
||||
# extract 'typedef int64_t SCOTCH_Num' or equivalent
|
||||
@ -148,7 +196,6 @@ have_scotch()
|
||||
|
||||
case "$WM_LABEL_SIZE:$label" in
|
||||
(32:int32_t | 32:int | 64:int64_t | 64:long)
|
||||
good=true
|
||||
;;
|
||||
|
||||
(*)
|
||||
@ -171,28 +218,23 @@ 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 prefix header library incName libName settings warn
|
||||
warn="==> skip ptscotch"
|
||||
local warn="==> skip ptscotch"
|
||||
local incName="ptscotch.h"
|
||||
local libName="libptscotch"
|
||||
local localDir="scotch-int$WM_LABEL_SIZE"
|
||||
|
||||
if [ "$HAVE_SCOTCH" != true ]
|
||||
then
|
||||
echo "$warn (no serial scotch available?)"
|
||||
return 1
|
||||
fi
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# Reuse old settings
|
||||
[ -n "$PTSCOTCH_ARCH_PATH" ] || PTSCOTCH_ARCH_PATH="$SCOTCH_ARCH_PATH"
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$PTSCOTCH_ARCH_PATH"
|
||||
incName="ptscotch.h"
|
||||
libName="libptscotch"
|
||||
local mpiPrefix="$MPI_ARCH_PATH"
|
||||
local mpiName="${MPI_ARCH_PATH##*/}"
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -203,25 +245,36 @@ have_ptscotch()
|
||||
then
|
||||
header=$(findFirstFile \
|
||||
"$prefix/include/$FOAM_MPI/$incName" \
|
||||
"$prefix/include/$incName"
|
||||
"$prefix/include/$localDir/$incName" \
|
||||
"$prefix/include/ptscotch/$incName" \
|
||||
"$prefix/include/scotch/$incName" \
|
||||
"$prefix/include/$incName" \
|
||||
"$mpiPrefix/include/$incName" \
|
||||
"$prefix/include/$mpiName/$incName" \
|
||||
"$prefix/include/${mpiName}-$(uname -m)/$incName" \
|
||||
)
|
||||
library="$(findExtLib $FOAM_MPI/$libName $libName)"
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
prefix=/usr
|
||||
header=$(findFirstFile \
|
||||
"/usr/local/include/$localDir/$incName" \
|
||||
"/usr/local/include/ptscotch/$incName" \
|
||||
"/usr/local/include/scotch/$incName" \
|
||||
"/usr/local/include/$incName" \
|
||||
"/usr/include/$localDir/$incName" \
|
||||
"/usr/include/ptscotch/$incName" \
|
||||
"/usr/include/scotch/$incName" \
|
||||
"/usr/include/$incName" \
|
||||
"$mpiPrefix/include/$incName" \
|
||||
"/usr/include/$mpiName/$incName" \
|
||||
"$prefix/include/${mpiName}-$(uname -m)/$incName" \
|
||||
)
|
||||
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
equalBaseName "${header%/*}" "$localDir" || unset localDir
|
||||
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
@ -230,10 +283,10 @@ have_ptscotch()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName" -local="$localDir") \
|
||||
|| library=$(findLibrary -prefix="$mpiPrefix" -name="$libName" -local="$localDir") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -249,14 +302,74 @@ have_ptscotch()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_scotch
|
||||
# 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
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_scotch && have_ptscotch
|
||||
echo_scotch
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_scotch
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_scotch && have_ptscotch
|
||||
echo_scotch
|
||||
;;
|
||||
-query)
|
||||
query_scotch
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,23 +5,22 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# have_zoltan
|
||||
#
|
||||
# Description
|
||||
# Detection/setup of zoltan
|
||||
# Detection/setup of ZOLTAN
|
||||
#
|
||||
# Requires
|
||||
# config.sh/zoltan
|
||||
#
|
||||
# Functions provided
|
||||
# have_zoltan, no_zoltan, echo_zoltan
|
||||
# have_zoltan, no_zoltan, echo_zoltan, query_zoltan, search_zoltan
|
||||
#
|
||||
# Variables set on success
|
||||
# HAVE_ZOLTAN
|
||||
@ -30,15 +29,14 @@
|
||||
# ZOLTAN_LIB_DIR
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset variables
|
||||
# Reset
|
||||
no_zoltan()
|
||||
{
|
||||
unset HAVE_ZOLTAN ZOLTAN_INC_DIR ZOLTAN_LIB_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -46,32 +44,25 @@ no_zoltan()
|
||||
echo_zoltan()
|
||||
{
|
||||
echo "zoltan=${HAVE_ZOLTAN:-false}"
|
||||
echo "root=$ZOLTAN_ARCH_PATH"
|
||||
echo "include=$ZOLTAN_INC_DIR"
|
||||
echo "library=$ZOLTAN_LIB_DIR"
|
||||
echo "root=\"$ZOLTAN_ARCH_PATH\""
|
||||
echo "include=\"$ZOLTAN_INC_DIR\""
|
||||
echo "library=\"$ZOLTAN_LIB_DIR\""
|
||||
}
|
||||
|
||||
|
||||
# Search
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
# On success, return 0 and export variables
|
||||
# -> HAVE_ZOLTAN, ZOLTAN_INC_DIR, ZOLTAN_LIB_DIR
|
||||
have_zoltan()
|
||||
search_zoltan()
|
||||
{
|
||||
local prefix header library incName libName settings warn
|
||||
# warn="==> skip zoltan"
|
||||
local warn # warn="==> skip zoltan"
|
||||
local incName="zoltan.h"
|
||||
local libName="libzoltan"
|
||||
|
||||
# Setup
|
||||
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/zoltan)
|
||||
then
|
||||
. "$settings"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no config.sh/zoltan settings)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
# Expected location, include/library names
|
||||
prefix="$ZOLTAN_ARCH_PATH"
|
||||
incName="zoltan.h"
|
||||
libName="libzoltan"
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -81,10 +72,10 @@ have_zoltan()
|
||||
elif hasAbsdir "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "$prefix/include/$incName")
|
||||
library="$(findExtLib $libName)"
|
||||
library=$(findExtLib "$libName")
|
||||
elif isSystem "$prefix"
|
||||
then
|
||||
header=$(findFirstFile "/usr/local/include/$incName" "/usr/include/$incName")
|
||||
header=$(findSystemInclude -name="$incName")
|
||||
prefix=$(sysPrefix "$header")
|
||||
else
|
||||
unset prefix
|
||||
@ -98,10 +89,9 @@ have_zoltan()
|
||||
}
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] || library=$(findLibrary \
|
||||
"$prefix/lib/$libName" \
|
||||
"$prefix/lib$WM_COMPILER_LIB_ARCH/$libName" \
|
||||
) || {
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
@ -116,14 +106,56 @@ have_zoltan()
|
||||
}
|
||||
|
||||
|
||||
# Force reset of old variables
|
||||
no_zoltan
|
||||
# Output as per search_* function
|
||||
have_zoltan()
|
||||
{
|
||||
local warn # warn="==> skip zoltan"
|
||||
local config="config.sh/zoltan"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
else
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
|
||||
search_zoltan "$ZOLTAN_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
# Query settings
|
||||
query_zoltan()
|
||||
{
|
||||
local config="config.sh/zoltan"
|
||||
local file
|
||||
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile -mode=o "$config")"
|
||||
then
|
||||
. "$file"
|
||||
_process_query zoltan "$ZOLTAN_ARCH_PATH"
|
||||
else
|
||||
echo "(no $config)" 1>&2
|
||||
echo "zoltan=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
have_zoltan
|
||||
echo_zoltan
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Reset
|
||||
no_zoltan
|
||||
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_zoltan
|
||||
echo_zoltan
|
||||
;;
|
||||
-query)
|
||||
query_zoltan
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# paraviewFunctions
|
||||
@ -19,12 +18,12 @@
|
||||
# Setup of variables for creating ParaView plugins
|
||||
#
|
||||
# Requires
|
||||
# ParaView_DIR (unless system)
|
||||
# PV_PLUGIN_PATH
|
||||
# ParaView_DIR (unless system)
|
||||
# PV_PLUGIN_PATH (or rely on automatic mechanism)
|
||||
#
|
||||
# Provides Functions
|
||||
# have_pvplugin_support, no_paraview, echo_paraview
|
||||
# cmakeVtk, cmakePv
|
||||
# get_pvplugin_api, have_pvplugin_support, no_paraview, echo_paraview
|
||||
# cmakeVtk, cmakePv, cmakePvInstall
|
||||
#
|
||||
# Variables on success
|
||||
# HAVE_PVPLUGIN_SUPPORT
|
||||
@ -37,8 +36,8 @@
|
||||
# paraview-major.minor encoded in its name.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
. $WM_PROJECT_DIR/wmake/scripts/sysFunctions # General system functions
|
||||
. $WM_PROJECT_DIR/wmake/scripts/cmakeFunctions # Require cmake functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/sysFunctions # General system functions
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/cmakeFunctions # Require cmake functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -47,7 +46,6 @@ no_paraview()
|
||||
{
|
||||
unset HAVE_PVPLUGIN_SUPPORT FOAM_PV_PLUGIN_LIBBIN
|
||||
unset PARAVIEW_API PARAVIEW_INC_DIR
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
@ -55,42 +53,123 @@ no_paraview()
|
||||
echo_paraview()
|
||||
{
|
||||
echo "paraview=${HAVE_PVPLUGIN_SUPPORT:-false}"
|
||||
echo "root=$ParaView_DIR"
|
||||
echo "include=$PARAVIEW_INC_DIR"
|
||||
echo "plugin=$FOAM_PV_PLUGIN_LIBBIN"
|
||||
echo "root=\"$ParaView_DIR\""
|
||||
echo "include=\"$PARAVIEW_INC_DIR\""
|
||||
echo "plugin=\"$FOAM_PV_PLUGIN_LIBBIN\""
|
||||
echo "api=$PARAVIEW_API"
|
||||
}
|
||||
|
||||
|
||||
# CMake into objectsDir with VTK_DIR dependency
|
||||
# 1 - sourceDir
|
||||
# 2.. optional cmake defines
|
||||
cmakeVtk()
|
||||
{
|
||||
cmakeVersioned "VTK_DIR=$VTK_DIR" "$1"
|
||||
cmakeVersioned "VTK_DIR=$VTK_DIR" "$@"
|
||||
}
|
||||
|
||||
|
||||
# CMake into objectsDir with ParaView_DIR dependency
|
||||
# 1 - sourceDir
|
||||
# 2.. optional cmake defines
|
||||
cmakePv()
|
||||
{
|
||||
cmakeVersioned "ParaView_DIR=$ParaView_DIR" "$1"
|
||||
cmakeVersioned "ParaView_DIR=$ParaView_DIR" "$@"
|
||||
}
|
||||
|
||||
#
|
||||
# CMake into objectsDir with ParaView_DIR dependency
|
||||
# 1 - sourceDir
|
||||
# 2.. optional cmake defines
|
||||
cmakePvInstall()
|
||||
{
|
||||
cmakeVersionedInstall "ParaView_DIR=$ParaView_DIR" "$@"
|
||||
}
|
||||
|
||||
|
||||
# Build library - use sentinel file(s) to handle paraview version changes
|
||||
# Some difficulty handling different installation options as well
|
||||
# as wmake options, so only handle build/configure information for now
|
||||
#
|
||||
# 1 - libName
|
||||
# 2... build/configure information
|
||||
#
|
||||
# Similar to wmakeVersioned
|
||||
wmakeLibPv()
|
||||
{
|
||||
local depend="ParaView_DIR=$ParaView_DIR"
|
||||
local libName="$1"
|
||||
shift 1
|
||||
local sentinel
|
||||
|
||||
for libName
|
||||
do
|
||||
sentinel=$(sameDependency "$depend" $libName) || \
|
||||
wclean $libName
|
||||
sentinel=$(sameDependency "$libName" "$depend" $@) || \
|
||||
wclean "$libName"
|
||||
|
||||
wmake $targetType $libName \
|
||||
&& echo "$depend" > ${sentinel:-/dev/null}
|
||||
done
|
||||
wmake $targetType "$libName" \
|
||||
&& storeDependency "$sentinel" "$depend" $@
|
||||
}
|
||||
|
||||
# Get ParaView API from given path.
|
||||
# Eg, "/path/paraview-dir/paraview-5.6" -> "5.6"
|
||||
#
|
||||
# Or the output from `paraview --version`
|
||||
# Eg, "paraview version 5.6.3" -> "5.6"
|
||||
#
|
||||
# 1 - the input path ending with paraview-x.y, or paraview --version information
|
||||
#
|
||||
# On success, return 0 and echo value
|
||||
#
|
||||
get_pvapi()
|
||||
{
|
||||
local pv_api
|
||||
|
||||
# Extract paraview major+minor version from the directory name
|
||||
# From /path/paraview-5.6 -> 5.6
|
||||
pv_api=$(echo "${1:-none}" | \
|
||||
sed -ne 's@^.*/@@;s@^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$@\1@p')
|
||||
|
||||
if [ -z "$pv_api" ]
|
||||
then
|
||||
# Extract paraview major+minor version from "paraview --version" information
|
||||
pv_api=$(echo "${1:-none}" | \
|
||||
sed -ne 's@^.*version *\([0-9][0-9]*\.[0-9][0-9]*\).*$@\1@p')
|
||||
fi
|
||||
|
||||
[ -n "$pv_api" ] || return 1
|
||||
|
||||
# OK
|
||||
echo "$pv_api"
|
||||
}
|
||||
|
||||
|
||||
# Extract ParaView plugin api number from PV_PLUGIN_PATH
|
||||
# On success, return 0 and export variables
|
||||
# -> FOAM_PV_PLUGIN_LIBBIN, PARAVIEW_API
|
||||
#
|
||||
get_pvplugin_api()
|
||||
{
|
||||
# OK
|
||||
unset FOAM_PV_PLUGIN_LIBBIN PARAVIEW_API
|
||||
local pv_api targetDir
|
||||
|
||||
# The OpenFOAM plugin must be the first in PV_PLUGIN_PATH
|
||||
# and must have the paraview major+minor version encoded in its name!
|
||||
# Eg, PV_PLUGIN_PATH="$FOAM_LIBBIN/paraview-5.5"
|
||||
|
||||
# Get the first entry from PV_PLUGIN_PATH=dir1;dir2;...
|
||||
targetDir="${PV_PLUGIN_PATH##;}"
|
||||
targetDir="${targetDir%%;*}"
|
||||
|
||||
# Extract paraview major+minor version from directory name
|
||||
# From /path/paraview-5.6 -> 5.6
|
||||
pv_api=$(get_pvapi "$targetDir")
|
||||
|
||||
[ -n "$pv_api" ] || return 1
|
||||
|
||||
# OK
|
||||
export FOAM_PV_PLUGIN_LIBBIN="$targetDir"
|
||||
export PARAVIEW_API="$pv_api"
|
||||
|
||||
return 0 # success
|
||||
}
|
||||
|
||||
|
||||
@ -103,47 +182,52 @@ wmakeLibPv()
|
||||
#
|
||||
have_pvplugin_support()
|
||||
{
|
||||
local header settings warn pv_api installDir binDir includeDir targetDir
|
||||
warn="==> skip paraview-plugin"
|
||||
local warn="==> skip paraview-plugin"
|
||||
local settings pv_api pv_executable installDir binDir includeDir targetDir
|
||||
|
||||
# Trivial check
|
||||
command -v cmake > /dev/null 2>&1 || {
|
||||
command -v cmake >/dev/null || {
|
||||
echo "$warn (no cmake)"
|
||||
return 1
|
||||
}
|
||||
|
||||
if get_pvplugin_api
|
||||
then
|
||||
targetDir="$FOAM_PV_PLUGIN_LIBBIN"
|
||||
pv_api="$PARAVIEW_API"
|
||||
fi
|
||||
unset FOAM_PV_PLUGIN_LIBBIN PARAVIEW_API
|
||||
|
||||
# The OpenFOAM plugin must be the first in PV_PLUGIN_PATH
|
||||
# and must have the paraview major+minor version encoded in its name!
|
||||
# Eg, PV_PLUGIN_PATH="$FOAM_LIBBIN/paraview-5.5"
|
||||
|
||||
# Get the first entry from PV_PLUGIN_PATH=dir1;dir2;...
|
||||
targetDir="${PV_PLUGIN_PATH##;}"
|
||||
targetDir="${targetDir%%;*}"
|
||||
|
||||
# Extract the paraview major+minor version from the directory name
|
||||
# From /path/paraview-5.6 -> 5.6
|
||||
pv_api=$(echo "$targetDir" | \
|
||||
sed -ne 's@^.*/@@;s/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p')
|
||||
|
||||
[ -n "$targetDir" ] || {
|
||||
echo "$warn (could not determine target)"
|
||||
echo " PV_PLUGIN_PATH=${PV_PLUGIN_PATH:-???}"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$pv_api" ] || {
|
||||
echo "$warn (could not determine major.minor version)"
|
||||
return 1
|
||||
}
|
||||
# Probably not needed...
|
||||
# if [ -z "$targetDir" ] || [ -z "$pv_api" ]
|
||||
# then
|
||||
# echo "$warn (could not determine target or major.minor version)"
|
||||
# echo " PV_PLUGIN_PATH=${PV_PLUGIN_PATH:-???}"
|
||||
# return 1
|
||||
# fi
|
||||
|
||||
# Include/library names
|
||||
header="pqServerManagerModel.h"
|
||||
local header="pqServerManagerModel.h"
|
||||
|
||||
if [ -n "$ParaView_DIR" ]
|
||||
then
|
||||
# ParaView_DIR defined. Look for include/
|
||||
|
||||
# Unless already known, get API value from include directory name
|
||||
if [ -z "$pv_api" ]
|
||||
then
|
||||
for settings in $(find "$ParaView_DIR"/include -maxdepth 1 -name 'paraview-*' -type d)
|
||||
do
|
||||
pv_api=$(get_pvapi "$settings") && break
|
||||
done
|
||||
|
||||
if [ -z "$pv_api" ]
|
||||
then
|
||||
echo "$warn (could not determine paraview major.minor version)"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
header=$(findFirstFile \
|
||||
"$ParaView_DIR/include/paraview-$pv_api/$header" \
|
||||
"$ParaView_DIR/include/paraview/$header"
|
||||
@ -152,11 +236,14 @@ have_pvplugin_support()
|
||||
else
|
||||
# No ParaView_DIR defined
|
||||
# - use location of 'paraview' to guess an equivalent ParaView_DIR
|
||||
# - assume we can use paraview-config
|
||||
# - assume paraview-config works, but might be removed too!
|
||||
|
||||
binDir="$(command -v paraview 2>/dev/null)"
|
||||
binDir="${binDir%/*}" # Eg, /usr/bin/paraview -> /usr/bin
|
||||
installDir="${binDir%/*}" # Eg, /usr/bin -> /usr
|
||||
pv_executable="$(command -v paraview 2>/dev/null)" || {
|
||||
echo "$warn (no paraview found?)"
|
||||
return 2
|
||||
}
|
||||
binDir="${pv_executable%/*}" # Eg, /usr/bin/paraview -> /usr/bin
|
||||
installDir="${binDir%/*}" # Eg, /usr/bin -> /usr
|
||||
|
||||
case "$installDir" in
|
||||
(/*) # An absolute path
|
||||
@ -164,6 +251,17 @@ have_pvplugin_support()
|
||||
;;
|
||||
esac
|
||||
|
||||
# Unless already known, get API value from `paraview --version` information
|
||||
if [ -z "$pv_api" ]
|
||||
then
|
||||
pv_api=$(get_pvapi "$("$pv_executable" --version)")
|
||||
if [ -z "$pv_api" ]
|
||||
then
|
||||
echo "$warn (could not determine paraview major.minor version)"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
header=$(findFirstFile \
|
||||
"$(paraview-config --include 2>/dev/null |sed -ne 's/^ *-I//p')/$header"\
|
||||
"${includeDir:+$includeDir/paraview-$pv_api/$header}" \
|
||||
@ -186,8 +284,9 @@ have_pvplugin_support()
|
||||
# ----------------------------------
|
||||
|
||||
# OK
|
||||
# Use FOAM_LIBBIN/paraview-maj.min as default
|
||||
export HAVE_PVPLUGIN_SUPPORT=true
|
||||
export FOAM_PV_PLUGIN_LIBBIN="$targetDir"
|
||||
export FOAM_PV_PLUGIN_LIBBIN="${targetDir:-$FOAM_LIBBIN/paraview-$pv_api}"
|
||||
export PARAVIEW_API="$pv_api"
|
||||
export PARAVIEW_INC_DIR="${header%/*}" # Basename
|
||||
|
||||
@ -198,11 +297,15 @@ have_pvplugin_support()
|
||||
# Force reset of old variables
|
||||
no_paraview
|
||||
|
||||
# Testing
|
||||
if [ "$1" = "-test" ]
|
||||
then
|
||||
# Test/query
|
||||
case "$1" in
|
||||
-test)
|
||||
have_pvplugin_support
|
||||
echo_paraview
|
||||
fi
|
||||
;;
|
||||
-query)
|
||||
## query_paraview
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
# isNone, isSystem, isAbsdir, hasAbsdir
|
||||
# isDarwin, isWindows
|
||||
# findFirstFile
|
||||
# findSystemInclude
|
||||
# findLibrary
|
||||
# findExtLib
|
||||
# versionCompare
|
||||
@ -27,6 +28,11 @@
|
||||
# Internal variables used
|
||||
# extLibraries
|
||||
#
|
||||
# External variables used
|
||||
# WM_OSTYPE (is set for Windows)
|
||||
# WM_COMPILER_LIB_ARCH
|
||||
# DEB_TARGET_MULTIARCH
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$WMAKE_SCRIPTS_SYSFUNCTIONS" ]
|
||||
@ -34,14 +40,19 @@ then
|
||||
# Load once, but do not rely on this variable elsewhere
|
||||
WMAKE_SCRIPTS_SYSFUNCTIONS=loaded
|
||||
|
||||
# Debian multi-arch, ignore missing/bad dpkg-architecture.
|
||||
if [ -z "$DEB_TARGET_MULTIARCH" ]
|
||||
then
|
||||
DEB_TARGET_MULTIARCH=$(dpkg-architecture -qDEB_TARGET_MULTIARCH 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
# True if OS is Darwin.
|
||||
isDarwin()
|
||||
{
|
||||
test Darwin = "$(uname -s 2>/dev/null)"
|
||||
test Darwin = "$(uname -s 2>/dev/null || true)"
|
||||
}
|
||||
|
||||
# True if target OS is Windows
|
||||
# Uses cached value from libso extension
|
||||
isWindows()
|
||||
{
|
||||
test MSwindows = "$WM_OSTYPE"
|
||||
@ -58,7 +69,6 @@ then
|
||||
extLibraries=".a .dll .dll.a" # including cross-compiling
|
||||
fi
|
||||
|
||||
|
||||
# True if '$1' begins with '/'
|
||||
isAbsdir()
|
||||
{
|
||||
@ -91,6 +101,35 @@ then
|
||||
}
|
||||
|
||||
|
||||
# True if '$1' and '$2' have the same directory basename
|
||||
# Eg,
|
||||
# equalBaseName "/usr/include/scotch-int32" "scotch-int32"
|
||||
equalBaseName()
|
||||
{
|
||||
test "${1##*/}" = "${2##*/}"
|
||||
}
|
||||
|
||||
|
||||
# Simple output for -query
|
||||
# $1 = software
|
||||
# $2 = setting
|
||||
_process_query()
|
||||
{
|
||||
if isNone "$2"
|
||||
then
|
||||
echo "$1=none"
|
||||
elif isAbsdir "$2" ## not hasAbsdir
|
||||
then
|
||||
echo "$1=${2##*/}"
|
||||
elif isSystem "$2"
|
||||
then
|
||||
echo "$1=system"
|
||||
else
|
||||
echo "$1=unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Return system prefix (/usr, /usr/local, ...) based on hint provided
|
||||
# Eg,
|
||||
# sysPrefix "/usr/local/include/fftw3.h" -> "/usr/local"
|
||||
@ -126,27 +165,132 @@ then
|
||||
return 2
|
||||
}
|
||||
|
||||
# Check system /usr/local/include /usr/include paths
|
||||
#
|
||||
# On success, echoes the resolved file and returns 0, otherwise returns 2
|
||||
#
|
||||
# Specify -name=incName to search for
|
||||
#
|
||||
findSystemInclude()
|
||||
{
|
||||
local searchName
|
||||
|
||||
case "$1" in
|
||||
-name=*)
|
||||
searchName="${1#*=}"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$searchName" ]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
findFirstFile \
|
||||
"/usr/local/include/$searchName" \
|
||||
"/usr/include/$searchName" \
|
||||
;
|
||||
}
|
||||
|
||||
# Check existence of library with ending '.a', '.so' ...
|
||||
#
|
||||
# On success, echoes the resolved file and returns 0, otherwise returns 2
|
||||
#
|
||||
# This function has two modes of operation.
|
||||
#
|
||||
# 1) Automated search.
|
||||
# Specify -prefix=dirName -name=libName, optionally -local=subdirName
|
||||
# and search for (lib, lib64, lib/x86_64..) etc.
|
||||
#
|
||||
# 2) Directed search.
|
||||
# specify the fully qualified names to search on the parameter list
|
||||
#
|
||||
findLibrary()
|
||||
{
|
||||
local prefixDir localDir searchDir searchName
|
||||
local file ext
|
||||
|
||||
for file
|
||||
searchDir=true
|
||||
|
||||
while [ "$searchDir" = true ] && [ "$#" -gt 0 ]
|
||||
do
|
||||
[ -n "$file" ] || continue
|
||||
for ext in '' $extLibraries
|
||||
do
|
||||
if [ -f "$file$ext" ] && [ -r "$file$ext" ]
|
||||
then
|
||||
echo "$file$ext" # Found
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
case "$1" in
|
||||
-prefix=*)
|
||||
prefixDir="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
-local=*)
|
||||
# Prefix with directory separator
|
||||
localDir="/${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
-name=*)
|
||||
searchName="${1#*=}"
|
||||
shift
|
||||
;;
|
||||
|
||||
(*)
|
||||
unset searchDir
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$searchName" ]
|
||||
then
|
||||
# Automated search (eg, lib/ lib64/, lib/x86_64-linux-gnu)
|
||||
# but also handle possible local versions (eg, lib/scotch-int32)
|
||||
|
||||
: "${prefixDir:=/usr}" # A reasonable default
|
||||
[ -d "$prefixDir" ] || return 2
|
||||
|
||||
# Local and regular search paths
|
||||
set -- \
|
||||
"lib${localDir}" \
|
||||
"${WM_COMPILER_LIB_ARCH:+lib${WM_COMPILER_LIB_ARCH}${localDir}}" \
|
||||
"${DEB_TARGET_MULTIARCH:+lib/${DEB_TARGET_MULTIARCH}${localDir}}" \
|
||||
"lib" \
|
||||
"${WM_COMPILER_LIB_ARCH:+lib${WM_COMPILER_LIB_ARCH}}" \
|
||||
"${DEB_TARGET_MULTIARCH:+lib/${DEB_TARGET_MULTIARCH}}" \
|
||||
;
|
||||
|
||||
# Ignore empty local search path ("/")
|
||||
[ "${#localDir}" -gt 1 ] || shift 3
|
||||
|
||||
## echo "search: $# $@" 1>&2
|
||||
|
||||
for searchDir in "$@"
|
||||
do
|
||||
[ -n "$searchDir" ] || continue
|
||||
for ext in '' $extLibraries
|
||||
do
|
||||
file="$prefixDir/$searchDir/$searchName$ext"
|
||||
if [ -f "$file" ] && [ -r "$file" ]
|
||||
then
|
||||
echo "$file" # Found
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
else
|
||||
# Directed search
|
||||
|
||||
for file
|
||||
do
|
||||
[ -n "$file" ] || continue
|
||||
for ext in '' $extLibraries
|
||||
do
|
||||
if [ -f "$file$ext" ] && [ -r "$file$ext" ]
|
||||
then
|
||||
echo "$file$ext" # Found
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
@ -6,17 +6,19 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# Script
|
||||
# wmakeFunctions
|
||||
#
|
||||
# Description
|
||||
# Functions to check wmake environment and find .dep and .o files
|
||||
# Support functions for wmake infrastructure.
|
||||
# For example, check environment, find .dep and .o files, various
|
||||
# wrappers when making libraries.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Ensure these variables are always defined
|
||||
@ -31,17 +33,18 @@ then
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Check environment variables
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Check environment variables
|
||||
checkEnv()
|
||||
{
|
||||
local check failed
|
||||
|
||||
for check in WM_PROJECT_DIR WM_OPTIONS WM_DIR
|
||||
# Default for WM_DIR already provided above
|
||||
|
||||
for check in WM_PROJECT_DIR WM_OPTIONS
|
||||
do
|
||||
eval test "\$$check" || failed="$failed $check"
|
||||
eval test -n "\$$check" || failed="$failed $check"
|
||||
done
|
||||
|
||||
[ -z "$failed" ] || {
|
||||
@ -52,11 +55,8 @@ checkEnv()
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Search up directories tree for the Make sub-directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Return the absolute path for a directory or a file's parent directory
|
||||
# Return the absolute (physical) path for a directory or
|
||||
# for a file's parent directory
|
||||
# expandPath dirName
|
||||
# expandPath fileName
|
||||
#
|
||||
@ -69,12 +69,13 @@ expandPath()
|
||||
(cd "$1" && pwd -P)
|
||||
elif [ -n "$1" ]
|
||||
then
|
||||
(cd $(dirname "$1") && pwd -P)
|
||||
(cd "$(dirname "$1")" && pwd -P)
|
||||
else
|
||||
pwd -P
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Find the target directory, which contains a Make/ directory
|
||||
# search upwards in its parent directories, but stopping
|
||||
# when it hits the project root, home, or the file-system root
|
||||
@ -88,15 +89,15 @@ expandPath()
|
||||
# - WM_PROJECT_DIR, HOME
|
||||
findTarget()
|
||||
{
|
||||
local project=$(expandPath $WM_PROJECT_DIR)
|
||||
local home=$(expandPath $HOME)
|
||||
local project=$(expandPath "$WM_PROJECT_DIR")
|
||||
local home=$(expandPath "$HOME")
|
||||
local reldir="${1:-.}"
|
||||
local absdir=$(expandPath $reldir)
|
||||
local absdir=$(expandPath "$reldir")
|
||||
|
||||
while [ -n "$absdir" ]
|
||||
do
|
||||
case "$absdir" in
|
||||
($project | $home | /)
|
||||
("$project" | "$home" | /)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
@ -112,7 +113,7 @@ findTarget()
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Error: no Make directory for $(expandPath $1)" 1>&2
|
||||
echo "Error: no Make directory for $(expandPath "$1")" 1>&2
|
||||
echo 1>&2
|
||||
return 1
|
||||
}
|
||||
@ -132,14 +133,14 @@ cdSource()
|
||||
echo " Searching up directories tree for Make directory" 1>&2
|
||||
|
||||
dir=$(findTarget .) || exit 1 # Fatal
|
||||
cd $dir 2>/dev/null || {
|
||||
cd "$dir" 2>/dev/null || {
|
||||
echo "$Script error: could not change to directory '$dir'" 1>&2
|
||||
exit 1
|
||||
}
|
||||
unset targetType
|
||||
fi
|
||||
|
||||
[ -r $MakeDir/files ] || {
|
||||
[ -r "$MakeDir"/files ] || {
|
||||
echo "$Script error: file '$MakeDir/files' does not exist in $PWD" 1>&2
|
||||
exit 1
|
||||
}
|
||||
@ -157,23 +158,34 @@ cdSource()
|
||||
# - WM_PROJECT_DIR, WM_OPTIONS
|
||||
findObjectDir()
|
||||
{
|
||||
local project=$(expandPath $WM_PROJECT_DIR)
|
||||
local absdir=$(expandPath ${1:-.})
|
||||
local objectsDir
|
||||
local project="$(expandPath "$WM_PROJECT_DIR")"
|
||||
local absdir="$(expandPath "${1:-.}")"
|
||||
local appDir relativeDir objectsDir
|
||||
|
||||
case "$absdir" in
|
||||
("$project"/*)
|
||||
local buildPath=$WM_PROJECT_DIR/build/${WM_OPTIONS}
|
||||
objectsDir=$buildPath$(echo $absdir | sed s%$project%% )
|
||||
;;
|
||||
(*)
|
||||
local path=$absdir
|
||||
local appDir=.
|
||||
[ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal
|
||||
absdir=$(expandPath $appDir/.)
|
||||
objectsDir=$appDir/Make/${WM_OPTIONS}$(echo $path | sed s%$absdir%% )
|
||||
;;
|
||||
esac
|
||||
# Treat project/ builds as out-of-source
|
||||
relativeDir="${absdir#${project}/}"
|
||||
if [ "$relativeDir" != "$absdir" ]
|
||||
then
|
||||
[ -w "$WM_PROJECT_DIR" ] && \
|
||||
objectsDir="${WM_PROJECT_DIR}/build/${WM_OPTIONS}/${relativeDir}"
|
||||
fi
|
||||
|
||||
# Default (local) build directory
|
||||
if [ -z "$objectsDir" ]
|
||||
then
|
||||
if [ -d "$absdir/Make" ]
|
||||
then
|
||||
objectsDir="${absdir}/Make/${WM_OPTIONS}"
|
||||
else
|
||||
relativeDir="$absdir"
|
||||
appDir=.
|
||||
[ -d Make ] || appDir=$(findTarget .) || exit 1 # Fatal
|
||||
absdir=$(expandPath "$appDir"/.)
|
||||
|
||||
relativeDir="${relativeDir#${absdir}}"
|
||||
objectsDir="${appDir}/Make/${WM_OPTIONS}${relativeDir}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$objectsDir"
|
||||
}
|
||||
@ -190,14 +202,147 @@ findObjectDir()
|
||||
# - WM_PROJECT_DIR, WM_OPTIONS
|
||||
removeObjectDir()
|
||||
{
|
||||
local objectsDir=$(findObjectDir ${1:-.})
|
||||
local objectsDir="$(findObjectDir "${1:-.}")"
|
||||
if [ -d "$objectsDir" ]
|
||||
then
|
||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||
rm -rf "$objectsDir" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Save build/configure parameter information (dependency) into sentinel file
|
||||
#
|
||||
# 1 - sentinelFile
|
||||
# 2... build/configure parameters
|
||||
#
|
||||
storeDependency()
|
||||
{
|
||||
local sentinel="$1"
|
||||
local depend
|
||||
shift
|
||||
|
||||
if [ -n "$sentinel" ]
|
||||
then
|
||||
mkdir -p "$(dirname "$sentinel")"
|
||||
|
||||
echo '# Build/configure parameters' >| "$sentinel"
|
||||
|
||||
for depend
|
||||
do
|
||||
echo "-- $depend"
|
||||
done >> "$sentinel"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# Check sentinel file(s) to handle changed build/configure parameters
|
||||
# such as paraview / vtk version changes
|
||||
#
|
||||
# 1 - sourceDir
|
||||
# 2... build/configure parameters
|
||||
#
|
||||
# The additional test for "CMakeCache.txt" helps for cmake projects and
|
||||
# has no adverse affect for others
|
||||
#
|
||||
sameDependency()
|
||||
{
|
||||
local sourceDir="$1"
|
||||
shift
|
||||
local objectsDir
|
||||
local compare=0
|
||||
|
||||
# Where generated files are stored
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
local sentinel="$objectsDir/ConfigParameters"
|
||||
|
||||
if [ -f "$sentinel" ]
|
||||
then
|
||||
# Create an .update version for comparison
|
||||
storeDependency "${sentinel}.update" $@
|
||||
cmp "${sentinel}" "${sentinel}.update" >/dev/null 2>&1
|
||||
compare=$?
|
||||
|
||||
if [ "$compare" -ne 0 ]
|
||||
then
|
||||
echo "build/configure parameters changed between builds" 1>&2
|
||||
## cat "${sentinel}.update" 1>&2
|
||||
fi
|
||||
|
||||
else
|
||||
# No sentinel file: First time, or failed compilation?
|
||||
if [ -f "$objectsDir/CMakeCache.txt" ]
|
||||
then
|
||||
echo "previous build was incomplete" 1>&2
|
||||
compare=1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$sentinel"
|
||||
return "$compare"
|
||||
}
|
||||
|
||||
|
||||
# Build a mpi-versioned library (targetType)
|
||||
# - use sentinel file(s) to handle paraview version changes
|
||||
# compile into qualified directory
|
||||
# use sentinel file(s) to handle version changes
|
||||
# 1 - libName
|
||||
# 2... build/configure information
|
||||
#
|
||||
# Global variables used:
|
||||
# - WM_OPTIONS, WM_MPLIB, FOAM_MPI
|
||||
#
|
||||
# Requires that WM_MPLIB contain an "MPI" string
|
||||
wmakeLibMpi()
|
||||
{
|
||||
local libName="$1"
|
||||
shift
|
||||
|
||||
case "$WM_MPLIB" in (*MPI* | *mpi*)
|
||||
(
|
||||
WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
|
||||
|
||||
# Where generated files are stored
|
||||
objectsDir="$(findObjectDir "$libName")" || exit 1 # Fatal
|
||||
|
||||
# Something changed
|
||||
sentinel=$(sameDependency "$libName" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@) || \
|
||||
wclean "$libName"
|
||||
|
||||
echo "wmake $targetType $libName (mpi=$WM_MPLIB)"
|
||||
wmake $targetType "$libName" && \
|
||||
storeDependency "$sentinel" "MPLIB=$WM_MPLIB" "MPI=$FOAM_MPI" $@
|
||||
)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# Clean an mpi-versioned library
|
||||
#
|
||||
# Global variables used:
|
||||
# - WM_OPTIONS, WM_MPLIB
|
||||
#
|
||||
# Requires that WM_MPLIB contain an "MPI" string
|
||||
wcleanLibMpi()
|
||||
{
|
||||
case "$WM_MPLIB" in (*MPI* | *mpi*)
|
||||
(
|
||||
WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
|
||||
|
||||
for libName
|
||||
do
|
||||
wclean "$libName"
|
||||
done
|
||||
)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# depToSource depFile
|
||||
#
|
||||
# Output:
|
||||
@ -210,7 +355,7 @@ if [ -n "$BASH_VERSION" ]
|
||||
then
|
||||
depToSource()
|
||||
{
|
||||
local sourceFile=${1%.dep}
|
||||
local sourceFile="${1%.dep}"
|
||||
sourceFile="${sourceFile/build\/${WM_OPTIONS}\//}"
|
||||
sourceFile="${sourceFile/build\/${WM_OPTIONS}${WM_MPLIB}\//}"
|
||||
sourceFile="${sourceFile/Make\/${WM_OPTIONS}\//}"
|
||||
@ -221,13 +366,11 @@ then
|
||||
else
|
||||
depToSource()
|
||||
{
|
||||
local sourceFile=$(echo ${1%.dep} | \
|
||||
sed -e s%build/${WM_OPTIONS}/%% \
|
||||
-e s%build/${WM_OPTIONS}${WM_MPLIB}/%% \
|
||||
-e s%Make/${WM_OPTIONS}/%% \
|
||||
-e s%Make/${WM_OPTIONS}${WM_MPLIB}/%% )
|
||||
|
||||
echo "$sourceFile"
|
||||
echo "${1%.dep}" | sed \
|
||||
-e "s%build/${WM_OPTIONS}/%%" \
|
||||
-e "s%build/${WM_OPTIONS}${WM_MPLIB}/%%" \
|
||||
-e "s%Make/${WM_OPTIONS}/%%" \
|
||||
-e "s%Make/${WM_OPTIONS}${WM_MPLIB}/%%"
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
@ -1,23 +1,38 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit 1 # Run from this directory
|
||||
cd "${0%/*}" || exit # This directory (/path/project/wmake/src)
|
||||
|
||||
if [ -z "$WM_DIR" ] # Require WM_DIR
|
||||
if [ -z "$WM_DIR" ] # Require WM_DIR (/path/project/wmake)
|
||||
then
|
||||
WM_DIR="$(\cd $(dirname $0)/.. && \pwd -L)"
|
||||
WM_DIR="$(dirname "$(pwd -L)")"
|
||||
export WM_DIR
|
||||
fi
|
||||
|
||||
if [ -z "$WM_PROJECT_DIR" ] # Expect WM_PROJECT_DIR (/path/project)
|
||||
then
|
||||
echo "Warning (${0##*/}) : No WM_PROJECT_DIR set" 1>&2
|
||||
WM_PROJECT_DIR="${WM_DIR%/*}"
|
||||
export WM_PROJECT_DIR
|
||||
fi
|
||||
|
||||
if [ -z "$WM_ARCH" ] || [ -z "$WM_COMPILER" ]
|
||||
then
|
||||
echo "Error (${0##*/}) : No WM_ARCH or WM_COMPILER set"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$WM_COMPILER" in
|
||||
Mingw*)
|
||||
# Host wmake toolchain with system gcc (when cross-compiling)
|
||||
make \
|
||||
WM_COMPILER=Gcc WM_COMPILER_TYPE=system \
|
||||
WMAKE_BIN="${WM_DIR}/platforms/${WM_ARCH}${WM_COMPILER}"
|
||||
WMAKE_BIN="${WM_PROJECT_DIR}/platforms/tools/${WM_ARCH}${WM_COMPILER}" \
|
||||
"$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
# Compile wmake toolchain
|
||||
make
|
||||
# Regular wmake toolchain
|
||||
make "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2017-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM.
|
||||
@ -63,10 +63,13 @@ archTarget := $(shell basename $(WMAKE_BIN))
|
||||
# Targets
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
.PHONY: all clean message
|
||||
.PHONY: all clean message old
|
||||
|
||||
all: $(WMAKE_BIN)/wmkdepend$(EXT_EXE) message
|
||||
|
||||
# Flex-based processing
|
||||
old: $(WMAKE_BIN)/wmkdep$(EXT_EXE)
|
||||
|
||||
message:
|
||||
ifneq ($(archHost),$(archTarget))
|
||||
@echo "built wmake-bin ($(archTarget)) for $(archHost) host"
|
||||
@ -76,14 +79,14 @@ endif
|
||||
|
||||
clean:
|
||||
@echo "clean wmake-bin ($(archTarget))"
|
||||
@rm -rf $(WMAKE_BIN) 2>/dev/null
|
||||
@rm -rf $(WMAKE_BIN)
|
||||
@rmdir $(shell dirname $(WMAKE_BIN)) 2>/dev/null || true
|
||||
|
||||
$(WMAKE_BIN)/wmkdep$(EXT_EXE): wmkdep.l
|
||||
@mkdir -p $(WMAKE_BIN)
|
||||
$(call QUIET_MESSAGE,flex,$(<F))
|
||||
$E flex -o $@.c $(<F) && $(cc) $(cFLAGS) $@.c -o $@
|
||||
@rm -f $@.c 2>/dev/null
|
||||
@rm -f $@.c
|
||||
|
||||
$(WMAKE_BIN)/wmkdepend$(EXT_EXE): wmkdepend.cpp
|
||||
@mkdir -p $(WMAKE_BIN)
|
||||
@ -94,6 +97,6 @@ $(WMAKE_BIN)/wmkdepend$(EXT_EXE): wmkdepend.cpp
|
||||
# @mkdir -p $(WMAKE_BIN)
|
||||
# $(call QUIET_MESSAGE,ragel,$(<F))
|
||||
# $E ragel -G2 -o $@.cpp $(<F) && $(CC) $(c++FLAGS) $(c++LESSWARN) $@.cpp -o $@
|
||||
# @rm -f $@.cpp 2>/dev/null
|
||||
# @rm -f $@.cpp
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user