mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
- accept [0-9]* instead of attempting more restrictive specifications CONFIG: makePETSC without fortran
178 lines
5.1 KiB
Bash
Executable File
178 lines
5.1 KiB
Bash
Executable File
#!/bin/sh
|
|
#------------------------------------------------------------------------------
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | www.openfoam.com
|
|
# \\/ M anipulation |
|
|
#------------------------------------------------------------------------------
|
|
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
|
#------------------------------------------------------------------------------
|
|
# License
|
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
|
#
|
|
# Script
|
|
# makeAdios2
|
|
#
|
|
# Description
|
|
# Build script for ADIOS2
|
|
#
|
|
# ----------------------------------------------
|
|
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
|
|
#------------------------------------------------------------------------------
|
|
# Dynamic library ending (default is .so)
|
|
[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so
|
|
|
|
# Short-circuit test for an installation
|
|
if [ "$1" = "-test" ]
|
|
then
|
|
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
|
|
dir="${2%/}" # <- FFTW_ARCH_PATH
|
|
if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO" ]
|
|
then
|
|
echo " adios2 include: $dir/include"
|
|
echo " adios2 library: $dir/lib$WM_COMPILER_LIB_ARCH"
|
|
exit 0
|
|
else
|
|
exit 2
|
|
fi
|
|
fi
|
|
#------------------------------------------------------------------------------
|
|
# Run from third-party directory only
|
|
cd "${0%/*}" || exit
|
|
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
|
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
|
|
echo " Check your OpenFOAM environment and installation"
|
|
exit 1
|
|
}
|
|
. etc/tools/ThirdPartyFunctions
|
|
#------------------------------------------------------------------------------
|
|
# ADIOS2 version from OpenFOAM etc/config.sh file:
|
|
_foamConfig adios2
|
|
|
|
adiosPACKAGE=${adios2_version:-adios-none}
|
|
|
|
#------------------------------------------------------------------------------
|
|
usage() {
|
|
exec 1>&2
|
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
cat<<USAGE
|
|
|
|
usage: ${0##*/} [OPTION] [adios-VERSION]
|
|
options:
|
|
-gcc Force use of gcc/g++
|
|
-cmake PATH With cmake from the given path
|
|
-help
|
|
|
|
* Build ADIOS2
|
|
$adiosPACKAGE
|
|
|
|
USAGE
|
|
exit 1
|
|
}
|
|
#------------------------------------------------------------------------------
|
|
exportCompiler minimal # Minimal compiler info for CMake/configure
|
|
|
|
# Parse options
|
|
while [ "$#" -gt 0 ]
|
|
do
|
|
case "$1" in
|
|
'') ;; # Ignore empty
|
|
-h | -help) usage ;;
|
|
-gcc) useGcc ;;
|
|
|
|
-cmake)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
CMAKE_PATH="${2%%/}"
|
|
shift
|
|
;;
|
|
ADIOS2-[0-9]* | ADIOS2-git* | ADIOS-[0-9]* | ADIOS-git* | \
|
|
adios2-[0-9]* | adios2-git* | adios-[0-9]* | adios-git*)
|
|
adiosPACKAGE="${1%%/}"
|
|
;;
|
|
*)
|
|
die "unknown option/argument: '$1'"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
[ -n "$adiosPACKAGE" ] || die "The adios2-VERSION was not specified"
|
|
|
|
# nothing to build
|
|
if _foamIsNone "$adiosPACKAGE"
|
|
then
|
|
echo "Using adios-none (skip ThirdParty build of ADIOS)"
|
|
exit 0
|
|
elif _foamIsSystem "$adiosPACKAGE"
|
|
then
|
|
echo "Using adios-system"
|
|
exit 0
|
|
fi
|
|
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# Build ADIOS
|
|
# ADIOS2_SOURCE_DIR : location of the original sources
|
|
# ADIOS2_ARCH_PATH : installation directory
|
|
|
|
ADIOS2_SOURCE_DIR=$sourceBASE/$adiosPACKAGE
|
|
ADIOS2_ARCH_PATH=$installBASE/$adiosPACKAGE
|
|
|
|
: ${FOAM_MPI:=dummy}
|
|
|
|
echo
|
|
echo ========================================
|
|
echo "Build adios library $adiosPACKAGE for $FOAM_MPI"
|
|
echo
|
|
|
|
# Needs future adjustment
|
|
# - for mpi-specific library locations
|
|
if [ -f $ADIOS2_ARCH_PATH/include/adios2.h \
|
|
-a -r $ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios2$EXT_SO ]
|
|
then
|
|
echo " ADIOS2 header in $ADIOS2_ARCH_PATH/include"
|
|
echo " ADIOS2 libs in $ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
|
|
else
|
|
# CMake options often lag the configure ones
|
|
echo "Starting build: $adiosPACKAGE (using cmake)"
|
|
echo
|
|
(
|
|
buildDIR=$buildBASE/$adiosPACKAGE
|
|
cd "$ADIOS2_SOURCE_DIR" || exit
|
|
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
|
|
|
|
applyPatch $adiosPACKAGE $ADIOS2_SOURCE_DIR
|
|
|
|
# Remove any existing build folder and recreate
|
|
rm -rf $ADIOS2_ARCH_DIR
|
|
rm -rf $buildDIR 2>/dev/null
|
|
mkdir -p $buildDIR
|
|
|
|
# May not work properly with FOAM_MPI = dummy
|
|
if [ "$FOAM_MPI" != dummy ]
|
|
then
|
|
CC=mpicc
|
|
CXX=mpicxx
|
|
fi
|
|
|
|
cmake=$(findCMake)
|
|
|
|
# Install into lib64/
|
|
cd $buildDIR && $cmake \
|
|
-DCMAKE_INSTALL_PREFIX=$ADIOS2_ARCH_PATH \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DADIOS2_USE_Fortran=FALSE \
|
|
-DADIOS2_BUILD_EXAMPLES=FALSE \
|
|
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
|
|
$ADIOS2_SOURCE_DIR \
|
|
&& make -j $WM_NCOMPPROCS all \
|
|
&& make install \
|
|
&& echo "Built: $adiosPACKAGE"
|
|
) || {
|
|
echo "Error building: $adiosPACKAGE"
|
|
exit 1
|
|
}
|
|
fi
|
|
|
|
# -----------------------------------------------------------------------------
|