From 0840c1ec63af11a819e5c55e8932aa66f9541880 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 2 Jul 2024 15:34:57 +0100 Subject: [PATCH] makeParaView: Provide feedback if ParaView version is not set --- etc/tools/ParaViewFunctions | 6 ++---- makeParaView | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions index 24d60ef5..a3a9a97a 100644 --- a/etc/tools/ParaViewFunctions +++ b/etc/tools/ParaViewFunctions @@ -76,14 +76,12 @@ setVersion() { if [ "$#" -ge 1 ] then - ParaView_VERSION="${1##paraview-}" + export ParaView_VERSION="$1" fi # The major version is "." - ParaView_MAJOR=$(echo $ParaView_VERSION | \ + export ParaView_MAJOR=$(echo $ParaView_VERSION | \ sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/') - - export ParaView_VERSION ParaView_MAJOR } diff --git a/makeParaView b/makeParaView index b0c9fe65..ce919962 100755 --- a/makeParaView +++ b/makeParaView @@ -39,6 +39,7 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || { echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 } +. $WM_PROJECT_DIR/etc/config.sh/functions . etc/tools/ThirdPartyFunctions . etc/tools/ParaViewFunctions #------------------------------------------------------------------------------ @@ -110,10 +111,9 @@ For finer control, the build stages can be selected or deselected individually: -make -no-make -install -no-install - -* Make and install paraview-$ParaView_VERSION located under +* Make and install ParaView-$ParaView_VERSION located under \$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 USAGE exit 1 @@ -133,7 +133,7 @@ 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 +# set ParaView_MAJOR based on current value of ParaView_VERSION (if any) setVersion # @@ -150,6 +150,14 @@ do -h | -help) usage ;; + paraview-*) + setVersion "${2##paraview-*}" + shift 2 + ;; + ParaView-*) + setVersion "${2##ParaView-*}" + shift 2 + ;; [A-Z]*=*) # cmake variables addCMakeVariable "$1" shift @@ -272,6 +280,26 @@ do esac done + +# If we don't have a version, then try to detect it +if [ -z "$ParaView_VERSION" ] +then + ParaView_SOURCE_DIR=$(_foamMostRecentDir ParaView-*) + if [ -d "$ParaView_SOURCE_DIR" ] + then + setVersion "${ParaView_SOURCE_DIR##*ParaView-}" + fi +fi + +# If we still don't have a version, then quit, asking the user to specify one +if [ -z "$ParaView_VERSION" ] +then + ParaView_VERSION=?.?.? + usage "The version was not specified on the command line, set in the OpenFOAM +configuration, or detected on disk. Specify a version with '-version VER'." +fi + + if [ "$runDEFAULT" = true ] then : ${runCONFIG:=true} @@ -279,6 +307,7 @@ then : ${runINSTALL:=true} fi + # Download ParaView sources #~~~~~~~~~~~~~~~~~~~~~~~~~~ downloadParaView || usage "ParaView download failed. Re-run to retry download"