Commit 7a90f5e6 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: add versioning to paraview plugin support libraries (issue #370)

- use "-pvMAJ.MIN" suffix for similarity with the paraview convention

- use sentinel file to ensure clean change of intermediate targets

- ensure all library files are being properly removed
parent 2c96ec75
......@@ -7,6 +7,11 @@ export WM_CONTINUE_ON_ERROR=true
# Parse arguments for library compilation
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
# Source the wmake functions
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
# -----------------------------------------------------------------------------
#
# There are several prerequisites for building plugins
#
......@@ -34,6 +39,53 @@ canBuildPlugin()
}
#
# Check sentinel file(s) to handle paraview version changes
#
versionOk()
{
findObjectDir "$1" # Where generated files are stored
local sentinel="$objectsDir/ThirdParty"
echo $sentinel
local prev
if read -r prev 2>/dev/null < $sentinel
then
case "$prev" in
("ParaView_DIR=$ParaView_DIR")
return 0
;;
(*)
echo "ParaView_DIR changed between builds" 1>&2
return 1
;;
esac
elif [ -f "$objectsDir/CMakeCache.txt" ]
then
echo "previous build was incomplete" 1>&2
return 1
else
return 0
fi
}
#
# Build library - use sentinel file(s) to handle paraview version changes
#
wmakeLibPv()
{
for libName
do
sentinel=$(versionOk $libName) || wclean $libName # version changed
wmake $targetType $libName && {
echo "ParaView_DIR=$ParaView_DIR" > $sentinel
}
done
}
# -----------------------------------------------------------------------------
# major version as per paraview include directory:
......@@ -45,9 +97,9 @@ case "$major" in
if canBuildPlugin
then
(
wmake $targetType vtkPVReaders
wmakeLibPv vtkPVReaders
PVblockMeshReader/Allwmake $targetType $*
PVFoamReader/Allwmake $targetType $*
PVFoamReader/Allwmake $targetType $*
# Dummy directory to trigger proper 'wclean all' behaviour
# - the Allwclean will otherwise not be used
......
......@@ -2,17 +2,15 @@
cd ${0%/*} || exit 1 # Run from this directory
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
#set -x
# deal with client/server vs combined plugins
# Cleanup client-server and/or combined plugins
rm -f $FOAM_LIBBIN/libPVFoamReader* 2>/dev/null
rm -rf PVFoamReader/Make # safety: old build location
wclean libso vtkPVFoam
# Where are the generated files stored?
# Cleanup generated files
findObjectDir $PWD # remove entire top-level
rm -rf "$objectsDir" > /dev/null 2>&1
......
......@@ -5,20 +5,56 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
# Ensure CMake gets the correct C/C++ compilers
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
# -----------------------------------------------------------------------------
#
# Check sentinel file(s) to handle paraview version changes
#
versionOk()
{
findObjectDir "$1" # Where generated files are stored
local sentinel="$objectsDir/ThirdParty"
echo $sentinel
local prev
if read -r prev 2>/dev/null < $sentinel
then
case "$prev" in
("ParaView_DIR=$ParaView_DIR")
return 0
;;
(*)
echo "ParaView_DIR changed between builds" 1>&2
return 1
;;
esac
elif [ -f "$objectsDir/CMakeCache.txt" ]
then
echo "previous build was incomplete" 1>&2
return 1
else
return 0
fi
}
# CMake into objectsDir,
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
doCmake()
{
local sourceDir="$1"
findObjectDir $sourceDir # Where are generated files stored?
# version changed
sentinel=$(versionOk $sourceDir) || rm -rf "$objectsDir" > /dev/null 2>&1
test -f "$objectsDir/CMakeCache.txt"
retry=$? # CMakeCache.txt exists, but sources may have moved
......@@ -35,14 +71,33 @@ doCmake()
else
exit 1
fi
} && make
} && make && {
echo "ParaView_DIR=$ParaView_DIR" > $sentinel
}
)
}
#
# Build library - use sentinel file(s) to handle paraview version changes
#
wmakeLibPv()
{
for libName
do
sentinel=$(versionOk $libName) || wclean $libName # version changed
wmake $targetType $libName && {
echo "ParaView_DIR=$ParaView_DIR" > $sentinel
}
done
}
# -----------------------------------------------------------------------------
if [ -d "$ParaView_DIR" ]
then
wmake $targetType vtkPVFoam
wmakeLibPv vtkPVFoam
if [ "$targetType" != objects ]
then
......
......@@ -62,7 +62,7 @@ add_paraview_plugin(
target_link_libraries(
PVFoamReader_SM
LINK_PUBLIC
vtkPVFoam
vtkPVFoam-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
finiteVolume
OpenFOAM
)
......
......@@ -8,4 +8,4 @@ vtkPVFoamMeshZone.C
vtkPVFoamUpdateInfo.C
vtkPVFoamUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPVFoam
LIB = $(FOAM_LIBBIN)/libvtkPVFoam-pv${ParaView_MAJOR}
sinclude $(GENERAL_RULES)/paraview
EXE_INC = \
${c++LESSWARN} \
-I$(LIB_SRC)/meshTools/lnInclude \
......@@ -16,5 +18,5 @@ LIB_LIBS = \
-lconversion \
-lgenericPatchFields \
-llagrangian \
-L$(FOAM_LIBBIN) -lvtkPVReaders \
-L$(FOAM_LIBBIN) -lvtkPVReaders-pv${ParaView_MAJOR} \
$(GLIBS)
......@@ -2,17 +2,15 @@
cd ${0%/*} || exit 1 # Run from this directory
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
#set -x
# deal with client/server vs combined plugins
# Cleanup client-server and/or combined plugins
rm -f $FOAM_LIBBIN/libPVblockMeshReader* 2>/dev/null
rm -rf PVblockMeshReader/Make # safety: old build location
wclean libso vtkPVblockMesh
# Where are the generated files stored?
# Cleanup generated files
findObjectDir $PWD # remove entire top-level
rm -rf "$objectsDir" > /dev/null 2>&1
......
......@@ -5,20 +5,56 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
# Ensure CMake gets the correct C/C++ compilers
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
# -----------------------------------------------------------------------------
#
# Check sentinel file(s) to handle paraview version changes
#
versionOk()
{
findObjectDir "$1" # Where generated files are stored
local sentinel="$objectsDir/ThirdParty"
echo $sentinel
local prev
if read -r prev 2>/dev/null < $sentinel
then
case "$prev" in
("ParaView_DIR=$ParaView_DIR")
return 0
;;
(*)
echo "ParaView_DIR changed between builds" 1>&2
return 1
;;
esac
elif [ -f "$objectsDir/CMakeCache.txt" ]
then
echo "previous build was incomplete" 1>&2
return 1
else
return 0
fi
}
# CMake into objectsDir,
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
doCmake()
{
local sourceDir="$1"
findObjectDir $sourceDir # Where are generated files stored?
# version changed
sentinel=$(versionOk $sourceDir) || rm -rf "$objectsDir" > /dev/null 2>&1
test -f "$objectsDir/CMakeCache.txt"
retry=$? # CMakeCache.txt exists, but sources may have moved
......@@ -35,14 +71,33 @@ doCmake()
else
exit 1
fi
} && make
} && make && {
echo "ParaView_DIR=$ParaView_DIR" > $sentinel
}
)
}
#
# Build library - use sentinel file(s) to handle paraview version changes
#
wmakeLibPv()
{
for libName
do
sentinel=$(versionOk $libName) || wclean $libName # version changed
wmake $targetType $libName && {
echo "ParaView_DIR=$ParaView_DIR" > $sentinel
}
done
}
# -----------------------------------------------------------------------------
if [ -d "$ParaView_DIR" ]
then
wmake $targetType vtkPVblockMesh
wmakeLibPv vtkPVblockMesh
if [ "$targetType" != objects ]
then
......
......@@ -62,7 +62,7 @@ add_paraview_plugin(
target_link_libraries(
PVblockMeshReader_SM
LINK_PUBLIC
vtkPVblockMesh
vtkPVblockMesh-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
blockMesh
OpenFOAM
)
......
......@@ -2,4 +2,4 @@ vtkPVblockMesh.C
vtkPVblockMeshConvert.C
vtkPVblockMeshUtils.C
LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh
LIB = $(FOAM_LIBBIN)/libvtkPVblockMesh-pv${ParaView_MAJOR}
sinclude $(GENERAL_RULES)/paraview
EXE_INC = \
${c++LESSWARN} \
-I$(LIB_SRC)/meshTools/lnInclude \
......@@ -12,5 +14,5 @@ LIB_LIBS = \
-lmeshTools \
-lfileFormats \
-lblockMesh \
-L$(FOAM_LIBBIN) -lvtkPVReaders \
-L$(FOAM_LIBBIN) -lvtkPVReaders-pv${ParaView_MAJOR} \
$(GLIBS)
vtkPVReaders.C
LIB = $(FOAM_LIBBIN)/libvtkPVReaders
LIB = $(FOAM_LIBBIN)/libvtkPVReaders-pv${ParaView_MAJOR}
sinclude $(GENERAL_RULES)/paraview
EXE_INC = \
${c++LESSWARN} \
-I$(ParaView_INCLUDE_DIR) \
......
......@@ -2,10 +2,13 @@
cd ${0%/*} || exit 1 # Run from this directory
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
# Where are the generated files stored?
findObjectDir $PWD
# Cleanup library
rm -f $FOAM_LIBBIN/librunTimePostProcessing* 2>/dev/null
# Cleanup generated files
findObjectDir $PWD # remove entire top-level
rm -rf "$objectsDir" > /dev/null 2>&1
#------------------------------------------------------------------------------
......@@ -2,23 +2,56 @@
cd ${0%/*} || exit 1 # Run from this directory
# Source the wmake functions
. $WM_DIR/scripts/wmakeFunctions
. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions
# Ensure CMake gets the correct C/C++ compilers
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
echo "======================================================================"
echo "${PWD##*/} : $PWD"
echo
# -----------------------------------------------------------------------------
#
# Check sentinel file(s) to handle vtk/paraview version changes
#
versionOk()
{
findObjectDir "$1" # Where generated files are stored
local sentinel="$objectsDir/ThirdParty"
echo $sentinel
local prev
if read -r prev 2>/dev/null < $sentinel
then
case "$prev" in
("ParaView_DIR=$ParaView_DIR" | "VTK_DIR=$VTK_DIR")
return 0
;;
(*)
echo "ParaView_DIR or VTK_DIR changed between builds" 1>&2
return 1
;;
esac
elif [ -f "$objectsDir/CMakeCache.txt" ]
then
echo "previous build was incomplete" 1>&2
return 1
else
return 0
fi
}
# CMake into objectsDir,
# with an additional attempt if (possibly incorrect) CMakeCache.txt existed
doCmake()
{
local sourceDir="$1"
findObjectDir $sourceDir # Where are generated files stored?
# version changed
sentinel=$(versionOk $sourceDir) || rm -rf "$objectsDir" > /dev/null 2>&1
test -f "$objectsDir/CMakeCache.txt"
retry=$? # CMakeCache.txt exists, but sources may have moved
......@@ -35,11 +68,27 @@ doCmake()
else
exit 1
fi
} && make
} && make && {
if [ -d "$VTK_DIR" ]
then
echo "VTK_DIR=$VTK_DIR"
elif [ -d "$ParaView_DIR" ]
then
echo "ParaView_DIR=$ParaView_DIR"
else
echo unknown
fi > $sentinel
}
)
}
# -----------------------------------------------------------------------------
echo "======================================================================"
echo "${PWD##*/} : $PWD"
echo
if [ -d "$VTK_DIR" -o -d "$ParaView_DIR" ]
then
if [ "$targetType" != objects ]
......
#-------------------------------*- makefile -*---------------------------------
# paraview values
# major.minor: eg, /path/paraview-5.0 -> 5.0
#
ParaView_MAJOR := $(shell echo $(ParaView_INCLUDE_DIR) | sed -e 's/^.*-//')
#------------------------------------------------------------------------------
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