From f84990e9065de82d8fdd26d1416f60945c009db3 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 28 Jan 2021 12:10:03 +0100 Subject: [PATCH] CONFIG: avoid deprecated CMake variables (ParaView) - use MPI_ARCH_PATH to provide an MPI hint when making ParaView, VTK and ADIOS. This should align the detected MPI with what OpenFOAM itself is using. Option -mpi-home to override. --- etc/tools/ParaViewFunctions | 57 +++++++++++++++++++++++++++++++------ etc/tools/vtkFunctions | 6 +++- makeAdios2 | 19 +++++++++++-- makeParaView | 22 ++++++++++++-- makeVTK | 20 +++++++++++-- 5 files changed, 105 insertions(+), 19 deletions(-) diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions index f5bfae3..d21197d 100644 --- a/etc/tools/ParaViewFunctions +++ b/etc/tools/ParaViewFunctions @@ -6,7 +6,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -114,18 +114,38 @@ setParaViewVersion() #------------------------------------------------------------------------------ # -# Set CMake cache variables +# Set CMake cache variables. +# Automatically adds -D prefix it needed # addCMakeVariable() { local i for i do - [ -n "$i" ] && CMAKE_VARIABLES="$CMAKE_VARIABLES -D$i" + case "$i" in + ('') ;; # empty + (-*) CMAKE_VARIABLES="${CMAKE_VARIABLES} ${i}" ;; + (*) CMAKE_VARIABLES="${CMAKE_VARIABLES} -D${i}" ;; + esac done } +# +# General settings (version-dependent) +# +addGeneral() +{ + if printf "${ParaView_MAJOR}"'\n%s\n' 5.6 | sort -V -C + then + # Paraview 5.6 and older + addCMakeVariable "BUILD_SHARED_LIBS=ON" + else + addCMakeVariable "PARAVIEW_BUILD_SHARED_LIBS=ON" + fi +} + + # # Verbose makefiles # @@ -153,6 +173,10 @@ addMpiSupport() then addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" fi + + echo "----" + echo "MPI information:" + echo " home : $MPI_HOME" } @@ -244,7 +268,13 @@ addPythonSupport() exit 1 } - addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON" + if printf "${ParaView_MAJOR}"'\n%s\n' 5.7 | sort -V -C + then + # Paraview 5.7 and older + addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON" + else + addCMakeVariable "PARAVIEW_USE_PYTHON=ON" + fi addCMakeVariable "PYTHON_INCLUDE_DIRS=$PYTHON_INCLUDE" addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY" @@ -304,20 +334,27 @@ addQtSupport() QT_VERSION=none : ${withQT:=true} # default is on + local qmake qtLib + local cmakeVarName="PARAVIEW_USE_QT" + + if printf "${ParaView_MAJOR}"'\n%s\n' 5.7 | sort -V -C + then + # Paraview 5.7 and older + cmakeVarName="PARAVIEW_BUILD_QT_GUI" + fi + if [ "$withQT" = false ] then # Explicitly disabled - addCMakeVariable "PARAVIEW_BUILD_QT_GUI=OFF" + addCMakeVariable "$cmakeVarName=OFF" return fi - local qmake qtLib - # Check qmake can be found and handle version differences qmake=$(findQMake) if QT_VERSION=$($qmake -query QT_VERSION 2>/dev/null) then - addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON" + addCMakeVariable "$cmakeVarName=ON" case "$QT_VERSION" in (3.* | 4.[0-4]*) @@ -495,7 +532,9 @@ INFO #------------------------------------------------------------------------------ # Start with these general settings -addCMakeVariable "BUILD_SHARED_LIBS=ON" "BUILD_TESTING=OFF" + +# No testing +addCMakeVariable "BUILD_TESTING=OFF" # Include development files in "make install" addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT_FILES=ON" diff --git a/etc/tools/vtkFunctions b/etc/tools/vtkFunctions index 917e44d..33b951e 100644 --- a/etc/tools/vtkFunctions +++ b/etc/tools/vtkFunctions @@ -5,7 +5,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -168,6 +168,10 @@ addMpiSupport() then addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" fi + + echo "----" + echo "MPI information:" + echo " home : $MPI_HOME" } diff --git a/makeAdios2 b/makeAdios2 index 1a8dd92..0c25f0d 100755 --- a/makeAdios2 +++ b/makeAdios2 @@ -63,6 +63,12 @@ _foamConfig adios2 adiosPACKAGE=${adios2_version:-adios-none} +# Hint for cmake findMPI +if [ -d "$MPI_ARCH_PATH" ] +then + export MPI_HOME="$MPI_ARCH_PATH" +fi + #------------------------------------------------------------------------------ usage() { exec 1>&2 @@ -71,9 +77,10 @@ usage() { usage: ${0##*/} [OPTION] [adios-VERSION] options: - -force Force compilation, even if include/library already exists - -gcc Force use of gcc/g++ - -cmake PATH With cmake from the given path + -force Force compilation, even if include/library already exists + -gcc Force use of gcc/g++ + -cmake PATH With cmake from the given path + -mpi-home PATH With hint for MPI_HOME -help * Build ADIOS2 @@ -102,6 +109,12 @@ do CMAKE_PATH="${2%%/}" shift ;; + -mpi-home) # mpi with hint + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + export MPI_HOME="${2%%/}" + case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac + shift + ;; ADIOS2-[0-9]* | ADIOS2-git* | ADIOS-[0-9]* | ADIOS-git* | \ adios2-[0-9]* | adios2-git* | adios-[0-9]* | adios-git*) adiosPACKAGE="${1%%/}" diff --git a/makeParaView b/makeParaView index 2c1d31e..9d7027c 100755 --- a/makeParaView +++ b/makeParaView @@ -7,7 +7,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -64,6 +64,12 @@ setParaViewVersion ${ParaView_VERSION:-none} # New rendering backend (starting with paraview 5.0). withGL2=auto # auto-config based on version +# Hint for cmake findMPI +if [ -d "$MPI_ARCH_PATH" ] +then + export MPI_HOME="$MPI_ARCH_PATH" +fi + #------------------------------------------------------------------------------ usage() { exec 1>&2 @@ -83,6 +89,7 @@ options: -mesa-lib PATH path to mesa library (current: ${MESA_LIBRARY:-none}) -mpi with mpi -mpi=N with max 'N' mpi processes. N=0 for no upper-limit. + -mpi-home PATH with mpi and hint for MPI_HOME -python | -python2 | -python3 with python -python-include DIR @@ -90,13 +97,14 @@ options: -python-lib PATH path to python library (current: ${PYTHON_LIBRARY:-none}) -qmake PATH with QT version corresponding to the qmake in given path -qt with extra Qt gui support (if not already enabled) - -qt-VER with QT version corresponding to + -qt- with QT version corresponding to \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake -verbose verbose output in Makefiles -version VER specify an alternative version (current: $ParaView_VERSION) -major VER specify an alternative major version for special builds -buildType NAME specify the build type (default: Release) -suffix NAME specify a suffix to distinguish the build + -DNAME=VALUE add cmake variable -help The -no-FEATURE option can be used to forcibly disable these features: @@ -147,7 +155,7 @@ do [0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version setParaViewVersion "${1%%/}" ;; - [A-Z]*=*) # cmake variables + -D[A-Z]*=* | [A-Z]*=*) # cmake variables addCMakeVariable "$1" ;; -patch) # stage 0: patch sources @@ -231,6 +239,13 @@ do withMPI=true MPI_MAX_PROCS="${1##*=}" ;; + -mpi-home) # mpi with hint + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + withMPI=true + export MPI_HOME="${2%%/}" + case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac + shift + ;; -no-mpi) withMPI=false ;; @@ -359,6 +374,7 @@ fi # Set configure options #~~~~~~~~~~~~~~~~~~~~~~ +addGeneral # general settings (version-dependent) addVerbosity # verbose makefiles addMpiSupport # set MPI-specific options addPythonSupport # set Python-specific options diff --git a/makeVTK b/makeVTK index a5135f3..a056ef2 100755 --- a/makeVTK +++ b/makeVTK @@ -6,7 +6,7 @@ # \\ / A nd | www.openfoam.com # \\/ M anipulation | #------------------------------------------------------------------------------ -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -53,10 +53,15 @@ case "$VTK_VERSION" in esac VTK_VERSION="${VTK_VERSION%%-*}" # Without suffix (eg, -mesa) - # New rendering backend (starting with vtk 7?). withGL2=auto # auto-config based on version +# Hint for cmake findMPI +if [ -d "$MPI_ARCH_PATH" ] +then + export MPI_HOME="$MPI_ARCH_PATH" +fi + #------------------------------------------------------------------------------ usage() { exec 1>&2 @@ -76,10 +81,12 @@ options: -osmesa with off-screen mesa only -mpi with mpi (VTK_Group_MPI=ON) -mpi=N with max 'N' mpi processes. N=0 for no upper-limit. + -mpi-home PATH with mpi and hint for MPI_HOME -verbose verbose output in Makefiles -version VER specify an alternative version (current: $VTK_VERSION) -buildType NAME specify the build type (default: Release) -suffix NAME specify a suffix to distinguish the build + -DNAME=VALUE add cmake variable -help The -no-FEATURE option can be used to forcibly disable these features: @@ -123,7 +130,7 @@ do [0-9]* | vtk-[0-9]* | VTK-[0-9]*) # VTK version setVtkVersion "${1%%/}" ;; - [A-Z]*=*) # cmake variables + -D[A-Z]*=* | [A-Z]*=*) # cmake variables addCMakeVariable "$1" ;; -patch) # stage 0: patch sources @@ -204,6 +211,13 @@ do withMPI=true MPI_MAX_PROCS="${1##*=}" ;; + -mpi-home) # mpi with hint + [ "$#" -ge 2 ] || die "'$1' option requires an argument" + withMPI=true + export MPI_HOME="${2%%/}" + case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac + shift + ;; -no-mpi) withMPI=false ;;