Commit 42308ea1 authored by Mark OLESEN's avatar Mark OLESEN Committed by Andrew Heather
Browse files

CONFIG: improve robustness of paraview lib detection

parent 5ac91a71
......@@ -150,24 +150,11 @@ default:
# 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="${ParaView_DIR}/lib/paraview-$pv_api"
#OBSOLETE? set pvPython=$ParaView_DIR/Utilities/VTKPythonWrapping
#OBSOLETE? # Python libraries as required
#OBSOLETE? if ( -r $pvPython ) then
#OBSOLETE? if ($?PYTHONPATH) then
#OBSOLETE? setenv PYTHONPATH ${PYTHONPATH}:${pvPython}:$pvLibDir
#OBSOLETE? else
#OBSOLETE? setenv PYTHONPATH ${pvPython}:${pvLibDir}
#OBSOLETE? endif
#OBSOLETE? endif
# QT libraries as required
# Set Qt5_DIR to root directory.
# Another possibility: "qtpaths --qt-version"
set pvLibDir="unknown"
# QT libraries as required, and Qt5_DIR for the root directory.
# Another possibility: "qtpaths --qt-version"
set qtDir="$archDir/$ParaView_QT"
if ( -d "$qtDir" ) then
switch ("$ParaView_QT")
......@@ -175,9 +162,9 @@ default:
setenv Qt5_DIR "$qtDir"
breaksw
endsw
foreach qtLibDir ("$qtDir/lib$WM_COMPILER_LIB_ARCH" "$qtDir/lib")
if ( -d "$qtLibDir" ) then
setenv LD_LIBRARY_PATH "${qtLibDir}:${LD_LIBRARY_PATH}"
foreach libDir ("lib$WM_COMPILER_LIB_ARCH" "lib")
if ( -d "${qtDir}/${libDir}" ) then
setenv LD_LIBRARY_PATH "${qtDir}/${libDir}:${LD_LIBRARY_PATH}"
break
endif
end
......@@ -185,15 +172,21 @@ default:
# ParaView libraries
# - 5.4 and earlier: lib/paraview-X.X
# - 5.5 and later: lib/
switch ("$pv_api")
case 5.[0-4]*:
setenv LD_LIBRARY_PATH "${pvLibDir}:${LD_LIBRARY_PATH}"
breaksw
default:
setenv LD_LIBRARY_PATH "${ParaView_DIR}/lib:${LD_LIBRARY_PATH}"
breaksw
endsw
# - 5.5 and later: lib/, but could also be lib64/
foreach libDir ("lib$WM_COMPILER_LIB_ARCH" "lib")
set pvLibDir="${libDir}/paraview-${pv_api}"
if ( -d "${ParaView_DIR}/${pvLibDir}" ) then
switch ("$pv_api")
case 5.[0-4]*:
set libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib)
breaksw
endsw
setenv LD_LIBRARY_PATH "${ParaView_DIR}/${libDir}:${LD_LIBRARY_PATH}"
break
endif
set pvLibDir="unknown"
end
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using paraview"
......@@ -214,9 +207,13 @@ default:
endsw
endif
unset cleaned archDir
unset cmake cmake_version
unset pv_api pvLibDir pvPython qtDir qtLibDir
#------------------------------------------------------------------------------
unsetenv ParaView_VERSION ParaView_QT
unset archDir libDir
unset cmake cmake_version
unset pv_api pvLibDir pvPython qtDir
#------------------------------------------------------------------------------
......@@ -107,27 +107,8 @@ case "$ParaView_VERSION" in
;;
(system)
# Obtain major.minor from `paraview --version`
pv_api="$(paraview --version 2>/dev/null | \
sed -ne 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p')"
if [ -n "$pv_api" ]
then
export PV_PLUGIN_PATH="$FOAM_LIBBIN/paraview-$pv_api"
else
unset ParaView_DIR PV_PLUGIN_PATH
fi
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
if [ -n "$PV_PLUGIN_PATH" ]
then
echo "Using paraview (system)" 1>&2
echo " PV_PLUGIN_PATH : $PV_PLUGIN_PATH" 1>&2
else
echo "system paraview (not found)" 1>&2
fi
fi
unset PV_PLUGIN_PATH
eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} -config paraview-system)"
;;
(*)
......@@ -148,6 +129,7 @@ case "$ParaView_VERSION" in
esac
export ParaView_DIR="$archDir/ParaView-$ParaView_VERSION"
unset PV_PLUGIN_PATH
# Set paths if binaries are present
if [ -r "$ParaView_DIR" ]
......@@ -155,16 +137,7 @@ case "$ParaView_VERSION" in
# 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"
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"
......@@ -176,11 +149,11 @@ case "$ParaView_VERSION" in
export Qt5_DIR="$qtDir"
;;
esac
for qtLibDir in "$qtDir/lib$WM_COMPILER_LIB_ARCH" "$qtDir/lib"
for libDir in "lib$WM_COMPILER_LIB_ARCH" "lib"
do
if [ -d "$qtLibDir" ]
if [ -d "$qtDir/$libDir" ]
then
export LD_LIBRARY_PATH="$qtLibDir:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="$qtDir/$libDir:$LD_LIBRARY_PATH"
break
fi
done
......@@ -188,15 +161,22 @@ case "$ParaView_VERSION" in
# 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
# - 5.5 and later: lib/, but could also be lib64/
for libDir in "lib$WM_COMPILER_LIB_ARCH" "lib"
do
pvLibDir="$libDir/paraview-$pv_api"
if [ -d "$ParaView_DIR/$pvLibDir" ]
then
case "$pv_api" in
(5.[0-4]*)
libDir="$pvLibDir" # Needs lib/paraview-X.X (not lib)
;;
esac
export LD_LIBRARY_PATH="$ParaView_DIR/$libDir:$LD_LIBRARY_PATH"
break
fi
unset pvLibDir
done
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
......@@ -217,14 +197,16 @@ case "$ParaView_VERSION" in
;;
esac
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
unset archDir libDir
unset cmake cmake_version
unset pv_api pvLibDir pvPython qtDir
#------------------------------------------------------------------------------
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment