mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
226 lines
6.5 KiB
Bash
Executable File
226 lines
6.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#------------------------------------------------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
|
|
# \\/ M anipulation |
|
|
#------------------------------------------------------------------------------
|
|
# License
|
|
# This file is part of OpenFOAM.
|
|
#
|
|
# OpenFOAM is free software: you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
# Script
|
|
# makeADIOS
|
|
#
|
|
# Description
|
|
# Build script for ADIOS
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
# Get version info
|
|
. $WM_PROJECT_DIR/etc/config.sh/functions
|
|
unset -f _foamAddPath _foamAddLib _foamAddMan # get settings only
|
|
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS)
|
|
|
|
adiosPACKAGE=${adios_version:-adios-none}
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Run from third-party directory only
|
|
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
|
|
echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR"
|
|
echo " The environment variables are inconsistent with the installation."
|
|
echo " Check the OpenFOAM entries in your dot-files and source them."
|
|
exit 1
|
|
}
|
|
. etc/tools/ThirdPartyFunctions
|
|
#------------------------------------------------------------------------------
|
|
usage() {
|
|
exec 1>&2
|
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
cat<<USAGE
|
|
|
|
usage: ${0##*/} [OPTION] [adios-VERSION]
|
|
options:
|
|
-gcc Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
|
|
-help
|
|
|
|
* Build ADIOS
|
|
$adiosPACKAGE
|
|
|
|
USAGE
|
|
exit 1
|
|
}
|
|
#------------------------------------------------------------------------------
|
|
# Export WM settings in a form that GNU configure recognizes
|
|
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
|
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
|
[ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
|
|
[ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
|
|
|
|
# Parse options
|
|
while [ "$#" -gt 0 ]
|
|
do
|
|
case "$1" in
|
|
-h | -help)
|
|
usage
|
|
;;
|
|
-gcc)
|
|
export CC=gcc # use gcc/g++
|
|
export CXX=g++
|
|
;;
|
|
ADIOS-[1-9]* | adios-[1-9]* | ADIOS-git | adios-git)
|
|
adiosPACKAGE="${1%%/}"
|
|
;;
|
|
*)
|
|
die "unknown option/argument: '$1'"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
[ -n "$adiosPACKAGE" ] || die "The adios-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
|
|
# ADIOS_SOURCE_DIR : location of the original sources
|
|
# ADIOS_ARCH_PATH : installation directory
|
|
|
|
ADIOS_SOURCE_DIR=$sourceBASE/$adiosPACKAGE
|
|
ADIOS_ARCH_PATH=$installBASE/$adiosPACKAGE
|
|
|
|
: ${FOAM_MPI:=dummy}
|
|
|
|
echo
|
|
echo ========================================
|
|
echo "Build adios library $adiosPACKAGE for $FOAM_MPI"
|
|
echo
|
|
|
|
# Needs future adjustment
|
|
# - for shared library
|
|
# - for mpi-specific library locations
|
|
if [ -f $ADIOS_ARCH_PATH/include/adios.h \
|
|
-a -r $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libadios_${FOAM_MPI}.a ]
|
|
then
|
|
echo " ADIOS header in $ADIOS_ARCH_PATH/include"
|
|
### echo " ADIOS libs in $FOAM_EXT_LIBBIN" # dynamic
|
|
echo " ADIOS libs in $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH" # static
|
|
echo
|
|
else
|
|
(
|
|
# configuration options:
|
|
unset configOpt
|
|
|
|
# Add InfiniBand support
|
|
ibDir=/usr/local/ofed
|
|
if [ -d "$ibDir" ]
|
|
then
|
|
configOpt="$configOpt --with-infiniband=$ibDir"
|
|
fi
|
|
|
|
# Transport layers
|
|
if [ -f "/usr/include/bzlib.h" ]
|
|
then
|
|
configOpt="$configOpt --with-bzip2=/usr"
|
|
fi
|
|
|
|
if [ -f "/usr/include/zlib.h" ]
|
|
then
|
|
configOpt="$configOpt --with-zlib=/usr"
|
|
fi
|
|
|
|
# Other types of support
|
|
## $configOpt="$configOpt --with-hdf5=..."
|
|
## $configOpt="$configOpt --with-lustre=..."
|
|
configOpt="$configOpt --enable-research-transports"
|
|
|
|
# end of configuration options
|
|
# ----------------------------
|
|
buildDIR=$buildBASE/$adiosPACKAGE
|
|
|
|
cd $ADIOS_SOURCE_DIR || exit 1
|
|
[ -e Makefile ] && make distclean 2>/dev/null
|
|
|
|
export GIT_DIR=$ADIOS_SOURCE_DIR/.git
|
|
|
|
# Remove any existing build folder and recreate
|
|
rm -rf $ADIOS_ARCH_DIR
|
|
rm -rf $buildDIR 2>/dev/null
|
|
mkdir -p $buildDIR
|
|
|
|
[ -f configure ] || {
|
|
echo "no configure for $adiosPACKAGE ... trying autogen"
|
|
./autogen.sh
|
|
}
|
|
|
|
# May not work properly with FOAM_MPI = dummy
|
|
if [ "$FOAM_MPI" = dummy ]
|
|
then
|
|
configOpt="$configOpt --without-mpi"
|
|
else
|
|
CC=mpicc
|
|
CXX=mpicxx
|
|
fi
|
|
|
|
# Install into lib64/
|
|
cd $buildDIR && $ADIOS_SOURCE_DIR/configure \
|
|
--prefix=$ADIOS_ARCH_PATH \
|
|
--libdir=$ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
|
|
--disable-fortran \
|
|
--with-pic \
|
|
--without-fastbit \
|
|
$configOpt \
|
|
&& make -j $WM_NCOMPPROCS all \
|
|
&& make install \
|
|
&& echo "Built: $adiosPACKAGE" \
|
|
&& cd $ADIOS_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH && \
|
|
{
|
|
# Rename according to FOAM_MPI
|
|
if [ "$FOAM_MPI" != dummy ]
|
|
then
|
|
\mv -f libadios.a libadios_$FOAM_MPI.a
|
|
\mv -f libadiosread.a libadiosread_$FOAM_MPI.a
|
|
fi
|
|
\mv -f libadios_nompi.a libadios_dummy.a
|
|
\mv -f libadiosread_nompi.a libadiosread_dummy.a
|
|
|
|
echo
|
|
echo "ADIOS library renamed to libadios_$FOAM_MPI"
|
|
echo
|
|
} && cd $ADIOS_ARCH_PATH/bin && \
|
|
{
|
|
# We don't need/use XML things
|
|
\rm -f adios_lint
|
|
$ADIOS_ARCH_PATH/bin/adios_config -m 2>/dev/null || \
|
|
echo "Warning: Problems running adios_config"
|
|
}
|
|
) || {
|
|
echo "Error building: $adiosPACKAGE"
|
|
}
|
|
fi
|
|
|
|
# ----------------------------------------------------------------- end-of-file
|