diff --git a/bin/tools/foamVersionCompare b/bin/tools/foamVersionCompare index e9879440e2..99647fbe24 100755 --- a/bin/tools/foamVersionCompare +++ b/bin/tools/foamVersionCompare @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2020 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -121,7 +121,7 @@ _foamVersionGe() # Parse arguments [ $# -eq 3 ] || error "Incorrect arguments specified" -v1=$1 +v1=${1##*-} shift 1 case $1 in @@ -149,7 +149,7 @@ case $1 in esac shift 1 -v2=$1 +v2=${1##*-} shift 1 # Perform comparison and return diff --git a/etc/config.csh/paraview b/etc/config.csh/paraview index 5dc83e3a9c..9ea45ce17a 100644 --- a/etc/config.csh/paraview +++ b/etc/config.csh/paraview @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -40,16 +40,23 @@ if ( ! $?ParaView_DIR ) setenv ParaView_DIR set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` if ( $status == 0 ) setenv PATH $cleaned -# Determine the cmake to be used -unsetenv CMAKE_HOME -foreach cmake ( cmake-3.2.1 cmake-2.8.12.1 cmake-2.8.8 cmake-2.8.4 cmake-2.8.3 cmake-2.8.1 cmake-3.9.0) - set cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake - if ( -r $cmake ) then - setenv CMAKE_HOME $cmake - setenv PATH ${CMAKE_HOME}/bin:${PATH} - break +# Determine the cmake to be used. Take the most recent. +unsetenv CMAKE_HOME CMAKE_ROOT +set nonomatch +foreach cmake ( $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake-* ) + if ( -d $cmake ) then + if ( $?CMAKE_HOME ) then + $WM_PROJECT_DIR/bin/tools/foamVersionCompare $CMAKE_HOME lt $cmake + endif + if ( ! $?CMAKE_HOME || $status == 0 ) then + setenv CMAKE_HOME $cmake + setenv CMAKE_ROOT $cmake + endif endif end +if ( $?CMAKE_HOME ) then + setenv PATH $cmake/bin:${PATH} +endif #- ParaView version, automatically determine major version: #setenv ParaView_VERSION 4.0.1 @@ -134,7 +141,7 @@ if ( -d $ParaView_DIR || -d $paraviewSrcDir ) then # Alias paraview to launch with mesa if necessary if ("$ParaView_GL" == mesa) then - alias paraview 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ParaView_LIB_DIR/mesa paraview' + alias paraview 'env LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ParaView_LIB_DIR}/mesa paraview' endif else unsetenv PV_PLUGIN_PATH diff --git a/etc/config.sh/paraview b/etc/config.sh/paraview index 12043f44e6..97826c1ca6 100644 --- a/etc/config.sh/paraview +++ b/etc/config.sh/paraview @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | Website: https://openfoam.org -# \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -41,20 +41,24 @@ cleaned=$($WM_PROJECT_DIR/bin/foamCleanPath "$PATH" \ ) \ && PATH="$cleaned" -# Determine the cmake to be used -unset CMAKE_HOME -for cmake in cmake-3.2.1 cmake-2.8.12.1 cmake-2.8.8 cmake-2.8.4 cmake-2.8.3 \ - cmake-2.8.1 cmake-3.9.0 +# Determine the cmake to be used. Take the most recent. +unset CMAKE_HOME CMAKE_ROOT +for cmake in $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake-* do - cmake=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cmake - if [ -r $cmake ] + if [ -d $cmake ] then - export CMAKE_HOME=$cmake - export CMAKE_ROOT=$cmake - export PATH=$CMAKE_HOME/bin:$PATH - break + if [ -z $CMAKE_HOME ] || \ + $WM_PROJECT_DIR/bin/tools/foamVersionCompare $CMAKE_HOME lt $cmake + then + export CMAKE_HOME=$cmake + export CMAKE_ROOT=$cmake + fi fi done +if [ -n $CMAKE_HOME ] +then + export PATH=$cmake/bin:$PATH +fi #- ParaView version, automatically determine major version #export ParaView_VERSION=4.0.1