From 0cc047cc8513d5e66d1fb055f7f35dd17dead9a9 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 17 Aug 2017 14:06:24 +0100 Subject: [PATCH] makeParaView: Added arguments for backend rendering and Python include path Patch contributed by Bruno Santos Resolves contribution request https://bugs.openfoam.org/view.php?id=2668 --- etc/tools/ParaViewFunctions | 37 ++++++++++++++++++++++++++----------- makeParaView | 29 ++++++++++++++++++++++++++--- 2 files changed, 52 insertions(+), 14 deletions(-) diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions index 9c230341..3f5ceea0 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 " @@ -402,6 +405,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 # @@ -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 eb4cdd11..4679a692 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