#!/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-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# .
#
# Script
# makeParaView
#
# Description
# Make and install ParaView.
# The ParaView sources should be located under one of these locations:
# - $WM_THIRD_PARTY_DIR/ParaView-VERSION
# - $WM_THIRD_PARTY_DIR/ParaView-vVERSION
#
# Note the capitalization of ParaView in the directory names.
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Run from third-party directory only
cd ${0%/*} && 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
. etc/tools/ParaViewFunctions
#------------------------------------------------------------------------------
unset ParaView_VERSION # Purge current values
# ParaView_VERSION from etc/config.sh file:
_foamConfig paraview
# Avoid any potential conflicts (especially if building from git)
if [ -d "$ParaView_DIR" ]
then
_foamClean PATH "$ParaView_DIR"
_foamClean LD_LIBRARY_PATH "$ParaView_DIR"
fi
unset ParaView_DIR ParaView_INCLUDE_DIR PV_PLUGIN_PATH
case "$ParaView_VERSION" in
[Pp]*)
ParaView_VERSION="${ParaView_VERSION##*-}" # Without "ParaView-" prefix
;;
esac
ParaView_VERSION="${ParaView_VERSION%%-*}" # Without suffix (eg, -python)
# Set initial ParaView_MAJOR based on current value of ParaView_VERSION
setParaViewVersion ${ParaView_VERSION:-none}
# New rendering backend (starting with paraview 5.0).
withGL2=auto # auto-config based on version
#------------------------------------------------------------------------------
usage() {
exec 1>&2
: ${ParaView_VERSION:=none} # some dummy value for usage information
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat< \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION$BUILD_SUFFIX
To make a different paraview version, simply specify on the command-line.
For example,
./makeParaview 5.4.1
Or change the \$WM_PROJECT_DIR/etc/config.sh/paraview settings.
USAGE
exit 1
}
#------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure
# Various building stages
unset runPATCH runCONFIG runMAKE runINSTALL
runDEFAULT=true
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-gcc) useGcc ;;
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
setParaViewVersion "${1%%/}"
;;
[A-Z]*=*) # cmake variables
addCMakeVariable "$1"
;;
-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
;;
-osmesa)
echo
echo "The -osmesa option is currently ignored"
echo
# withMESA=true
# withOSMESA=true
;;
-no-mesa)
withMESA=false
withOSMESA=false
;;
-mesa-prefix)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withMESA=true
MESA_INCLUDE="${2%%/}/include"
# Could be under (lib64 | lib)
MESA_LIBRARY="${2%%/}/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
[ -f "$MESA_LIBRARY" ] || MESA_LIBRARY="${2%%/}/lib/libOSMesa.so"
shift
;;
-mesa-include)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withMESA=true
MESA_INCLUDE="${2%%/}"
shift
;;
-mesa-lib)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withMESA=true
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-include)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withPYTHON=true
PYTHON_INCLUDE="${2%%/}"
shift
;;
-python-lib)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
withPYTHON=true
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]*)
withQT=true
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"
BUILD_TYPE="$2"
shift
;;
-suffix)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
setBuildSuffix "$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
if [ "$withMESA" = true ]
then
: ${withQT:=false} # No QT unless explicitly requested
addCMakeVariable "VTK_USE_X=OFF"
# addCMakeVariable "OPENGL_INCLUDE_DIR=IGNORE"
# addCMakeVariable "OPENGL_gl_LIBRARY=IGNORE"
# addCMakeVariable "OPENGL_xmesa_INCLUDE_DIR=IGNORE"
## seems to be unnecessary => addCMakeVariable "VTK_USE_OFFSCREEN=OFF"
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<