From c92ad9fce946a6f4f60afa27b0a96a72e6a0902b Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Wed, 6 Nov 2019 09:18:51 +0100
Subject: [PATCH] ENH: test for WM_PROJECT_DIR being set/unset in scripts

COMP: provide separate get_pvplugin_api function
---
 src/paraview-plugins/Allwclean |  8 ++++++--
 src/paraview-plugins/Allwmake  | 15 +++++++--------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/paraview-plugins/Allwclean b/src/paraview-plugins/Allwclean
index 74d66bd..4336df9 100755
--- a/src/paraview-plugins/Allwclean
+++ b/src/paraview-plugins/Allwclean
@@ -1,6 +1,10 @@
 #!/bin/sh
-cd ${0%/*} || exit 1                            # Run from this directory
-. $WM_PROJECT_DIR/wmake/scripts/wmakeFunctions  # Source wmake functions
+cd ${0%/*} || exit 1                                # Run from this directory
+. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions  # Require wmake functions
+. ${WM_PROJECT_DIR:?}/wmake/scripts/paraviewFunctions # For API info
+# -----------------------------------------------------------------------------
+
+get_pvplugin_api || echo "No ParaView plugin information found" 1>&2
 
 # Cleanup libraries
 wclean libso foamPv
diff --git a/src/paraview-plugins/Allwmake b/src/paraview-plugins/Allwmake
index 656c1e6..4e9cccf 100755
--- a/src/paraview-plugins/Allwmake
+++ b/src/paraview-plugins/Allwmake
@@ -1,9 +1,8 @@
 #!/bin/sh
-cd ${0%/*} || exit 1                            # Run from this directory
-export WM_CONTINUE_ON_ERROR=true                # Optional unit
-. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
-. $WM_PROJECT_DIR/wmake/scripts/paraviewFunctions  # CMake and PV functions
-
+cd ${0%/*} || exit 1                                # Run from this directory
+export WM_CONTINUE_ON_ERROR=true                    # Optional unit
+. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
+. ${WM_PROJECT_DIR:?}/wmake/scripts/paraviewFunctions # CMake, PV functions
 # -----------------------------------------------------------------------------
 
 warnIncomplete()
@@ -20,7 +19,7 @@ then
     wmakeLibPv blockMeshReader/library
     wmakeLibPv foamReader/library
 
-    unset cmakeType
+    unset cmakeOpts cmakeType
 
     if [ "$targetType" != objects ]
     then
@@ -37,8 +36,8 @@ then
 
     if [ -n "$cmakeType" ]
     then
-        "$cmakeType" $PWD/blockMeshReader || warnIncomplete "blockMesh"
-        "$cmakeType" $PWD/foamReader || warnIncomplete "OpenFOAM"
+        "$cmakeType" $PWD/blockMeshReader "$cmakeOpts" || warnIncomplete "blockMesh"
+        "$cmakeType" $PWD/foamReader "$cmakeOpts" || warnIncomplete "OpenFOAM"
     fi
 )
 fi
-- 
GitLab