View Issue Details

IDProjectCategoryView StatusLast Update
0002668ThirdPartyContributionpublic2017-08-17 14:10
ReporterwyldckatAssigned Tohenry 
PrioritylowSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Versiondev 
Fixed in Version5.x 
Summary0002668: makeParaView: Added arguments for backend rendering and Python include path
DescriptionDuring the revision+testing of the instructions I've been maintaining at openfoamwiki.net for OpenFOAM-dev on CentOS 6.8 (for future reference: https://openfoamwiki.net/index.php/Installation/Linux/OpenFOAM-dev/CentOS_SL_RHEL ), I've stumbled upon two relevant limitations in current 'makeParaView' script and associated 'ParaViewFunctions':

 - Python 2.6 is no longer supported by ParaView 5.4.0, so it's necessary to use a custom build or RPM on CentOS/RHEL 6.8 and this means that the hard-coded path "/usr/include/python$Major.$Minor" is not practical.

 - I do a considerable amount of testing and usage of CentOS 6.x within virtualized environments, where OpenGL 2.* is not supported, therefore it's really handy to have an easy way to change the ParaView/VTK rendering backend without having to hack the 'ParaViewFunctions' script.


Therefore, the following contribution/patch+feature provides two new (optional) command line arguments for 'makeParaView':

   -rendering MODE rendering backend engine (current value: ${RENDERING_BACKEND:-undefined})
                         modes: OpenGL OpenGL2

   -python-include DIR
                     path to python include directory (current value: ${PYTHON_INCLUDE:-automatic})

Notes:

 - The "-rendering" option may seem a bit convoluted, but this is to account for possible future updates to ParaView/VTK in order to support for other rendering backends, such as Open EGL or Vulkan or something similar.

 - The "-python-include" option was added by following the same convention as used for '-python-lib'.

 - Also changed the entries that would state in the 'usage()' function has having 'none' as the current definition to instead state 'automatic', since they are automatically inferred.

 - Did a few more comment fixes and added the code needed to support the two new command line arguments.


For this are in attachment the following two files:

 - 'proposition_v3.tar.gz' - provides the following modified files:

     etc/tools/ParaViewFunctions
     makeParaView


 - 'proposition_v3.patch' - provides the patch file with the modified lines of code, for easier inspection here.


These are indexed to commit ee90d1ba6624 on OpenFOAM-dev from August 14th, namely already includes the fix from issue #2640.
It should be straight forward to bring these changes to OpenFOAM 5.x too with a simple 'git cherry-pick', but it's arguable if this is only a new feature or also a bug fix for supporting custom Python builds...
Additional InformationFor future reference, along with these tests, I've found out that the way ParaView 5.4.0 handles searching for Qt versions, leads to the 'PVReaders' library stack to no longer use the cached path to a custom build of Qt and its respective 'qmake' script. Therefore, the minimalistic way I could figure out for the 'PVReaders' stack to build properly, was to use the following command to only have CMake look for the Qt custom build:

  export CMAKE_PREFIX_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-4.8.6/

I still haven't fully thought through a way to make this a bit easier, but it might have to go through using a similar system to the one currently used for CGAL, Scotch and so on.
TagsNo tags attached.

Activities

wyldckat

2017-08-17 00:13

updater  

proposition_v3.tar.gz (6,943 bytes)

wyldckat

2017-08-17 00:13

updater  

proposition_v3.patch (5,990 bytes)
diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions
index 9c23034..3f5ceea 100644
--- a/etc/tools/ParaViewFunctions
+++ b/etc/tools/ParaViewFunctions
@@ -227,7 +227,7 @@ addPythonSupport()
             if [ ! -e "$PYTHON_LIBRARY" ]
             then
                 echo "*** Error: libpython not found at location specified " \
-                     "by -pythnon-lib input: PYTHON_LIBRARY=$PYTHON_LIBRARY"
+                     "by -python-lib input: PYTHON_LIBRARY=$PYTHON_LIBRARY"
             fi
         else
             # Try to get $PYTHON_LIBRARY from dynamically linked binary
@@ -248,28 +248,31 @@ addPythonSupport()
         }
 
         pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/')
-        pythonInclude=/usr/include/python$pythonMajor
 
