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
This commit is contained in:
Mark Olesen
2017-01-05 16:22:07 +01:00
parent 2c96ec7550
commit 7a90f5e6fb
16 changed files with 260 additions and 36 deletions

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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 ]