ENH: makeParaView now accepts paraview-VERSION directly as argument

- Symmetrical with the usage for most other ThirdParty build
  scripts. For example,

      "makeParaView ParaView-5.0.1"

- As a convenience, also allow a number directly. For example,

      "makeParaView 5.0.1"

  This should be clearer than the old instruction and does not
  rely on an alias:

      "foamPV 5.0.1; ./makeParaView"

BUG: heuristics for activating GL2 rendering backend missed when
     paraview version was specified from the command-line
This commit is contained in:
mark
2016-07-13 08:40:24 +02:00
parent 34023f31b8
commit bee5ef0d19
4 changed files with 71 additions and 30 deletions

View File

@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -72,12 +72,16 @@ setDirs()
# #
# Set ParaView_VERSION and adjust ParaView_MAJOR accordingly # 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() setVersion()
{ {
if [ "$#" -ge 1 ] [ $# -gt 0 ] || {
then echo "Error: function setVersion() called without an argument"
ParaView_VERSION="${1##paraview-}" exit 1
fi }
ParaView_VERSION="${1##*-}"
# The major version is "<digits>.<digits>" # The major version is "<digits>.<digits>"
ParaView_MAJOR=$(echo $ParaView_VERSION | \ ParaView_MAJOR=$(echo $ParaView_VERSION | \
@ -410,7 +414,7 @@ configParaView()
echo echo
# Run cmake to create Makefiles # Run cmake to create Makefiles
$cmakeExe \ $cmakeExe -Wno-dev \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \ -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
$CMAKE_VARIABLES \ $CMAKE_VARIABLES \
$ParaView_SOURCE_DIR $ParaView_SOURCE_DIR

View File

@ -72,12 +72,16 @@ setDirs()
# #
# Set ParaView_VERSION and adjust ParaView_MAJOR accordingly # 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() setVersion()
{ {
if [ "$#" -ge 1 ] [ $# -gt 0 ] || {
then echo "Error: function setVersion() called without an argument"
ParaView_VERSION="${1##paraview-}" exit 1
fi }
ParaView_VERSION="${1##*-}"
# The major version is "<digits>.<digits>" # The major version is "<digits>.<digits>"
ParaView_MAJOR=$(echo $ParaView_VERSION | \ ParaView_MAJOR=$(echo $ParaView_VERSION | \

View File

@ -31,7 +31,7 @@
# (note capitalisation) # (note capitalisation)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# run from third-party directory only # Run from third-party directory only
cd ${0%/*} || exit 1 cd ${0%/*} || exit 1
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
echo "Error: Current directory is not \$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 # Set the path to cmake
CMAKE_PATH="" CMAKE_PATH=""
# new rendering backend (starting with paraview 5.0) # New rendering backend (starting with paraview 5.0).
withGL2=true # Default to auto-config based on paraview version
if [ "${ParaView_VERSION%%.*}" = 4 ] withGL2=auto
then withGL2=false
fi
# #
# NO FURTHER EDITING BELOW THIS LINE # NO FURTHER EDITING BELOW THIS LINE
@ -88,7 +86,7 @@ usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script [OPTION] [CMAKE-OPTION] usage: $Script [OPTION] [paraview-VERSION] [CMAKE-OPTION]
options: options:
-rebuild for repeated builds (-make -install) *use with caution* -rebuild for repeated builds (-make -install) *use with caution*
-gl2 with new rendering backend (if not already enabled) -gl2 with new rendering backend (if not already enabled)
@ -130,9 +128,10 @@ For finer control, the build stages can be selected or deselected individually:
\$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION \$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
-> \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION -> \$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, For example,
foamPV 4.4.0 ; ./makeParaview
./makeParaview 4.4.0
USAGE USAGE
exit 1 exit 1
@ -152,8 +151,8 @@ case "$Script" in *-mpi*) withMPI=true;; esac
case "$Script" in *-python*) withPYTHON=true;; esac case "$Script" in *-python*) withPYTHON=true;; esac
case "$Script" in *-qt*) withQT=true;; esac case "$Script" in *-qt*) withQT=true;; esac
# set ParaView_MAJOR based on current value of ParaView_VERSION # Set initial ParaView_MAJOR based on current value of ParaView_VERSION
setVersion setVersion ${ParaView_VERSION:-none}
# #
# various building stages # various building stages
@ -169,6 +168,9 @@ do
-h | -help) -h | -help)
usage usage
;; ;;
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
setVersion "${1%%/}"
;;
[A-Z]*=*) # cmake variables [A-Z]*=*) # cmake variables
addCMakeVariable "$1" addCMakeVariable "$1"
;; ;;
@ -272,7 +274,7 @@ do
;; ;;
-version) -version)
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
setVersion "$2" setVersion "${2%%/}"
shift shift
;; ;;
-major) -major)
@ -292,6 +294,25 @@ do
shift shift
done 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 ] if [ "$runDEFAULT" = true ]
then then

View File

@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM.
@ -31,7 +31,7 @@
# (note capitalisation) # (note capitalisation)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# run from third-party directory only # Run from third-party directory only
cd ${0%/*} || exit 1 cd ${0%/*} || exit 1
wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
echo "Error: Current directory is not \$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 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script [OPTION] [CMAKE-OPTION] usage: $Script [OPTION] [paraview-VERSION] [CMAKE-OPTION]
options: options:
-rebuild for repeated builds (-make -install) *use with caution* -rebuild for repeated builds (-make -install) *use with caution*
-mesa with mesa (if not already enabled) -mesa with mesa (if not already enabled)
@ -121,9 +121,10 @@ For finer control, the build stages can be selected or deselected individually:
\$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION \$WM_THIRD_PARTY_DIR/ParaView-$ParaView_VERSION
-> \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-$ParaView_VERSION -> \$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, For example,
foamPV 3.14.0 ; ./makeParaview
./makeParaview 3.14.1
USAGE USAGE
exit 1 exit 1
@ -143,8 +144,8 @@ case "$Script" in *-mpi*) withMPI=true;; esac
case "$Script" in *-python*) withPYTHON=true;; esac case "$Script" in *-python*) withPYTHON=true;; esac
case "$Script" in *-qt*) withQT=true;; esac case "$Script" in *-qt*) withQT=true;; esac
# set ParaView_MAJOR based on current value of ParaView_VERSION # Set initial ParaView_MAJOR based on current value of ParaView_VERSION
setVersion setVersion ${ParaView_VERSION:-none}
# #
# various building stages # various building stages
@ -159,6 +160,9 @@ do
-h | -help) -h | -help)
usage usage
;; ;;
[0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
setVersion "${1%%/}"
;;
[A-Z]*=*) # cmake variables [A-Z]*=*) # cmake variables
addCMakeVariable "$1" addCMakeVariable "$1"
;; ;;
@ -249,7 +253,7 @@ do
;; ;;
-version) -version)
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"
setVersion "$2" setVersion "${2%%/}"
shift shift
;; ;;
-major) -major)
@ -264,6 +268,14 @@ do
shift shift
done 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 ] if [ "$runDEFAULT" = true ]
then then