diff --git a/etc/tools/ParaView3Functions b/etc/tools/ParaView3Functions index 803ed9f..f95d1be 100644 --- a/etc/tools/ParaView3Functions +++ b/etc/tools/ParaView3Functions @@ -3,7 +3,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | +# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -72,12 +72,16 @@ setDirs() # # Set ParaView_VERSION and adjust ParaView_MAJOR accordingly # +# $1 can contain something something like 4.4.0, paraview-4.4.0, ParaView-4.0.0 +# setVersion() { - if [ "$#" -ge 1 ] - then - ParaView_VERSION="${1##paraview-}" - fi + [ $# -gt 0 ] || { + echo "Error: function setVersion() called without an argument" + exit 1 + } + + ParaView_VERSION="${1##*-}" # The major version is "." ParaView_MAJOR=$(echo $ParaView_VERSION | \ @@ -410,7 +414,7 @@ configParaView() echo # Run cmake to create Makefiles - $cmakeExe \ + $cmakeExe -Wno-dev \ -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \ $CMAKE_VARIABLES \ $ParaView_SOURCE_DIR diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions index d2c5cfd..590ba6b 100644 --- a/etc/tools/ParaViewFunctions +++ b/etc/tools/ParaViewFunctions @@ -72,12 +72,16 @@ setDirs() # # Set ParaView_VERSION and adjust ParaView_MAJOR accordingly # +# $1 can contain something something like 4.4.0, paraview-4.4.0, ParaView-4.0.0 +# setVersion() { - if [ "$#" -ge 1 ] - then - ParaView_VERSION="${1##paraview-}" - fi + [ $# -gt 0 ] || { + echo "Error: function setVersion() called without an argument" + exit 1 + } + + ParaView_VERSION="${1##*-}" # The major version is "." ParaView_MAJOR=$(echo $ParaView_VERSION | \ diff --git a/makeParaView b/makeParaView index 7fd1749..951ee99 100755 --- a/makeParaView +++ b/makeParaView @@ -31,7 +31,7 @@ # (note capitalisation) # #------------------------------------------------------------------------------ -# run from third-party directory only +# Run from third-party directory only cd ${0%/*} || exit 1 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" @@ -71,11 +71,9 @@ QMAKE_PATH="" # Set the path to cmake CMAKE_PATH="" -# new rendering backend (starting with paraview 5.0) -withGL2=true -if [ "${ParaView_VERSION%%.*}" = 4 ] -then withGL2=false -fi +# New rendering backend (starting with paraview 5.0). +# Default to auto-config based on paraview version +withGL2=auto # # NO FURTHER EDITING BELOW THIS LINE @@ -88,7 +86,7 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION -To change the paraview version, use the 'foamPV' command prior to '$Script'. +To make a different paraview version, simply specify on the command-line. For example, - foamPV 4.4.0 ; ./makeParaview + + ./makeParaview 4.4.0 USAGE exit 1 @@ -152,8 +151,8 @@ case "$Script" in *-mpi*) withMPI=true;; esac case "$Script" in *-python*) withPYTHON=true;; esac case "$Script" in *-qt*) withQT=true;; esac -# set ParaView_MAJOR based on current value of ParaView_VERSION -setVersion +# Set initial ParaView_MAJOR based on current value of ParaView_VERSION +setVersion ${ParaView_VERSION:-none} # # various building stages @@ -169,6 +168,9 @@ do -h | -help) usage ;; + [0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version + setVersion "${1%%/}" + ;; [A-Z]*=*) # cmake variables addCMakeVariable "$1" ;; @@ -272,7 +274,7 @@ do ;; -version) [ "$#" -ge 2 ] || die "'$1' option requires an argument" - setVersion "$2" + setVersion "${2%%/}" shift ;; -major) @@ -292,6 +294,25 @@ do shift done +[ -n "$ParaView_VERSION" ] || die "The paraview-VERSION was not specified" + +# nothing to build +if _foamIsNone "$ParaView_VERSION" +then + echo "Using paraview-none (skip ThirdParty build of ParaView)" + exit 0 +fi + +# Version-specific adjustments +if [ "$withGL2" = auto ] +then + if [ "${ParaView_VERSION%%.*}" = 4 ] + then + withGL2=false + else + withGL2=true + fi +fi if [ "$runDEFAULT" = true ] then diff --git a/makeParaView3 b/makeParaView3 index 7716daf..0c927b7 100755 --- a/makeParaView3 +++ b/makeParaView3 @@ -4,7 +4,7 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | +# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM. @@ -31,7 +31,7 @@ # (note capitalisation) # #------------------------------------------------------------------------------ -# run from third-party directory only +# Run from third-party directory only cd ${0%/*} || exit 1 wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { echo "Error: Current directory is not \$WM_THIRD_PARTY_DIR" @@ -82,7 +82,7 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION -To make a different paraview version, use the 'foamPV' command prior to '$Script'. +To make a different paraview version, simply specify on the command-line. For example, - foamPV 3.14.0 ; ./makeParaview + + ./makeParaview 3.14.1 USAGE exit 1 @@ -143,8 +144,8 @@ case "$Script" in *-mpi*) withMPI=true;; esac case "$Script" in *-python*) withPYTHON=true;; esac case "$Script" in *-qt*) withQT=true;; esac -# set ParaView_MAJOR based on current value of ParaView_VERSION -setVersion +# Set initial ParaView_MAJOR based on current value of ParaView_VERSION +setVersion ${ParaView_VERSION:-none} # # various building stages @@ -159,6 +160,9 @@ do -h | -help) usage ;; + [0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version + setVersion "${1%%/}" + ;; [A-Z]*=*) # cmake variables addCMakeVariable "$1" ;; @@ -249,7 +253,7 @@ do ;; -version) [ "$#" -ge 2 ] || die "'$1' option requires an argument" - setVersion "$2" + setVersion "${2%%/}" shift ;; -major) @@ -264,6 +268,14 @@ do shift done +[ -n "$ParaView_VERSION" ] || die "The paraview-VERSION was not specified" + +# nothing to build +if _foamIsNone "$ParaView_VERSION" +then + echo "Using paraview-none (skip ThirdParty build of ParaView)" + exit 0 +fi if [ "$runDEFAULT" = true ] then