- foamCleanPath now only splits the environment variable on ':', which allows other directories with spaces or '(..)' etc to pass through without major issue. - The filter arguments are split on whitespace, colons or semi-colons.
195 lines
6.1 KiB
Bash
195 lines
6.1 KiB
Bash
#----------------------------------*-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
|
|
# <http://www.gnu.org/licenses/>.
|
|
#
|
|
# File
|
|
# etc/config.sh/paraview
|
|
# - sourced by OpenFOAM-*/etc/bashrc or via foamPV alias
|
|
#
|
|
# Description
|
|
# Setup for PARAVIEW (partially cmake, qt too)
|
|
#
|
|
# For system-wide cmake: cmake_version=cmake-system
|
|
# For system-wide qt: ParaView_QT=qt-system
|
|
#
|
|
# Note
|
|
# The following env. variables are required for building plugins:
|
|
# ParaView_DIR
|
|
# ParaView_INCLUDE_DIR
|
|
# PV_PLUGIN_PATH
|
|
#
|
|
# For central installations not located under ThirdParty, the environment
|
|
# values must be set manually. For example,
|
|
#
|
|
# export ParaView_DIR=/opt/paraview/paraview-5.5.0
|
|
# export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-5.5
|
|
# export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-5.5
|
|
#
|
|
# export PATH=$ParaView_DIR/bin:$PATH
|
|
# export LD_LIBRARY_PATH=$ParaView_DIR/lib:$LD_LIBRARY_PATH
|
|
# unset ParaView_VERSION # avoid using ThirdParty settings
|
|
#
|
|
# In paraview-5.4 and earlier, the libraries were in the sub-directory:
|
|
#
|
|
# export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-5.4:$LD_LIBRARY_PATH
|
|
#
|
|
# Note
|
|
# When _foamAddLib is unset (eg, called from makeParaView or from foamPV):
|
|
# - the ParaView_VERSION variable is retained.
|
|
#------------------------------------------------------------------------------
|
|
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
|
|
|
ParaView_VERSION=5.5.2
|
|
ParaView_QT=qt-system
|
|
cmake_version=cmake-system
|
|
|
|
# END OF (NORMAL) USER EDITABLE PART
|
|
#------------------------------------------------------------------------------
|
|
pv_api=auto # Either auto or pair of (major.minor) digits
|
|
|
|
# Compiler-specific location for ThirdParty installations
|
|
archDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
|
|
|
|
# Clean PATH and LD_LIBRARY_PATH
|
|
eval \
|
|
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=PATH \
|
|
$ParaView_DIR $archDir/ParaView- $archDir/qt- $archDir/cmake-)"
|
|
|
|
eval \
|
|
"$($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=LD_LIBRARY_PATH \
|
|
$ParaView_DIR $archDir/ParaView- $archDir/qt-)"
|
|
|
|
# ThirdParty cmake
|
|
cmake="$archDir/$cmake_version"
|
|
if [ -r "$cmake/bin/cmake" ]
|
|
then
|
|
# _foamAddPath not available when foamPV function is used
|
|
PATH="$cmake/bin:$PATH"
|
|
fi
|
|
|
|
# Evaluate command-line parameters for ParaView
|
|
_foamParaviewEval()
|
|
{
|
|
while [ $# -gt 0 ]
|
|
do
|
|
case "$1" in
|
|
ParaView*=*)
|
|
# name=value -> export name=value
|
|
eval "export $1"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
}
|
|
|
|
# Evaluate command-line parameters
|
|
_foamParaviewEval $@
|
|
|
|
# Require that ParaView_VERSION has not been unset.
|
|
# Avoids conflict with an alternative (non-ThirdParty) installation.
|
|
if [ -n "$ParaView_VERSION" ]
|
|
then
|
|
|
|
# Set API to correspond to VERSION
|
|
# pv_api is <digits>.<digits> from ParaView_VERSION
|
|
case "$ParaView_VERSION" in
|
|
"$pv_api".* )
|
|
# API and VERSION appear to correspond
|
|
;;
|
|
|
|
[0-9]*)
|
|
# Extract API from VERSION
|
|
pv_api=$(echo $ParaView_VERSION | \
|
|
sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/')
|
|
;;
|
|
esac
|
|
|
|
export ParaView_DIR=$archDir/ParaView-$ParaView_VERSION
|
|
|
|
# Set paths if binaries are present
|
|
if [ -r $ParaView_DIR ]
|
|
then
|
|
export PATH=$ParaView_DIR/bin:$PATH
|
|
export ParaView_INCLUDE_DIR=$ParaView_DIR/include/paraview-$pv_api
|
|
export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$pv_api
|
|
|
|
pvLibDir=$ParaView_DIR/lib/paraview-$pv_api
|
|
#OBSOLETE? pvPython=$ParaView_DIR/Utilities/VTKPythonWrapping
|
|
|
|
#OBSOLETE? # Python libraries as required
|
|
#OBSOLETE? if [ -r $pvPython ]
|
|
#OBSOLETE? then
|
|
#OBSOLETE? export PYTHONPATH=$PYTHONPATH:${PYTHONPATH:+:}$pvPython:$pvLibDir
|
|
#OBSOLETE? fi
|
|
|
|
# QT libraries as required, and Qt5_DIR for the root directory.
|
|
# Another possibility: "qtpaths --qt-version"
|
|
qtDir="$archDir/$ParaView_QT"
|
|
if [ -d "$qtDir" ]
|
|
then
|
|
case "$ParaView_QT" in
|
|
*-5*)
|
|
export Qt5_DIR=$qtDir
|
|
;;
|
|
esac
|
|
for qtLibDir in $qtDir/lib$WM_COMPILER_LIB_ARCH $qtDir/lib
|
|
do
|
|
if [ -d "$qtLibDir" ]
|
|
then
|
|
export LD_LIBRARY_PATH=$qtLibDir:$LD_LIBRARY_PATH
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
|
|
# ParaView libraries
|
|
# - 5.4 and earlier: lib/paraview-X.X
|
|
# - 5.5 and later: lib/
|
|
case "$pv_api" in
|
|
5.[0-4]*)
|
|
export LD_LIBRARY_PATH=$pvLibDir:$LD_LIBRARY_PATH
|
|
;;
|
|
*)
|
|
export LD_LIBRARY_PATH=$ParaView_DIR/lib:$LD_LIBRARY_PATH
|
|
;;
|
|
esac
|
|
|
|
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
|
then
|
|
echo "Using paraview"
|
|
echo " ParaView_DIR : $ParaView_DIR"
|
|
echo " ParaView_INCLUDE_DIR : $ParaView_INCLUDE_DIR"
|
|
echo " library dir : $pvLibDir"
|
|
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
|
|
fi
|
|
else
|
|
if [ "$FOAM_VERBOSE" -a "$PS1" ]
|
|
then
|
|
echo "No paraview found"
|
|
echo " ParaView_DIR : $ParaView_DIR"
|
|
fi
|
|
|
|
unset ParaView_DIR ParaView_INCLUDE_DIR PV_PLUGIN_PATH
|
|
fi
|
|
|
|
fi
|
|
|
|
unset -f _foamParaviewEval 2> /dev/null
|
|
unset cleaned archDir
|
|
unset cmake cmake_version
|
|
unset pv_api pvLibDir pvPython qtDir qtLibDir
|
|
|
|
if command -v _foamAddLib > /dev/null 2>&1 # normal sourcing
|
|
then
|
|
unset ParaView_VERSION ParaView_QT
|
|
fi
|
|
|
|
#------------------------------------------------------------------------------
|