Commit 705556c3 authored by mark's avatar mark
Browse files

ENH: support building of paraview with Qt5

- this is the upcoming default Qt version
parent 122ee338
......@@ -424,7 +424,7 @@ The minimum gcc/g++ requirements for building various components.
[page Qt]: https://www.qt.io/download-open-source/
[repo Qt]: http://code.qt.io/cgit/qt-creator/qt-creator.git
[link Qt]: http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
[newer Qt5]: http://download.qt.io/official_releases/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz
[newer Qt5]: http://download.qt.io/official_releases/qt/5.7/5.7.1/single/qt-everywhere-opensource-src-5.7.0.tar.xz
<!-- Standard Footer -->
......
......@@ -3,7 +3,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -29,7 +29,20 @@
#
#------------------------------------------------------------------------------
# sourceBASE, buildBASE, installBASE defined in tools/ThirdPartyFunctions
# Variables referenced by the functions. Initialization at the end of the file.
unset CMAKE_VARIABLES
unset withVERBOSE
unset withMPI MPI_MAX_PROCS
unset withQT QT_VERSION QMAKE_PATH
unset withMESA MESA_INCLUDE MESA_LIBRARY withOSMESA
unset withPYTHON PYTHON_INCLUDE PYTHON_LIBRARY
unset OBJ_ADD
BUILD_TYPE=Release # The cmake build type
# sourceBASE, buildBASE, installBASE
# are defined in tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
#
# Where things are or should be put
......@@ -74,7 +87,7 @@ setParaViewDirs()
echo "ParaView_BINARY_DIR=$ParaView_BINARY_DIR"
echo "ParaView_DIR=$ParaView_DIR"
# Forcefully override the .git path for the ParaView source code directory
# Prevent git queries from using the ThirdParty repository
export GIT_DIR=$ParaView_SOURCE_DIR/.git
}
......@@ -123,6 +136,7 @@ checkVersion()
fi
}
#
# Set CMake cache variables
#
......@@ -143,7 +157,7 @@ addVerbosity()
{
if [ "${withVERBOSE:=false}" = true ]
then
addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE"
addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE"
fi
}
......@@ -160,10 +174,10 @@ addMpiSupport()
OBJ_ADD="$OBJ_ADD-mpi"
addCMakeVariable "PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON"
addCMakeVariable "PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON"
if [ "${MPI_MAX_PROCS:=0}" -gt 1 ]
then
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
fi
}
......@@ -219,9 +233,9 @@ addPythonSupport()
exit 1
}
addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON"
addCMakeVariable "PYTHON_INCLUDE_DIRS=$pythonInclude"
addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY"
addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON"
addCMakeVariable "PYTHON_INCLUDE_DIRS=$pythonInclude"
addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY"
echo "----"
echo "Python information:"
......@@ -254,17 +268,17 @@ addMesaSupport()
then
OBJ_ADD="$OBJ_ADD-mesa"
addCMakeVariable "VTK_OPENGL_HAS_OSMESA:BOOL=ON"
addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE"
addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY"
addCMakeVariable "VTK_OPENGL_HAS_OSMESA:BOOL=ON"
addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE"
addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY"
else
echo "*** Error: no MESA information found"
echo "*** Deactivate MESA support by not using the -mesa option, "
echo "*** or set the correct paths for:"
echo "*** -mesa-include ($MESA_INCLUDE)"
echo "*** -mesa-lib ($MESA_LIBRARY)"
exit 1
echo "*** Error: no MESA information found"
echo "*** Deactivate MESA support by not using the -mesa option, "
echo "*** or set the correct paths for:"
echo "*** -mesa-include ($MESA_INCLUDE)"
echo "*** -mesa-lib ($MESA_LIBRARY)"
exit 1
fi
}
......@@ -276,45 +290,42 @@ addGL2Support()
{
if [ "${withGL2:=false}" = true ]
then
addCMakeVariable "VTK_RENDERING_BACKEND=OpenGL2"
addCMakeVariable "VTK_RENDERING_BACKEND=OpenGL2"
fi
}
#
# Qt 4/5 support
#
addQtSupport()
{
QtVersion=none
QT_VERSION=none
: ${withQT:=true} # default is on
if [ "${withQT:=false}" != true ]
if [ "$withQT" = false ]
then
# Explicitly disabled
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=OFF"
return
fi
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
local qmake qtLib
local qmake=$(findQtMake)
# From somewhere other than in the path
if [ "${qmake:=qmake}" != qmake ]
# Check qmake can be found and handle version differences
qmake=$(findQtMake)
if QT_VERSION=$($qmake -query QT_VERSION 2>/dev/null)
then
addCMakeVariable "QT_QMAKE_EXECUTABLE:FILEPATH=$qmake"
fi
addCMakeVariable "PARAVIEW_BUILD_QT_GUI=ON"
# Check qmake can be found
if type $qmake >/dev/null 2>&1
then
# Check the Qt version selected
# parse -> "Using Qt version X.Y.Z in ..."
QtVersion=$($qmake -query QT_VERSION)
case "$QtVersion" in
3.* | 4.[0-4]*)
case "$QT_VERSION" in
(3.* | 4.[0-4]*)
# QT is too old
cat <<ERROR
----
Error: ${0##*/}
QT version ($QtVersion) provided < 4.5
QT version ($QT_VERSION) provided < 4.5
Please use the -qmake option to specify the location of a newer QT version
For example,
... -qmake /usr/local/qt-4.6.2/bin/qmake
......@@ -324,12 +335,32 @@ ERROR
exit 1
;;
5.*)
# QT4 is the default, must specify QT5 explicitly
addCMakeVariable "PARAVIEW_QT_VERSION:STRING=5"
(4.*)
# Default changed to Qt5 with paraview 5.2.1, so specify explicitly
addCMakeVariable "PARAVIEW_QT_VERSION=4"
# Non-system installation - specify location of qmake
if [ "$qmake" != /usr/bin/qmake ]
then
addCMakeVariable "QT_QMAKE_EXECUTABLE=$qmake"
fi
;;
(5.*)
# Default changed to Qt5 with paraview 5.2.1, so specify explicitly
addCMakeVariable "PARAVIEW_QT_VERSION=5"
# Non-system installation - find CMake config files
if [ "$qmake" != /usr/bin/qmake ] \
&& qtLib="$($qmake -query QT_INSTALL_LIBS)/cmake/Qt5" \
&& [ -d "$qtLib" ]
then
addCMakeVariable "Qt5_DIR=$qtLib"
fi
;;
esac
else
QT_VERSION=none
echo "Error: cannot find qmake either at \$QMAKE_PATH or in current \$PATH"
echo
exit 1
......@@ -362,7 +393,7 @@ configParaView()
fi
mkdir -p $ParaView_BINARY_DIR
addCMakeVariable "CMAKE_BUILD_TYPE:STRING=$buildType"
addCMakeVariable "CMAKE_BUILD_TYPE=$BUILD_TYPE"
cd $ParaView_BINARY_DIR || exit 1 # Change to build folder
......@@ -372,16 +403,15 @@ configParaView()
echo " Python support : ${withPYTHON:-false}"
echo " MESA support : ${withMESA:-false}"
echo " GL2 rendering : ${withGL2:-false}"
echo " Qt dev support : ${withQT:-false}"
echo " QT dev support : ${withQT:-true}"
echo " Source : $ParaView_SOURCE_DIR"
echo " Build : $ParaView_BINARY_DIR"
echo " Target : $ParaView_DIR"
echo " Build type : $buildType"
echo " Cmake : $cmake"
echo " cmake : $cmake"
echo "----"
echo
echo "$cmake" \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
-DCMAKE_INSTALL_PREFIX=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
echo
......@@ -390,7 +420,7 @@ configParaView()
# Run cmake to create Makefiles
$cmake \
-DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \
-DCMAKE_INSTALL_PREFIX=$ParaView_DIR \
$CMAKE_VARIABLES \
$ParaView_SOURCE_DIR
}
......@@ -426,38 +456,44 @@ installParaView()
make install
cat<< INFO
# System or non-system installation of QT?
local qmake qtLib QT_VERSION
if qmake=$(findQtMake 2>/dev/null)
then
qtLib=$($qmake -query QT_INSTALL_LIBS)
QT_VERSION=$($qmake -query QT_VERSION 2>/dev/null)
fi
---
Installation complete for paraview-$ParaView_VERSION
/bin/cat<<INFO
====
Installation complete for paraview-$ParaView_VERSION with qt-${QT_VERSION:-none}
ParaView_DIR=$ParaView_DIR
You may need to update the OpenFOAM environment by running:
wmRefresh
---
You may need to update the OpenFOAM environment by running:
wmRefresh
INFO
# Non-system installation of QT?
if [ "$qmake" != /usr/bin/qmake -a -d "$qtLib" ]
then
cat<< INFO
And adjust your LD_LIBRARY_PATH to include the following:
$qtLib
INFO
fi
echo "===="
}
#------------------------------------------------------------------------------
# Clear the referenced variables before using any of the functions
unset withMPI withVERBOSE
unset withQT QMAKE_PATH
unset withMESA MESA_INCLUDE MESA_LIBRARY
unset withPYTHON PYTHON_INCLUDE PYTHON_LIBRARY
unset CMAKE_VARIABLES
unset OBJ_ADD
unset buildType
# Start with these general settings
addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF"
addCMakeVariable "BUILD_SHARED_LIBS=ON" "BUILD_TESTING=OFF"
# Include development files in "make install"
addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT_FILES:BOOL=ON"
# Don't build test tree
addCMakeVariable "BUILD_TESTING:BOOL=OFF"
addCMakeVariable "PARAVIEW_INSTALL_DEVELOPMENT_FILES=ON"
#------------------------------------------------------------------------------
......@@ -86,18 +86,19 @@ _foamIsSystem()
#
# try to locate cmake according to the CMAKE_PATH
# or just use what is found in the path
# Try to locate cmake according to the CMAKE_PATH.
#
# On success: return the resolved value as output.
# On failure: just report what is found in the path.
#
unset CMAKE_PATH # clear when first loaded
findCMake()
{
local candidate
local foundExe
local candidate foundExe
if [ -n "$CMAKE_PATH" ]
then
# check as directory
# Check as directory
if [ -d "$CMAKE_PATH" ]
then
for candidate in \
......@@ -113,7 +114,7 @@ findCMake()
done
fi
# check as file, include ThirdParty installation in the search
# Check as file, include ThirdParty installation in the search
if [ -z "$foundExe" ]
then
for candidate in \
......@@ -137,9 +138,8 @@ findCMake()
then
foundExe="$(cd ${foundExe%/cmake} 2>/dev/null && pwd)/cmake"
fi
echo "Using cmake=$foundExe" 1>&2
echo "$foundExe"
echo $foundExe
return 0
else
cat << NOT_FOUND 1>&2
......@@ -150,26 +150,27 @@ NOT_FOUND
fi
fi
# Default to use the path, try resolving (so we know what we are using)
foundExe=$(command -v cmake 2> /dev/null) || foundExe=cmake
echo "Using cmake=${foundExe:-NotFound}" 1>&2
echo "${foundExe:-cmake}"
# Default to use the path. Resolve so we know what we are using.
foundExe=$(command -v cmake 2> /dev/null) || foundExe=false
echo "Using cmake=$foundExe" 1>&2
echo $foundExe
}
#
# try to locate qmake according to the QMAKE_PATH
# or just use what is found in the path
#
# On success: return the resolved value as output.
# On failure: just report what is found in the path.
#
unset QMAKE_PATH # clear when first loaded
findQtMake()
{
local candidate
local foundExe
local candidate foundExe
if [ -n "$QMAKE_PATH" ]
then
# check as directory
# Check as directory
if [ -d "$QMAKE_PATH" ]
then
for candidate in \
......@@ -185,7 +186,7 @@ findQtMake()
done
fi
# check as file, include ThirdParty installation in the search
# Check as file, include ThirdParty installation in the search
if [ -z "$foundExe" ]
then
for candidate in \
......@@ -209,9 +210,8 @@ findQtMake()
then
foundExe="$(cd ${foundExe%/qmake} 2>/dev/null && pwd)/qmake"
fi
echo "Using qmake=$foundExe" 1>&2
echo "$foundExe"
echo $foundExe
return 0
else
cat << NOT_FOUND 1>&2
......@@ -223,9 +223,9 @@ NOT_FOUND
fi
# Default to use the path, try resolving (so we know what we are using)
foundExe=$(command -v qmake 2> /dev/null) || foundExe=qmake
echo "Using qmake=${foundExe:-NotFound}" 1>&2
echo "${foundExe:-qmake}"
foundExe=$(command -v qmake 2> /dev/null) || foundExe=false
echo "Using qmake=$foundExe" 1>&2
echo $foundExe
}
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -30,8 +30,13 @@
#
#------------------------------------------------------------------------------
# Variables referenced by the functions. Initialization at the end of the file.
unset CMAKE_VARIABLES
# sourceBASE, buildBASE, installBASE defined in tools/ThirdPartyFunctions
#------------------------------------------------------------------------------
#
# Where things are or should be put
# VTK_VERSION and VTK_MAJOR should already have been set
......@@ -75,8 +80,8 @@ setVtkDirs()
echo "VTK_BINARY_DIR=$VTK_BINARY_DIR"
echo "VTK_DIR=$VTK_DIR"
# Forcefully override the .git path for the VTK source code directory
export GIT_DIR=$ParaView_SOURCE_DIR/.git
# Prevent git queries from using the ThirdParty repository
export GIT_DIR=$VTK_SOURCE_DIR/.git
}
......@@ -129,7 +134,7 @@ configVTK()
fi
mkdir -p $VTK_BINARY_DIR
addCMakeVariable "CMAKE_BUILD_TYPE:STRING=$buildType"
addCMakeVariable "CMAKE_BUILD_TYPE=$BUILD_TYPE"
cd $VTK_BINARY_DIR || exit 1 # change to build folder
......@@ -139,12 +144,11 @@ configVTK()
echo " Source : $VTK_SOURCE_DIR"
echo " Build : $VTK_BINARY_DIR"
echo " Target : $VTK_DIR"
echo " Build type : $buildType"
echo " Cmake : $cmake"
echo " cmake : $cmake"
echo "----"
echo
echo "$cmake" \
-DCMAKE_INSTALL_PREFIX:PATH=$VTK_DIR \
-DCMAKE_INSTALL_PREFIX=$VTK_DIR \
$CMAKE_VARIABLES \
$VTK_SOURCE_DIR
echo
......@@ -153,7 +157,7 @@ configVTK()
# Run cmake to create Makefiles
$cmake \
-DCMAKE_INSTALL_PREFIX:PATH=$VTK_DIR \
-DCMAKE_INSTALL_PREFIX=$VTK_DIR \
$CMAKE_VARIABLES \
$VTK_SOURCE_DIR
}
......@@ -165,17 +169,14 @@ configVTK()
#
makeVTK()
{
cd $VTK_BINARY_DIR || exit 1 # change to build folder
cd $VTK_BINARY_DIR || exit 1 # Change to build folder
echo " Starting make"
time make -j $WM_NCOMPPROCS
echo " Done make"
# Remove lib if it is a link
# (how this was previously handled before 'make install' worked)
if [ -L lib ]
then
rm lib 2>/dev/null
fi
[ -L lib ] && rm -f lib 2>/dev/null
}
......@@ -189,26 +190,20 @@ installVTK()
make install
cat<< INFO
/bin/cat<<INFO
---
Installation complete for vtk-$VTK_VERSION
====
Installation complete for vtk-$VTK_VERSION as
VTK_DIR=$VTK_DIR
---
====
INFO
}
#------------------------------------------------------------------------------
# Clear the referenced variables before using any of the functions
unset CMAKE_VARIABLES
# Start with these general settings
addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF"
# Don't build test tree
addCMakeVariable "BUILD_TESTING:BOOL=OFF"
addCMakeVariable "BUILD_SHARED_LIBS=ON" "BUILD_TESTING=OFF"
#------------------------------------------------------------------------------
......@@ -4,7 +4,7 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
......@@ -56,34 +56,20 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
. etc/tools/ParaViewFunctions
#------------------------------------------------------------------------------
#
# USER OPTIONS:
# ~~~~~~~~~~~~~
# MPI support:
# use 0 or unset MPI_MAX_PROCS for no upper-limit
withMPI=false
MPI_MAX_PROCS=32
# Python support:
# note: script will try to determine the appropriate python library.
# If it fails, specify the path using the PYTHON_LIBRARY variable
withPYTHON=false
PYTHON_LIBRARY=""
# PYTHON_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libpython2.6.so.1.0"
# USER DEFAULTS:
# ~~~~~~~~~~~~~~
# MESA graphics support:
withMESA=false
MESA_INCLUDE="/usr/include/GL"
MESA_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so"
# extra QT gui support (useful for some third party apps)
withQT=true
# Set the path to the Qt-4.5 (or later) qmake if the system Qt is older
QMAKE_PATH=""
# Set the path to cmake
CMAKE_PATH=""
# Python support:
# - The script will try to determine the appropriate python library.
# If that fails, specify the path using the PYTHON_LIBRARY variable below.
withPYTHON=false
PYTHON_LIBRARY=""
# PYTHON_LIBRARY="/usr/lib$WM_COMPILER_LIB_ARCH/libpython2.6.so.1.0"
# New rendering backend (starting with paraview 5.0).
# Default to auto-config based on paraview version
......@@ -159,14 +145,6 @@ USAGE
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
#
# Add options based on script name:
#
case "$Script" in *-mesa*) withMESA=true;; esac
case "$Script" in *-mpi*) withMPI=true;; esac
case "$Script" in *-python*) withPYTHON=true;; esac
case "$Script" in *-qt*) withQT=true;; esac
# Set initial ParaView_MAJOR based on current value of ParaView_VERSION
setParaViewVersion ${ParaView_VERSION:-none}
......@@ -175,7 +153,6 @@ setParaViewVersion ${ParaView_VERSION:-none}
#
unset runPATCH runCONFIG runMAKE runINSTALL
runDEFAULT=true
buildType=Release
# Parse options
while [ "$#" -gt 0 ]
......@@ -311,7 +288,7 @@ do
;;
-buildType)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
buildType="$2"
BUILD_TYPE="$2"
shift
;;
*)
......@@ -380,10 +357,10 @@ Features selected
qt ${withQT:-false}
---------------------
Version information
qt ${QtVersion:-none}
qt ${QT_VERSION:-none}
version ${ParaView_VERSION:-unknown} $(checkVersion)
major ${ParaView_MAJOR:-unknown}
build ${buildType:-Release}
build ${BUILD_TYPE:-unknown}
---------------------
SUMMARY
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2016 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2016-2017 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -50,22 +50,14 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" || {
. etc/tools/vtkFunctions