diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake index 6221a17400c817ffdd12eb4cb15d0f0105544e27..7788998933d05849534a7d11f84e35d46d0e8fc7 100755 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVFoamReader/Allwmake @@ -7,29 +7,49 @@ cd ${0%/*} || exit 1 # Run from this directory # Source the wmake functions . $WM_DIR/scripts/wmakeFunctions -# ensure CMake gets the correct C/C++ compilers +# Ensure CMake gets the correct C/C++ compilers [ -n "$WM_CC" ] && export CC="$WM_CC" [ -n "$WM_CXX" ] && export CXX="$WM_CXX" -#set -x -if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] + +# CMake into objectsDir, +# with an additional attempt if (possibly incorrect) CMakeCache.txt existed +doCmake() +{ + local sourceDir="$1" + + findObjectDir $sourceDir # Where are generated files stored? + test -f "$objectsDir/CMakeCache.txt" + retry=$? # CMakeCache.txt exists, but sources may have moved + + mkdir -p $objectsDir && \ + ( + cd $objectsDir || exit 1 + + cmake $sourceDir || { + if [ $retry -eq 0 ] + then + echo "Removing CMakeCache.txt and attempt again" + rm -f CMakeCache.txt + cmake $sourceDir + else + exit 1 + fi + } && make + ) +} + + +if [ -d "$ParaView_DIR" ] then wmake $targetType vtkPVFoam - if [ "$targetType" != "objects" ] + if [ "$targetType" != objects ] then - sourceDir=$PWD/PVFoamReader - - # Where are any generated files stored? - findObjectDir $sourceDir - ( - mkdir -p $objectsDir \ - && cd $objectsDir \ - && cmake $sourceDir \ - && make - ) || { + doCmake $PWD/PVFoamReader || { + echo + echo " WARNING: incomplete build of ParaView OpenFOAM plugin" echo - echo "WARNING: incomplete build of ParaView OpenFOAM plugin" } fi fi diff --git a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake index d899144c3b530a3b51ac0ccedf406246f88d8fbd..607a6cb8e3cf8da211f9ec8fa284bad83a069270 100755 --- a/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/PVReaders/PVblockMeshReader/Allwmake @@ -11,25 +11,45 @@ cd ${0%/*} || exit 1 # Run from this directory [ -n "$WM_CC" ] && export CC="$WM_CC" [ -n "$WM_CXX" ] && export CXX="$WM_CXX" -#set -x -if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] + +# CMake into objectsDir, +# with an additional attempt if (possibly incorrect) CMakeCache.txt existed +doCmake() +{ + local sourceDir="$1" + + findObjectDir $sourceDir # Where are generated files stored? + test -f "$objectsDir/CMakeCache.txt" + retry=$? # CMakeCache.txt exists, but sources may have moved + + mkdir -p $objectsDir && \ + ( + cd $objectsDir || exit 1 + + cmake $sourceDir || { + if [ $retry -eq 0 ] + then + echo "Removing CMakeCache.txt and attempt again" + rm -f CMakeCache.txt + cmake $sourceDir + else + exit 1 + fi + } && make + ) +} + + +if [ -d "$ParaView_DIR" ] then wmake $targetType vtkPVblockMesh - if [ "$targetType" != "objects" ] + if [ "$targetType" != objects ] then - sourceDir=$PWD/PVblockMeshReader - - # Where are any generated files stored? - findObjectDir $sourceDir - ( - mkdir -p $objectsDir \ - && cd $objectsDir \ - && cmake $sourceDir \ - && make - ) || { + doCmake $PWD/PVblockMeshReader || { + echo + echo " WARNING: incomplete build of ParaView BlockMesh plugin" echo - echo "WARNING: incomplete build of ParaView BlockMesh plugin" } fi fi diff --git a/src/functionObjects/graphics/runTimePostProcessing/Allwmake b/src/functionObjects/graphics/runTimePostProcessing/Allwmake index 277a8c394f6f36ad02f89b0bab074c3f8121925e..9538323521da100a8679713d8eb5b7261fa33254 100755 --- a/src/functionObjects/graphics/runTimePostProcessing/Allwmake +++ b/src/functionObjects/graphics/runTimePostProcessing/Allwmake @@ -4,37 +4,58 @@ cd ${0%/*} || exit 1 # Run from this directory # Source the wmake functions . $WM_DIR/scripts/wmakeFunctions -# The source directory -sourceDir=$PWD - -# Where are any generated files stored? -findObjectDir $sourceDir -depDir="$objectsDir" +# Ensure CMake gets the correct C/C++ compilers +[ -n "$WM_CC" ] && export CC="$WM_CC" +[ -n "$WM_CXX" ] && export CXX="$WM_CXX" echo echo "======================================================================" echo "${PWD##*/} : $PWD" echo + +# CMake into objectsDir, +# with an additional attempt if (possibly incorrect) CMakeCache.txt existed +doCmake() +{ + local sourceDir="$1" + + findObjectDir $sourceDir # Where are generated files stored? + test -f "$objectsDir/CMakeCache.txt" + retry=$? # CMakeCache.txt exists, but sources may have moved + + mkdir -p $objectsDir && \ + ( + cd $objectsDir || exit 1 + + cmake $sourceDir || { + if [ $retry -eq 0 ] + then + echo "Removing CMakeCache.txt and attempt again" + rm -f CMakeCache.txt + cmake $sourceDir + else + exit 1 + fi + } && make + ) +} + + if [ -d "$VTK_DIR" -o -d "$ParaView_DIR" ] then - # ensure CMake gets the correct C/C++ compilers - [ -n "$WM_CC" ] && export CC="$WM_CC" - [ -n "$WM_CXX" ] && export CXX="$WM_CXX" - - if type cmake > /dev/null 2>&1 + if [ "$targetType" != objects ] then - ( - mkdir -p $depDir \ - && cd $depDir \ - && cmake $sourceDir \ - && make - ) || { - echo - echo "WARNING: incomplete build of VTK-based post-processing" - } - else - echo "WARNING: skipped - needs cmake" + if type cmake > /dev/null 2>&1 + then + doCmake $PWD || { + echo + echo " WARNING: incomplete build of VTK-based post-processing" + echo + } + else + echo "WARNING: skipped - needs cmake" + fi fi else echo "WARNING: skipped - needs a VTK or a ParaView installation" @@ -45,4 +66,4 @@ fi echo "======================================================================" echo -# ----------------------------------------------------------------- end-of-file +# -----------------------------------------------------------------------------