mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: improve setup for paraview
- removed reliance on ParaView_INCLUDE_DIR variable for conveying the
major.minor version information when compiling. This can be somewhat
fragile and also adds variable that is an unnecessary when running
(only used when compiling).
Instead use `have_pvplugin_support` function in paraviewFunctions
wmake script to determine the maj.min from the PV_PLUGIN_PATH
since we have already defined the output path there with paraview
maj.min numbering.
Can now build with paraview from the operating system,
provided that it has develop headers available.
ParaView_VERSION=system
In the etc/config.sh/paraview setup, the maj.min is taken from
the corresponding `paraview --version` output and used when
defining the PV_PLUGIN_PATH.
During the build, the include path taken from `paraview-config`
for a system installation, from the guess installation root
of the paraview binary, or ParaView_DIR otherwise.
NB: using a system ParaView for building runTimePostProcessing is unsupported.
- these types of builds appear to have various library resolution issues
(eg, libexpat not being loaded). Additionally, the build logic does
not yet cover this type of use case.
This commit is contained in:
@ -15,9 +15,7 @@
|
||||
# Description
|
||||
# Helper functions for CMake
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Source the wmake functions
|
||||
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
|
||||
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions # Require some wmake functions
|
||||
|
||||
# Ensure CMake gets the correct C/C++ compilers
|
||||
[ -n "$WM_CC" ] && export CC="$WM_CC"
|
||||
@ -39,7 +37,7 @@ sameDependency()
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
sentinel="$objectsDir/ThirdParty"
|
||||
|
||||
echo $sentinel
|
||||
echo "$sentinel"
|
||||
|
||||
if read -r prev 2>/dev/null < $sentinel
|
||||
then
|
||||
@ -75,10 +73,16 @@ _cmake()
|
||||
|
||||
# CMake into objectsDir with external dependency
|
||||
# - use sentinel file(s) to handle paraview/vtk version changes
|
||||
#
|
||||
# 1 - depend
|
||||
# 2 - sourceDir
|
||||
# 3... optional cmake defines
|
||||
#
|
||||
cmakeVersioned()
|
||||
{
|
||||
local depend="$1"
|
||||
local sourceDir="$2"
|
||||
shift 2
|
||||
local objectsDir sentinel
|
||||
|
||||
# Where generated files are stored
|
||||
@ -88,76 +92,35 @@ cmakeVersioned()
|
||||
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||
|
||||
mkdir -p $objectsDir \
|
||||
&& (cd $objectsDir && _cmake $sourceDir && make) \
|
||||
mkdir -p "$objectsDir" \
|
||||
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make) \
|
||||
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
||||
}
|
||||
|
||||
|
||||
# CMake into objectsDir with VTK_DIR dependency
|
||||
cmakeVtk()
|
||||
{
|
||||
cmakeVersioned "VTK_DIR=$VTK_DIR" "$1"
|
||||
}
|
||||
|
||||
|
||||
# CMake into objectsDir with ParaView_DIR dependency
|
||||
cmakePv()
|
||||
{
|
||||
cmakeVersioned "ParaView_DIR=$ParaView_DIR" "$1"
|
||||
}
|
||||
|
||||
|
||||
# CMake into objectsDir with external dependency
|
||||
#
|
||||
# Build library - use sentinel file(s) to handle paraview version changes
|
||||
# 1 - depend
|
||||
# 2 - sourceDir
|
||||
# 3... optional cmake defines
|
||||
#
|
||||
wmakeLibPv()
|
||||
cmakeVersionedInstall()
|
||||
{
|
||||
local depend="ParaView_DIR=$ParaView_DIR"
|
||||
local sentinel
|
||||
local depend="$1"
|
||||
local sourceDir="$2"
|
||||
shift 2
|
||||
local objectsDir sentinel
|
||||
|
||||
for libName
|
||||
do
|
||||
sentinel=$(sameDependency "$depend" $libName) || \
|
||||
wclean $libName
|
||||
# Where generated files are stored
|
||||
objectsDir=$(findObjectDir "$sourceDir") || exit 1 # Fatal
|
||||
|
||||
wmake $targetType $libName \
|
||||
&& echo "$depend" > ${sentinel:-/dev/null}
|
||||
done
|
||||
}
|
||||
# Version changed
|
||||
sentinel=$(sameDependency "$depend" "$sourceDir") || \
|
||||
rm -rf "$objectsDir" > /dev/null 2>&1
|
||||
|
||||
|
||||
#
|
||||
# There are several prerequisites for building plugins
|
||||
#
|
||||
canBuildPlugin()
|
||||
{
|
||||
[ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] || {
|
||||
echo "==> cannot build ParaView plugins without paraview directory"
|
||||
echo " ParaView_DIR=$ParaView_DIR"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -n "$PV_PLUGIN_PATH" ] || {
|
||||
echo "==> ${PWD##*/} : invalid PV_PLUGIN_PATH for building ParaView plugins"
|
||||
echo " PV_PLUGIN_PATH=${PV_PLUGIN_PATH:-unset}"
|
||||
return 1
|
||||
}
|
||||
|
||||
[ -d "$ParaView_INCLUDE_DIR" ] && \
|
||||
[ -f "$ParaView_INCLUDE_DIR/pqServerManagerModel.h" ] || {
|
||||
echo "==> cannot build ParaView plugins without an include directory"
|
||||
echo " ... or without GUI support"
|
||||
echo " ParaView_INCLUDE_DIR=$ParaView_INCLUDE_DIR"
|
||||
return 1
|
||||
}
|
||||
|
||||
command -v cmake > /dev/null 2>&1 || {
|
||||
echo "==> cannot build ParaView plugins without cmake"
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0 # success
|
||||
mkdir -p "$objectsDir" \
|
||||
&& (cd "$objectsDir" && _cmake "$@" "$sourceDir" && make install) \
|
||||
&& echo "$depend" >| "${sentinel:-/dev/null}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user