diff --git a/BUILD.md b/BUILD.md index f650940..539da48 100644 --- a/BUILD.md +++ b/BUILD.md @@ -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 diff --git a/etc/tools/ParaViewFunctions b/etc/tools/ParaViewFunctions index 2d428b4..f4d3bde 100644 --- a/etc/tools/ParaViewFunctions +++ b/etc/tools/ParaViewFunctions @@ -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 </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<&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 } diff --git a/etc/tools/vtkFunctions b/etc/tools/vtkFunctions index 3d2a4cb..d5eefee 100644 --- a/etc/tools/vtkFunctions +++ b/etc/tools/vtkFunctions @@ -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<