ENH: add makeFFTW build script

This commit is contained in:
mark
2016-06-28 14:28:01 +02:00
parent 4cd3848a40
commit f7ec8c304e
2 changed files with 171 additions and 1 deletions

View File

@ -2,7 +2,7 @@
#
#+TITLE: OpenFOAM Third-Party packages
#+AUTHOR: The OpenFOAM Foundation / OpenCFD Ltd.
#+DATE: 2016-06-19
#+DATE: 2016-06-28
#+LINK: http://www.openfoam.org
#+OPTIONS: author:nil ^:{}
# Copyright (c) 2014-2016 OpenFOAM Foundation.
@ -44,6 +44,7 @@
+ CGAL https://github.com/CGAL/cgal/releases/download/releases%2FCGAL-4.8/CGAL-4.8.tar.xz
+ boost https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2/download
*** Miscellaneous
+ FFTW http://www.fftw.org/fftw-3.3.4.tar.gz
+ libccmio http://portal.nersc.gov/svn/visit/trunk/third_party/libccmio-2.6.1.tar.gz
* Notes
*** Building ParaView-4.3.1/4.4.0/5.0.0/5.0.1

169
makeFFTW Executable file
View File

@ -0,0 +1,169 @@
#!/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
# makeFFTW
#
# Description
# Build script for FFTW
#
#------------------------------------------------------------------------------
# Get FFTW versions
. $WM_PROJECT_DIR/etc/config.sh/functions
unset _foamAddPath _foamAddLib _foamAddMan # get settings only
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/FFTW)
fftwPACKAGE=${fftw_version:-fftw-system}
#------------------------------------------------------------------------------
# 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
#------------------------------------------------------------------------------
Script="${0##*/}"
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script [OPTION] [fftw-VERSION]
options:
-gcc Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
-help
* build FFTW with
$fftwPACKAGE
USAGE
exit 1
}
#------------------------------------------------------------------------------
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
'')
# discard empty arguments
;;
-gcc)
export CC=gcc # use gcc
export CXX=g++ # use g++
;;
fftw-[0-9]* | fftw_[0-9]* | fftw-system )
fftwPACKAGE="${1%%/}"
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
[ -n "$fftwPACKAGE" ] || die "The fftw-VERSION was not specified"
# nothing to build
if _foamIsNone "$fftwPACKAGE"
then
echo "Using fftw-none (skip ThirdParty build of FFTW)"
exit 0
fi
if _foamIsSystem "$fftwPACKAGE"
then
echo "Using fftw-system (skip ThirdParty build of FFTW)"
exit 0
fi
#------------------------------------------------------------------------------
#
# Build FFTW
# For 64-bit
# - FFTW itself will normally build into 'lib64',
# but provide --libdir on configure to be 100% certain
# - Third-Party builds into 'lib64'
# - system is normally built into 'lib64'
#
# FFTW_SOURCE_DIR : location of the original sources
FFTW_ARCH_PATH=$installBASE/$fftwPACKAGE
FFTW_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$fftwPACKAGE
if [ -r "$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/libfftw3.so" ]
then
echo "Already has FFTW shared library"
else
echo "Starting build: FFTW ($fftwPACKAGE)"
echo
(
# configuration options:
unset configOpt
# Single-precision needed?
if [ "${WM_PRECISION_OPTION}" = SP ]
then
configOpt="$configOpt --enable-single"
fi
# end of configuration options
# ----------------------------
buildDIR=$buildBASE/$fftwPACKAGE
cd $FFTW_SOURCE_DIR || exit 1
rm -rf $FFTW_ARCH_PATH
rm -rf $buildDIR
mkdir -p $buildDIR
cd $buildDIR
set -x
$FFTW_SOURCE_DIR/configure \
--prefix=$FFTW_ARCH_PATH \
--libdir=$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH \
--enable-shared --disable-static \
--disable-fortran \
$configOpt \
&& make -j $WM_NCOMPPROCS \
&& make install \
&& echo "Built $fftwPACKAGE"
) || {
echo "Error building: FFTW"
exit 1
}
fi
#------------------------------------------------------------------------------