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.
This commit is contained in:
Mark Olesen
2021-01-28 12:10:03 +01:00
parent ddfdec4cd9
commit f84990e906
5 changed files with 105 additions and 19 deletions

View File

@ -6,7 +6,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd. # Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # 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() addCMakeVariable()
{ {
local i local i
for i for i
do 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 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 # Verbose makefiles
# #
@ -153,6 +173,10 @@ addMpiSupport()
then then
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
fi fi
echo "----"
echo "MPI information:"
echo " home : $MPI_HOME"
} }
@ -244,7 +268,13 @@ addPythonSupport()
exit 1 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_INCLUDE_DIRS=$PYTHON_INCLUDE"
addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY" addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY"
@ -304,20 +334,27 @@ addQtSupport()
QT_VERSION=none QT_VERSION=none
: ${withQT:=true} # default is on : ${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 ] if [ "$withQT" = false ]
then then
# Explicitly disabled # Explicitly disabled
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=OFF" addCMakeVariable "$cmakeVarName=OFF"
return return
fi fi
local qmake qtLib
# Check qmake can be found and handle version differences # Check qmake can be found and handle version differences
qmake=$(findQMake) qmake=$(findQMake)
if QT_VERSION=$($qmake -query QT_VERSION 2>/dev/null) if QT_VERSION=$($qmake -query QT_VERSION 2>/dev/null)
then then
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON" addCMakeVariable "$cmakeVarName=ON"
case "$QT_VERSION" in case "$QT_VERSION" in
(3.* | 4.[0-4]*) (3.* | 4.[0-4]*)
@ -495,7 +532,9 @@ INFO
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Start with these general settings # 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" # Include development files in "make install"
addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT_FILES=ON" addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT_FILES=ON"

View File

@ -5,7 +5,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2016-2020 OpenCFD Ltd. # Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -168,6 +168,10 @@ addMpiSupport()
then then
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS" addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
fi fi
echo "----"
echo "MPI information:"
echo " home : $MPI_HOME"
} }

View File

