mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
- an example of compiling for pvserver - make upper-limit on MPI processes command-line configurable for makeParaView and add MPI support into makeVTK
399 lines
11 KiB
Bash
Executable File
399 lines
11 KiB
Bash
Executable File
#!/bin/sh
|
|
#------------------------------------------------------------------------------
|
|
# ========= |
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
# \\ / O peration |
|
|
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
|
#------------------------------------------------------------------------------
|
|
# 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
|
|
# makeParaView
|
|
#
|
|
# Description
|
|
# Make and install paraview 4 or 5
|
|
# - place the paraview source under $WM_THIRD_PARTY_DIR/ParaView-VERSION
|
|
# (note capitalisation)
|
|
#
|
|
#------------------------------------------------------------------------------
|
|
# Get ParaView_DIR location from OpenFOAM config file
|
|
. $WM_PROJECT_DIR/etc/config.sh/functions
|
|
_foamSource $($WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview)
|
|
|
|
# Determine ParaView_VERSION from ParaView_DIR location:
|
|
ParaView_VERSION="${ParaView_DIR##*/}"; export ParaView_VERSION
|
|
: ${ParaView_VERSION##*-}
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Run from third-party directory only
|
|
cd ${0%/*} || exit 1
|
|
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
|
|
. etc/tools/ParaViewFunctions
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# USER OPTIONS:
|
|
# ~~~~~~~~~~~~~
|
|
|
|
# MPI support:
|
|
# use 0 or unset MPI_MAX_PROCS for no upper-limit
|
|
withMPI=false
|
|
MPI_MAX_PROCS=32
|
|
|
|
# Python support:
|
|
# note: script will try to determine the appropriate python library.
|
|
# If it fails, specify the path using the PYTHON_LIBRARY variable
|
|
withPYTHON=false
|
|
PYTHON_LIBRARY=""
|
|
# PYTHON_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libpython2.6.so.1.0"
|
|
|
|
# MESA graphics support:
|
|
withMESA=false
|
|
MESA_INCLUDE="/usr/include/GL"
|
|
MESA_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
|
|
|
|
# extra QT gui support (useful for some third party apps)
|
|
withQT=true
|
|
|
|
# Set the path to the Qt-4.5 (or later) qmake if the system Qt is older
|
|
QMAKE_PATH=""
|
|
|
|
# Set the path to cmake
|
|
CMAKE_PATH=""
|
|
|
|
# New rendering backend (starting with paraview 5.0).
|
|
# Default to auto-config based on paraview version
|
|
withGL2=auto
|
|
|
|
#
|
|
# NO FURTHER EDITING BELOW THIS LINE
|
|
#
|
|
#-----------------------------------------------------------------------------
|
|
Script=${0##*/}
|
|
|
|
usage() {
|
|
: ${ParaView_VERSION:=none} # some dummy value for usage information
|
|
exec 1>&2
|
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
cat<<USAGE
|
|
|
|
usage: $Script [OPTION] [paraview-VERSION] [CMAKE-OPTION]
|
|
options:
|
|
-rebuild for repeated builds (-make -install) *use with caution*
|
|
-gl2 with new rendering backend (if not already enabled)
|
|
-mesa with mesa (if not already enabled)
|
|
-mpi with mpi (if not already enabled)
|
|
-mpi=NPROCS with mpi and max 'NPROCS' processes. NPROCS=0 for no
|
|
upper-limit on processes.
|
|
-python with python (if not already enabled)
|
|
-cmake PATH with the cmake version corresponding to the cmake path given
|
|
-qmake PATH with the Qt version corresponding to the qmake path given
|
|
-qt with extra Qt gui support (if not already enabled)
|
|
-qt-VER with Qt version corresponding to
|
|
\$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake
|
|
-gcc force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
|
|
-verbose verbose output in Makefiles
|
|
-version VER specify an alternative version (current value: $ParaView_VERSION)
|
|
-major VER specify an alternative major version for special builds
|
|
-buildType NAME specify the build type (default: Release)
|
|
-mesa-prefix DIR location of mesa installation (sets -mesa-include, -mesa-lib)
|
|
-mesa-include DIR location of mesa headers (current value: ${MESA_INCLUDE:-none})
|
|
-mesa-lib PATH path to mesa library (current value: ${MESA_LIBRARY:-none})
|
|
-python-lib PATH path to python library (current value: ${PYTHON_LIBRARY:-none})
|
|
-help
|
|
|
|
The -no-FEATURE option can be used to forcibly disable these features:
|
|
mesa mpi python qt
|
|
|
|
CMake options start with a capital letter and contain an '='.
|
|
For example,
|
|
$Script BUILD_TESTING=ON
|
|
to add tests
|
|
|
|
For finer control, the build stages can be selected or deselected individually:
|
|
-patch -no-patch
|
|
-config -no-config
|
|
-make -no-make
|
|
-install -no-install
|
|
|
|
|
|
* Make and install paraview-$ParaView_VERSION located under
|
|
\$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
|
|
-> \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION
|
|
|
|
To make a different paraview version, simply specify on the command-line.
|
|
For example,
|
|
|
|
./makeParaview 4.4.0
|
|
|
|
Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
|
|
|
|
USAGE
|
|
exit 1
|
|
}
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# ensure CMake gets the correct C/C++ compiler
|
|
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
|
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
|
|
|
|
#
|
|
# add options based on script name:
|
|
#
|
|
case "$Script" in *-mesa*) withMESA=true;; esac
|
|
case "$Script" in *-mpi*) withMPI=true;; esac
|
|
case "$Script" in *-python*) withPYTHON=true;; esac
|
|
case "$Script" in *-qt*) withQT=true;; esac
|
|
|
|
# Set initial ParaView_MAJOR based on current value of ParaView_VERSION
|
|
setParaViewVersion ${ParaView_VERSION:-none}
|
|
|
|
#
|
|
# various building stages
|
|
#
|
|
unset runPATCH runCONFIG runMAKE runINSTALL
|
|
runDEFAULT=true
|
|
buildType=Release
|
|
|
|
# parse options
|
|
while [ "$#" -gt 0 ]
|
|
do
|
|
case "$1" in
|
|
-h | -help)
|
|
usage
|
|
;;
|
|
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
|
|
setParaViewVersion "${1%%/}"
|
|
;;
|
|
[A-Z]*=*) # cmake variables
|
|
addCMakeVariable "$1"
|
|
;;
|
|
-gcc)
|
|
export CC=gcc # use gcc/g++
|
|
export CXX=g++
|
|
;;
|
|
-patch) # stage 0: patch sources
|
|
runPATCH=true
|
|
unset runDEFAULT
|
|
;;
|
|
-no-patch)
|
|
runPATCH=false
|
|
;;
|
|
-config) # stage 1: config only
|
|
runCONFIG=true
|
|
unset runDEFAULT
|
|
;;
|
|
-no-config)
|
|
runCONFIG=false
|
|
;;
|
|
-make) # stage 2: make only
|
|
runMAKE=true
|
|
unset runDEFAULT
|
|
;;
|
|
-no-make)
|
|
runMAKE=false
|
|
;;
|
|
-install) # stage 3: install only
|
|
runINSTALL=true
|
|
unset runDEFAULT
|
|
;;
|
|
-no-install)
|
|
runINSTALL=false
|
|
;;
|
|
-rebuild) # shortcut for rebuilding
|
|
runMAKE=true
|
|
runINSTALL=true
|
|
unset runDEFAULT
|
|
;;
|
|
-gl2)
|
|
withGL2=true
|
|
;;
|
|
-no-gl2)
|
|
withGL2=false
|
|
;;
|
|
-mesa)
|
|
withMESA=true
|
|
;;
|
|
-no-mesa)
|
|
withMESA=false
|
|
;;
|
|
-mesa-prefix)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
withMESA=true
|
|
MESA_INCLUDE="${2%%/}/include"
|
|
MESA_LIBRARY="${2%%/}/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
|
|
shift
|
|
;;
|
|
-mesa-include)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
MESA_INCLUDE="${2%%/}"
|
|
shift
|
|
;;
|
|
-mesa-lib)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
MESA_LIBRARY="${2%%/}"
|
|
shift
|
|
;;
|
|
-mpi)
|
|
withMPI=true
|
|
;;
|
|
-mpi=[0-9]*) # mpi and max mpi processes
|
|
withMPI=true
|
|
MPI_MAX_PROCS="${1##*=}"
|
|
;;
|
|
-no-mpi)
|
|
withMPI=false
|
|
;;
|
|
-python)
|
|
withPYTHON=true
|
|
;;
|
|
-no-python)
|
|
withPYTHON=false
|
|
;;
|
|
-python-lib)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
PYTHON_LIBRARY="${2%%/}"
|
|
shift
|
|
;;
|
|
-cmake)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
CMAKE_PATH="${2%%/}"
|
|
shift
|
|
;;
|
|
-qmake)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
QMAKE_PATH="${2%%/}"
|
|
shift
|
|
;;
|
|
-qt)
|
|
withQT=true
|
|
;;
|
|
-no-qt)
|
|
withQT=false
|
|
;;
|
|
-qt-[1-9]*)
|
|
QMAKE_PATH="$installBASE/${1##-}"
|
|
;;
|
|
-verbose)
|
|
withVERBOSE=true
|
|
;;
|
|
-version)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
setParaViewVersion "${2%%/}"
|
|
shift
|
|
;;
|
|
-major)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
export ParaView_MAJOR="$2"
|
|
shift
|
|
;;
|
|
-buildType)
|
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
|
buildType="$2"
|
|
shift
|
|
;;
|
|
*)
|
|
die "unknown option/argument: '$1'"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
[ -n "$ParaView_VERSION" ] || die "The paraview-VERSION was not specified"
|
|
|
|
# nothing to build
|
|
if _foamIsNone "$ParaView_VERSION"
|
|
then
|
|
echo "Using paraview-none (skip ThirdParty build of ParaView)"
|
|
exit 0
|
|
fi
|
|
|
|
# Version-specific adjustments
|
|
if [ "$withGL2" = auto ]
|
|
then
|
|
if [ "${ParaView_VERSION%%.*}" = 4 ]
|
|
then
|
|
withGL2=false
|
|
else
|
|
withGL2=true
|
|
fi
|
|
fi
|
|
|
|
if [ "$runDEFAULT" = true ]
|
|
then
|
|
: ${runPATCH:=true}
|
|
: ${runCONFIG:=true}
|
|
: ${runMAKE:=true}
|
|
: ${runINSTALL:=true}
|
|
fi
|
|
|
|
|
|
# Set configure options
|
|
#~~~~~~~~~~~~~~~~~~~~~~
|
|
addVerbosity # verbose makefiles
|
|
addMpiSupport # set MPI-specific options
|
|
addPythonSupport # set Python-specific options
|
|
addMesaSupport # set MESA-specific options
|
|
addGL2Support # new rendering backend
|
|
addQtSupport # add extra Qt support
|
|
|
|
setParaViewDirs # where things are or should be put
|
|
|
|
|
|
# Build and install
|
|
# ~~~~~~~~~~~~~~~~~
|
|
cat<<SUMMARY
|
|
|
|
Build stages selected
|
|
---------------------
|
|
-patch ${runPATCH:-false}
|
|
-config ${runCONFIG:-false}
|
|
-make ${runMAKE:-false}
|
|
-install ${runINSTALL:-false}
|
|
---------------------
|
|
Features selected
|
|
mesa ${withMESA:-false}
|
|
mpi ${withMPI:-false}
|
|
python ${withPYTHON:-false}
|
|
qt ${withQT:-false}
|
|
---------------------
|
|
Version information
|
|
qt ${QtVersion:-none}
|
|
version ${ParaView_VERSION:-unknown}
|
|
major ${ParaView_MAJOR:-unknown}
|
|
build ${buildType:-Release}
|
|
$(checkVersion)
|
|
---------------------
|
|
SUMMARY
|
|
|
|
[ "$runPATCH" = true ] && patchParaView
|
|
[ "$runCONFIG" = true ] && configParaView
|
|
[ "$runMAKE" = true ] && makeParaView
|
|
[ "$runINSTALL" = true ] && installParaView
|
|
|
|
echo
|
|
echo Done
|
|
|
|
#------------------------------------------------------------------------------
|