CONFIG: only set PV_PLUGIN_PATH if the directory actually exists
- this does mean two passes are required on the initial compilation, but improves reliability thereafter. ENH: correct csh handling of system paraview
This commit is contained in:
parent
8d1f32641c
commit
36c1993c5e
@ -67,7 +67,7 @@ alias foamVersion \
|
||||
# Change ParaView version
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
alias foamPV \
|
||||
'source $WM_PROJECT_DIR/etc/config.csh/paraview ParaView_VERSION=\!*; echo ${ParaView_DIR:t}'
|
||||
'source $WM_PROJECT_DIR/etc/config.csh/paraview ParaView_VERSION=\!*; echo paraview=${ParaView_DIR:t}'
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -46,6 +46,9 @@
|
||||
#
|
||||
# setenv LD_LIBRARY_PATH $ParaView_DIR/lib/paraview-5.4:$LD_LIBRARY_PATH
|
||||
#
|
||||
# Additional Notes
|
||||
# PV_PLUGIN_PATH is *only* set if the directory actually exists.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
@ -77,6 +80,9 @@ while ( $#argv > 0 )
|
||||
shift
|
||||
end
|
||||
|
||||
unset pv_plugin_dir
|
||||
unsetenv PV_PLUGIN_PATH
|
||||
|
||||
if ($?ParaView_VERSION) then
|
||||
switch ("$ParaView_VERSION")
|
||||
case "":
|
||||
@ -85,7 +91,6 @@ case "":
|
||||
breaksw
|
||||
|
||||
case "none":
|
||||
unsetenv PV_PLUGIN_PATH
|
||||
setenv ParaView_DIR # Defined but empty (used by foamPV alias)
|
||||
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
@ -100,14 +105,27 @@ case "system":
|
||||
if ("${pv_api}" == "") then
|
||||
unsetenv ParaView_DIR PV_PLUGIN_PATH
|
||||
else
|
||||
setenv PV_PLUGIN_PATH "$FOAM_LIBBIN/paraview-$pv_api"
|
||||
# Get ParaView_DIR from `which paraview`
|
||||
# Eg, /usr/bin/paraview -> /usr/bin -> /usr
|
||||
|
||||
set pv_dir=`which paraview`
|
||||
if ( -x "$pv_dir" ) then
|
||||
set pv_dir="${pv_dir:h}"
|
||||
setenv ParaView_DIR "${pv_dir:h}"
|
||||
endif
|
||||
|
||||
set pv_plugin_dir="$FOAM_LIBBIN/paraview-$pv_api"
|
||||
if ( -d "$pv_plugin_dir" ) then
|
||||
setenv PV_PLUGIN_PATH "$pv_plugin_dir"
|
||||
else
|
||||
set pv_plugin_dir="${pv_plugin_dir} (missing)" # For message
|
||||
endif
|
||||
endif
|
||||
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
echo "Using paraview (disabled)"
|
||||
if ( $?PV_PLUGIN_PATH ) then
|
||||
if ( $?pv_plugin_dir ) then
|
||||
echo "Using paraview (system)"
|
||||
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
|
||||
echo " plugins : ${pv_plugin_dir}" 1>&2
|
||||
else
|
||||
echo "system paraview (not found)"
|
||||
endif
|
||||
@ -132,12 +150,10 @@ default:
|
||||
endsw
|
||||
|
||||
setenv ParaView_DIR "$archDir/ParaView-$ParaView_VERSION"
|
||||
set pv_plugin_dir="$FOAM_LIBBIN/paraview-$pv_api"
|
||||
|
||||
# Set paths if binaries are present
|
||||
if ( -r "$ParaView_DIR" ) then
|
||||
# The OpenFOAM plugin directory must be the first in PV_PLUGIN_PATH
|
||||
# and have paraview-major.minor encoded in its name
|
||||
setenv PV_PLUGIN_PATH "$FOAM_LIBBIN/paraview-$pv_api"
|
||||
setenv PATH "${ParaView_DIR}/bin:${PATH}"
|
||||
set pvLibDir="unknown"
|
||||
|
||||
@ -176,16 +192,24 @@ default:
|
||||
set pvLibDir="unknown"
|
||||
end
|
||||
|
||||
# OpenFOAM plugin directory must be the first in PV_PLUGIN_PATH
|
||||
# and have paraview-major.minor encoded in its name
|
||||
if ( -d "$pv_plugin_dir" ) then
|
||||
setenv PV_PLUGIN_PATH "$pv_plugin_dir"
|
||||
else
|
||||
set pv_plugin_dir="${pv_plugin_dir} (missing)" # For message
|
||||
endif
|
||||
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
echo "Using paraview"
|
||||
echo " ParaView_DIR : $ParaView_DIR"
|
||||
echo " library dir : $pvLibDir"
|
||||
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH"
|
||||
echo " ParaView_DIR : $ParaView_DIR"
|
||||
echo " library : $pvLibDir"
|
||||
echo " plugins : ${pv_plugin_dir}"
|
||||
endif
|
||||
else
|
||||
if ($?FOAM_VERBOSE && $?prompt) then
|
||||
echo "No paraview found"
|
||||
echo " ParaView_DIR : $ParaView_DIR"
|
||||
echo " ParaView_DIR : $ParaView_DIR"
|
||||
endif
|
||||
|
||||
unsetenv PV_PLUGIN_PATH
|
||||
@ -201,6 +225,6 @@ endif
|
||||
unsetenv ParaView_VERSION ParaView_QT
|
||||
|
||||
unset archDir libDir
|
||||
unset pv_api pvLibDir pvPython qtDir
|
||||
unset pv_api pv_plugin_dir pvLibDir pvPython qtDir
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -6,11 +6,10 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/aliases
|
||||
@ -102,8 +101,11 @@ unset -f foamPV 2>/dev/null
|
||||
foamPV()
|
||||
{
|
||||
. "$WM_PROJECT_DIR/etc/config.sh/paraview" "${@+ParaView_VERSION=$@}"
|
||||
local pvdir="${ParaView_DIR##*/}"
|
||||
echo "${pvdir:-ParaView_DIR not set}" 1>&2
|
||||
# If not already reported
|
||||
if [ -z "$FOAM_VERBOSE" ]
|
||||
then
|
||||
echo "paraview=${ParaView_DIR##*/}" 1>&2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,6 +50,10 @@
|
||||
# Note
|
||||
# When _foamAddLib is unset (eg, called from makeParaView or from foamPV):
|
||||
# - the ParaView_VERSION variable is retained.
|
||||
#
|
||||
# Additional Notes
|
||||
# PV_PLUGIN_PATH is *only* set if the directory actually exists.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
@ -98,12 +102,13 @@ case "$ParaView_VERSION" in
|
||||
;;
|
||||
|
||||
(system)
|
||||
unset PV_PLUGIN_PATH
|
||||
unset ParaView_DIR PV_PLUGIN_PATH
|
||||
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh -config paraview-system)"
|
||||
;;
|
||||
|
||||
(*)
|
||||
# ParaView_VERSION set and non-empty
|
||||
unset ParaView_DIR PV_PLUGIN_PATH
|
||||
|
||||
# Set API to correspond to VERSION
|
||||
# pv_api is <digits>.<digits> from ParaView_VERSION
|
||||
@ -120,14 +125,11 @@ case "$ParaView_VERSION" in
|
||||
esac
|
||||
|
||||
export ParaView_DIR="$archDir/ParaView-$ParaView_VERSION"
|
||||
unset PV_PLUGIN_PATH
|
||||
pv_plugin_dir="$FOAM_LIBBIN/paraview-$pv_api"
|
||||
|
||||
# Set paths if binaries are present
|
||||
if [ -r "$ParaView_DIR" ]
|
||||
then
|
||||
# The OpenFOAM plugin directory must be the first in PV_PLUGIN_PATH
|
||||
# and have paraview-major.minor encoded in its name
|
||||
export PV_PLUGIN_PATH="$FOAM_LIBBIN/paraview-$pv_api"
|
||||
export PATH="$ParaView_DIR/bin:$PATH"
|
||||
|
||||
# QT libraries as required, and Qt5_DIR for the root directory.
|
||||
@ -169,12 +171,21 @@ case "$ParaView_VERSION" in
|
||||
unset pvLibDir
|
||||
done
|
||||
|
||||
# OpenFOAM plugin directory must be the first in PV_PLUGIN_PATH
|
||||
# and have paraview-major.minor encoded in its name
|
||||
if [ -d "$pv_plugin_dir" ]
|
||||
then
|
||||
export PV_PLUGIN_PATH="$pv_plugin_dir"
|
||||
else
|
||||
pv_plugin_dir="${pv_plugin_dir} (missing)" # For message
|
||||
fi
|
||||
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using paraview" 1>&2
|
||||
echo " ParaView_DIR : $ParaView_DIR" 1>&2
|
||||
echo " library dir : $pvLibDir" 1>&2
|
||||
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2
|
||||
echo " ParaView_DIR : $ParaView_DIR" 1>&2
|
||||
echo " library : $pvLibDir" 1>&2
|
||||
echo " plugins : $pv_plugin_dir" 1>&2
|
||||
fi
|
||||
else
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
@ -183,7 +194,7 @@ case "$ParaView_VERSION" in
|
||||
echo " ParaView_DIR : $ParaView_DIR" 1>&2
|
||||
fi
|
||||
|
||||
unset ParaView_DIR PV_PLUGIN_PATH
|
||||
unset ParaView_DIR
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@ -197,6 +208,6 @@ then
|
||||
fi
|
||||
|
||||
unset archDir libDir
|
||||
unset pv_api pvLibDir pvPython qtDir
|
||||
unset pv_api pv_plugin_dir pvLibDir pvPython qtDir
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -37,8 +37,9 @@ eval \
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
ParaView_DIR="$(command -v paraview 2>/dev/null)"
|
||||
unset PV_PLUGIN_PATH pv_plugin_dir
|
||||
|
||||
# Do have paraview?
|
||||
# Have paraview?
|
||||
# Obtain major.minor from `paraview --version`
|
||||
if [ -n "$ParaView_DIR" ]
|
||||
then
|
||||
@ -63,19 +64,26 @@ fi
|
||||
case "$pv_api" in
|
||||
([0-9]*.[0-9]*)
|
||||
export ParaView_DIR
|
||||
export PV_PLUGIN_PATH="$FOAM_LIBBIN/paraview-$pv_api"
|
||||
pv_plugin_dir="$FOAM_LIBBIN/paraview-$pv_api"
|
||||
|
||||
if [ -d "$pv_plugin_dir" ]
|
||||
then
|
||||
export PV_PLUGIN_PATH="$pv_plugin_dir"
|
||||
else
|
||||
pv_plugin_dir="${pv_plugin_dir} (missing)" # For message
|
||||
fi
|
||||
;;
|
||||
(*)
|
||||
unset ParaView_DIR PV_PLUGIN_PATH
|
||||
unset ParaView_DIR
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
if [ -n "$PV_PLUGIN_PATH" ]
|
||||
if [ -n "$ParaView_DIR" ]
|
||||
then
|
||||
echo "Using paraview (system)" 1>&2
|
||||
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2
|
||||
echo " plugins : $pv_plugin_dir" 1>&2
|
||||
else
|
||||
echo "system paraview (not found)" 1>&2
|
||||
fi
|
||||
@ -92,6 +100,6 @@ else
|
||||
fi
|
||||
|
||||
unset archDir
|
||||
unset pv_api
|
||||
unset pv_api pv_plugin_dir
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user