-        # Note - we could also allow for a PYTHON_INCLUDE variable ...
-        [ -d "$pythonInclude" ] || {
-            echo "    No python headers found in $pythonInclude/"
+        if [ -z "$PYTHON_INCLUDE" ]
+        then
+            PYTHON_INCLUDE=/usr/include/python$pythonMajor
+        fi
+
+        [ -d "$PYTHON_INCLUDE" ] || {
+            echo "    No python headers found in $PYTHON_INCLUDE/"
             echo "    Please install python headers or deactivate "
             echo "    python support by not using the -python option"
             exit 1
         }
 
         addCMakeVariable  "PARAVIEW_ENABLE_PYTHON=ON"
-        addCMakeVariable  "PYTHON_INCLUDE_PATH=$pythonInclude"
+        addCMakeVariable  "PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE"
         addCMakeVariable  "PYTHON_LIBRARY=$PYTHON_LIBRARY"
 
         echo "----"
         echo "Python information:"
         echo "    executable     : $pythonBin"
         echo "    version        : $pythonMajor"
-        echo "    include path   : $pythonInclude"
+        echo "    include path   : $PYTHON_INCLUDE"
         echo "    library        : $PYTHON_LIBRARY"
 
-        unset pythonBin pythonInclude pythonMajor
+        unset pythonBin pythonMajor
     else
         echo "*** Error: python not found"
         echo "***        Deactivate python support by not using the -python "
@@ -403,6 +406,21 @@ addQtSupport()
 
 
 #
+# Configure ParaView/VTK rendering backend
+#
+configRenderingBackend()
+{
+    # Choose the rendering engine
+    if [ -n "${RENDERING_BACKEND}" ]
+    then
+        addCMakeVariable  "VTK_RENDERING_BACKEND=$RENDERING_BACKEND"
+    else
+        usage "*** Error: No rendering backend is defined"
+    fi
+}
+
+
+#
 # Configure via cmake, but don't actually build anything
 #
 configParaView()
@@ -541,9 +559,6 @@ unset buildType
 # Start with these general settings
 addCMakeVariable  "BUILD_SHARED_LIBS:BOOL=ON  VTK_USE_RPATH:BOOL=OFF"
 
-# Choose the new rendering engine
-addCMakeVariable  "VTK_RENDERING_BACKEND=OpenGL2"
-
 # Include development files in "make install"
 addCMakeVariable  "PARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON"
 
diff --git a/makeParaView b/makeParaView
index eb4cdd1..4679a69 100755
--- a/makeParaView
+++ b/makeParaView
@@ -55,7 +55,10 @@ MPI_MAX_PROCS=32
 #       If it fails, specify the path using the PYTHON_LIBRARY variable
 withPYTHON=false
 PYTHON_LIBRARY=""
-# PYTHON_LIBRARY="/usr/lib64/libpython2.6.so.1.0"
+PYTHON_INCLUDE=""
+# Examples
+# PYTHON_LIBRARY="/usr/lib64/libpython2.7.so.1.0"
+# PYTHON_INCLUDE="/usr/include/python2.7"
 
 # MESA graphics support:
 withMESA=false
@@ -65,12 +68,16 @@ MESA_LIBRARY="/usr/lib64/libOSMesa.so"
 # extra QT gui support (useful for some third party apps)
 withQT=true
 
-# Set the path to the Qt-4.5 (or later) qmake if the system Qt is older
+# Set the path to the Qt-4.7 (or later) qmake if the system Qt is older
 QMAKE_PATH=""
 
 # Set the path to cmake
 CMAKE_PATH=""
 
+# Selection of the rendering backend, usually associated to the OpenGL version
+# RENDERING_BACKEND=OpenGL
+RENDERING_BACKEND=OpenGL2
+
 #
 # NO FURTHER EDITING BELOW THIS LINE
 #
@@ -84,6 +91,8 @@ usage() {
 usage: $Script [OPTION] [CMAKE-OPTION]
 options:
   -rebuild          for repeated builds (-make -install) *use with caution*
+  -rendering MODE   rendering backend engine (current value: ${RENDERING_BACKEND:-undefined})
+                        modes: OpenGL OpenGL2
   -mesa             with mesa (if not already enabled)
   -mpi              with mpi (if not already enabled)
   -python           with python (if not already enabled)
@@ -99,7 +108,9 @@ options:
   -mesa-include DIR
                     location of mesa headers (current value: ${MESA_INCLUDE:-none})
   -mesa-lib PATH    path to mesa library     (current value: ${MESA_LIBRARY:-none})
-  -python-lib PATH  path to python library   (current value: ${PYTHON_LIBRARY:-none})
+  -python-lib PATH  path to python library   (current value: ${PYTHON_LIBRARY:-automatic})
+  -python-include DIR
+                    path to python include directory (current value: ${PYTHON_INCLUDE:-automatic})
   -help
 
 The -no-FEATURE option can be disable these features (if not already disabled):
@@ -196,6 +207,11 @@ do
         unset runDEFAULT
         shift
         ;;
+    -rendering)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+        RENDERING_BACKEND="$2"
+        shift 2
+        ;;
     -mesa)
         withMESA=true
         shift
@@ -235,6 +251,11 @@ do
         PYTHON_LIBRARY="$2"
         shift 2
         ;;
+    -python-include)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+        PYTHON_INCLUDE="$2"
+        shift 2
+        ;;
     -cmake)
         [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
         CMAKE_PATH=$2
@@ -302,6 +323,8 @@ addPythonSupport    # set Python-specific options
 addMesaSupport      # set MESA-specific options
 addQtSupport        # add extra Qt support
 
+configRenderingBackend # configure the rendering backend, e.g. OpenGL2
+
 setDirs             # where things are or should be put
 echoDateStamp       # report kitware source code date-stamp
 
proposition_v3.patch (5,990 bytes)

henry

2017-08-17 14:10

manager   ~0008598

Thanks Bruno

Resolved in ThirdParty-5.x by commit 382629e0285fb2a3fa277dadcbfb5023f619c030

Resolved in ThirdParty-dev by commit 0cc047cc8513d5e66d1fb055f7f35dd17dead9a9

Issue History

Date Modified Username Field Change
2017-08-17 00:13 wyldckat New Issue
2017-08-17 00:13 wyldckat Status new => assigned
2017-08-17 00:13 wyldckat Assigned To => henry
2017-08-17 00:13 wyldckat File Added: proposition_v3.tar.gz
2017-08-17 00:13 wyldckat File Added: proposition_v3.patch
2017-08-17 14:10 henry Status assigned => resolved
2017-08-17 14:10 henry Resolution open => fixed
2017-08-17 14:10 henry Fixed in Version => 5.x
2017-08-17 14:10 henry Note Added: 0008598