@ -63,6 +63,12 @@ _foamConfig adios2
adiosPACKAGE=${adios2_version:-adios-none} adiosPACKAGE=${adios2_version:-adios-none}
# Hint for cmake findMPI
if [ -d "$MPI_ARCH_PATH" ]
then
export MPI_HOME="$MPI_ARCH_PATH"
fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
exec 1>&2 exec 1>&2
@ -71,9 +77,10 @@ usage() {
usage: ${0##*/} [OPTION] [adios-VERSION] usage: ${0##*/} [OPTION] [adios-VERSION]
options: options:
-force Force compilation, even if include/library already exists -force Force compilation, even if include/library already exists
-gcc Force use of gcc/g++ -gcc Force use of gcc/g++
-cmake PATH With cmake from the given path -cmake PATH With cmake from the given path
-mpi-home PATH With hint for MPI_HOME
-help -help
* Build ADIOS2 * Build ADIOS2
@ -102,6 +109,12 @@ do
CMAKE_PATH="${2%%/}" CMAKE_PATH="${2%%/}"
shift 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* | \
adios2-[0-9]* | adios2-git* | adios-[0-9]* | adios-git*) adios2-[0-9]* | adios2-git* | adios-[0-9]* | adios-git*)
adiosPACKAGE="${1%%/}" adiosPACKAGE="${1%%/}"

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation # Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd. # Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # 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). # New rendering backend (starting with paraview 5.0).
withGL2=auto # auto-config based on version 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() { usage() {
exec 1>&2 exec 1>&2
@ -83,6 +89,7 @@ options:
-mesa-lib PATH path to mesa library (current: ${MESA_LIBRARY:-none}) -mesa-lib PATH path to mesa library (current: ${MESA_LIBRARY:-none})
-mpi with mpi -mpi with mpi
-mpi=N with max 'N' mpi processes. N=0 for no upper-limit. -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 -python | -python2 | -python3
with python with python
-python-include DIR -python-include DIR
@ -90,13 +97,14 @@ options:
-python-lib PATH path to python library (current: ${PYTHON_LIBRARY:-none}) -python-lib PATH path to python library (current: ${PYTHON_LIBRARY:-none})
-qmake PATH with QT version corresponding to the qmake in given path -qmake PATH with QT version corresponding to the qmake in given path
-qt with extra Qt gui support (if not already enabled) -qt with extra Qt gui support (if not already enabled)
-qt-VER with QT version corresponding to -qt-<VER> with QT version corresponding to
\$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake \$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/qt-VER/bin/qmake
-verbose verbose output in Makefiles -verbose verbose output in Makefiles
-version VER specify an alternative version (current: $ParaView_VERSION) -version VER specify an alternative version (current: $ParaView_VERSION)
-major VER specify an alternative major version for special builds -major VER specify an alternative major version for special builds
-buildType NAME specify the build type (default: Release) -buildType NAME specify the build type (default: Release)
-suffix NAME specify a suffix to distinguish the build -suffix NAME specify a suffix to distinguish the build
-DNAME=VALUE add cmake variable
-help -help
The -no-FEATURE option can be used to forcibly disable these features: 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 [0-9]* | paraview-[0-9]* | ParaView-[0-9]*) # paraview version
setParaViewVersion "${1%%/}" setParaViewVersion "${1%%/}"
;; ;;
[A-Z]*=*) # cmake variables -D[A-Z]*=* | [A-Z]*=*) # cmake variables
addCMakeVariable "$1" addCMakeVariable "$1"
;; ;;
-patch) # stage 0: patch sources -patch) # stage 0: patch sources
@ -231,6 +239,13 @@ do
withMPI=true withMPI=true
MPI_MAX_PROCS="${1##*=}" 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) -no-mpi)
withMPI=false withMPI=false
;; ;;
@ -359,6 +374,7 @@ fi
# Set configure options # Set configure options
#~~~~~~~~~~~~~~~~~~~~~~ #~~~~~~~~~~~~~~~~~~~~~~
addGeneral # general settings (version-dependent)
addVerbosity # verbose makefiles addVerbosity # verbose makefiles
addMpiSupport # set MPI-specific options addMpiSupport # set MPI-specific options
addPythonSupport # set Python-specific options addPythonSupport # set Python-specific options

20
makeVTK
View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2016-2020 OpenCFD Ltd. # Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -53,10 +53,15 @@ case "$VTK_VERSION" in
esac esac
VTK_VERSION="${VTK_VERSION%%-*}" # Without suffix (eg, -mesa) VTK_VERSION="${VTK_VERSION%%-*}" # Without suffix (eg, -mesa)
# New rendering backend (starting with vtk 7?). # New rendering backend (starting with vtk 7?).
withGL2=auto # auto-config based on version 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() { usage() {
exec 1>&2 exec 1>&2
@ -76,10 +81,12 @@ options:
-osmesa with off-screen mesa only -osmesa with off-screen mesa only
-mpi with mpi (VTK_Group_MPI=ON) -mpi with mpi (VTK_Group_MPI=ON)
-mpi=N with max 'N' mpi processes. N=0 for no upper-limit. -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 -verbose verbose output in Makefiles
-version VER specify an alternative version (current: $VTK_VERSION) -version VER specify an alternative version (current: $VTK_VERSION)
-buildType NAME specify the build type (default: Release) -buildType NAME specify the build type (default: Release)
-suffix NAME specify a suffix to distinguish the build -suffix NAME specify a suffix to distinguish the build
-DNAME=VALUE add cmake variable
-help -help
The -no-FEATURE option can be used to forcibly disable these features: 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 [0-9]* | vtk-[0-9]* | VTK-[0-9]*) # VTK version
setVtkVersion "${1%%/}" setVtkVersion "${1%%/}"
;; ;;
[A-Z]*=*) # cmake variables -D[A-Z]*=* | [A-Z]*=*) # cmake variables
addCMakeVariable "$1" addCMakeVariable "$1"
;; ;;
-patch) # stage 0: patch sources -patch) # stage 0: patch sources
@ -204,6 +211,13 @@ do
withMPI=true withMPI=true
MPI_MAX_PROCS="${1##*=}" 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) -no-mpi)
withMPI=false withMPI=false
;; ;;