Skip to content

Commit 2d96ddb

Browse files
committed
Precompilation and compilation warnings cleaning
* qtchooser for Ubuntu 22.04 / Qt6 Github Action * setting j to 1 in subcmake compilations * make Qt6 failed find_package quiet since fallback on Qt5 * fixed nodiscard warnings for translation load function * removed deprecated call to QLibrary location * fixed OGR warning about createFromWkt * fixed QVariant metatype * fixed loops on weak char* * adjusted github action for debug
1 parent 99c8d15 commit 2d96ddb

61 files changed

Lines changed: 201 additions & 288 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/CI-macos.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
##########################################
1010

1111

12-
ci-macos-release:
12+
ci-macos-debug:
1313
strategy:
1414
matrix:
1515
os: [macos-11,macos-12]
@@ -19,26 +19,29 @@ jobs:
1919
- name: Installation of dependencies
2020
run: |
2121
brew install \
22-
boost gdal curl qt5 \
22+
boost gdal curl qt6 \
2323
doxygen gnuplot doxygen
2424
- name: Checkout of source code
2525
uses: actions/checkout@v3
2626
- name: Preparation
2727
run: |
28-
echo "$(brew --prefix qt5)/bin" >> $GITHUB_PATH
28+
echo "$(brew --prefix qt6)/bin" >> $GITHUB_PATH
2929
mkdir ./_build
3030
- name: Configuration
31-
run: cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt5)/lib/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
31+
run: cmake .. -DCMAKE_PREFIX_PATH=$(brew --prefix qt6)/lib/cmake
3232
working-directory: ./_build
3333
- name: Build
3434
run: make -j 2
3535
working-directory: ./_build
36+
- name: Testing
37+
run: ctest -j 2 --output-on-failure
38+
working-directory: ./_build
3639

3740

3841
##########################################
3942

4043

41-
ci-macos-release-qt6:
44+
ci-macos-release:
4245
strategy:
4346
matrix:
4447
os: [macos-11,macos-12]

.github/workflows/CI-ubuntu.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,33 @@ jobs:
99
##########################################
1010

1111

12-
ci-linux-debug:
13-
runs-on: ubuntu-20.04
12+
ci-linux-debug-qt6:
13+
runs-on: ubuntu-22.04
1414

1515
steps:
1616
- name: Installation of dependencies
1717
run: |
1818
sudo apt update && sudo apt install -y \
1919
libboost-all-dev libgdal-dev libcurl4-gnutls-dev \
20-
qt5-default qtbase5-dev-tools qttools5-dev-tools libqt5svg5-dev \
20+
libgl1-mesa-dev \
21+
qtchooser qt6-base-dev qt6-tools-dev libqt6svg6-dev qt6-l10n-tools qt6-base-dev-tools qt6-tools-dev-tools \
22+
libqt6uitools6 linguist-qt6 \
23+
libqt6core5compat6 libqt6gui6 \
2124
gnuplot p7zip-full graphviz
2225
- name: Checkout of source code
2326
uses: actions/checkout@v3
2427
- name: Preparation
2528
run: mkdir ./_build
29+
- name: QtChooser
30+
run: qtchooser -install qt6 $(which qmake6)
2631
- name: Configuration
2732
run: cmake ..
2833
working-directory: ./_build
2934
- name: Build
3035
run: make -j 2
3136
working-directory: ./_build
37+
env:
38+
QT_SELECT: qt6
3239
- name: Testing
3340
run: ctest -j 2 --output-on-failure
3441
working-directory: ./_build
@@ -94,6 +101,8 @@ jobs:
94101
uses: actions/checkout@v3
95102
- name: Preparation
96103
run: mkdir ./_build
104+
- name: QtChooser
105+
run: qtchooser -install qt6 $(which qmake6)
97106
- name: Configuration
98107
run: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
99108
working-directory: ./_build

CMake.in.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SET(OFBUILD_CUSTOM_CMAKE_VERSION "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.
2323
SET(OPENFLUID_VERSION_MAJOR 2)
2424
SET(OPENFLUID_VERSION_MINOR 2)
2525
SET(OPENFLUID_VERSION_PATCH 0)
26-
SET(OPENFLUID_VERSION_STATUS "alpha98") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
26+
SET(OPENFLUID_VERSION_STATUS "alpha99") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
2727

2828
SET(OPENFLUID_VERSION_FULL "${OPENFLUID_VERSION_MAJOR}.${OPENFLUID_VERSION_MINOR}.${OPENFLUID_VERSION_PATCH}")
2929

@@ -182,8 +182,8 @@ ENDIF()
182182

183183
################### compilation and build ###################
184184

185-
add_compile_options(-Wno-attributes) # TODO REMOVE to fix
186-
add_compile_options(-Wno-missing-field-initializers) # TODO REMOVE to fix
185+
add_compile_options(-Wno-attributes)
186+
add_compile_options(-Wno-missing-field-initializers)
187187

188188
SET(OFBUILD_DEBUG_COMPILE_OPTIONS "")
189189
SET(OFBUILD_RELEASE_COMPILE_OPTIONS "")

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ FIND_PACKAGE(GDAL REQUIRED)
138138
OPENFLUID_CHECK_GDAL_VERSION()
139139
FIND_PACKAGE(CURL REQUIRED HTTP HTTPS)
140140
IF(OFBUILD_ENABLE_GUI)
141-
FIND_PACKAGE(Qt6 COMPONENTS Core Widgets Svg)
141+
FIND_PACKAGE(Qt6 COMPONENTS Core Widgets Svg QUIET)
142142
IF (NOT Qt6_FOUND)
143143
FIND_PACKAGE(Qt5 COMPONENTS Core Widgets Svg REQUIRED)
144144
SET(QT_VERSION_MAJOR ${Qt5Core_VERSION_MAJOR})

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ OpenFLUID relies on several tools and libraries
6262
* [JSON](https://github.com/nlohmann/json) for metadata and settings I/O
6363
* [TinyXML](https://github.com/leethomason/tinyxml2) for datasets I/O
6464
* [libcurl](https://github.com/curl/curl) for network operations
65-
* [Qt5](https://www.qt.io/) for UI framework and applications, Qt6 potentially incoming
65+
* [Qt6](https://www.qt.io/) for UI framework and applications (Qt5 deprecated)
6666
* [CMake](https://cmake.org/) for build/test/packaging configuration and management
6767
* [Doxygen](https://www.doxygen.nl/) for technical documentation
6868

cmake/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ CONFIGURE_FILE(OpenFLUIDConfig.cmake.in "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenF
2424
CONFIGURE_FILE(OpenFLUIDConfigVersion.cmake.in "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenFLUIDConfigVersion.cmake" @ONLY)
2525
CONFIGURE_FILE(OpenFLUIDHelpers.cmake.in "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenFLUIDHelpers.cmake" @ONLY)
2626
CONFIGURE_FILE(OpenFLUIDTestScript.cmake "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenFLUIDTestScript.cmake" @ONLY)
27+
CONFIGURE_FILE(QtNamespaceFacade.cmake "${OFBUILD_DIST_CMAKE_MODULES_DIR}/QtNamespaceFacade.cmake" @ONLY)
2728
CONFIGURE_FILE(OpenFLUIDDetectQt.cmake "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenFLUIDDetectQt.cmake" @ONLY)
2829
CONFIGURE_FILE(FindR.cmake "${OFBUILD_DIST_CMAKE_MODULES_DIR}/FindR.cmake" @ONLY)
2930

@@ -37,6 +38,9 @@ INSTALL(FILES "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenFLUIDConfigVersion.cmake"
3738
INSTALL(FILES "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenFLUIDHelpers.cmake"
3839
DESTINATION ${OPENFLUID_CMAKE_HELPERSSCRIPTS_INSTALL_PATH})
3940

41+
INSTALL(FILES "${OFBUILD_DIST_CMAKE_MODULES_DIR}/QtNamespaceFacade.cmake"
42+
DESTINATION ${OPENFLUID_CMAKE_HELPERSSCRIPTS_INSTALL_PATH})
43+
4044
INSTALL(FILES "${OFBUILD_DIST_CMAKE_MODULES_DIR}/OpenFLUIDDetectQt.cmake"
4145
DESTINATION ${OPENFLUID_CMAKE_HELPERSSCRIPTS_INSTALL_PATH})
4246

cmake/OpenFLUIDDetectQt.cmake

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -44,45 +44,13 @@
4444
# More information on the Qt5 dedicated page : http://doc.qt.io/qt-5/cmake-manual.html
4545
#
4646

47+
INCLUDE(${OpenFLUID_DIR}/QtNamespaceFacade.cmake)
48+
4749
IF (QT_VERSION_MAJOR LESS 6)
4850
FIND_PACKAGE(Qt5 COMPONENTS Core Widgets Network Xml Svg REQUIRED)
4951
MESSAGE(STATUS "Found Qt5 (version ${Qt5_VERSION})")
50-
CMAKE_POLICY(SET CMP0020 OLD)
51-
52-
SET(QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}
53-
${Qt5Network_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Svg_INCLUDE_DIRS})
54-
55-
SET(QT_QTCORE_LIBRARIES Qt5::Core)
56-
SET(QT_QTWIDGETS_LIBRARIES Qt5::Widgets)
57-
SET(QT_QTNETWORK_LIBRARIES Qt5::Network)
58-
SET(QT_QTXML_LIBRARIES Qt5::Xml)
59-
SET(QT_QTSVG_LIBRARIES Qt5::Svg)
60-
61-
SET(QT_QTCORE_LIBRARY Qt5::Core)
62-
SET(QT_QTWIDGETS_LIBRARY Qt5::Widgets)
63-
SET(QT_QTNETWORK_LIBRARY Qt5::Network)
64-
SET(QT_QTXML_LIBRARY Qt5::Xml)
65-
SET(QT_QTSVG_LIBRARY Qt5::Svg)
66-
ELSE() # FIXME adjust for real qt6 setup
67-
52+
ELSE()
6853
FIND_PACKAGE(Qt6 COMPONENTS Core Widgets Network Xml Svg Gui REQUIRED)
6954
MESSAGE(STATUS "Found Qt6 (version ${Qt6_VERSION})")
70-
CMAKE_POLICY(SET CMP0020 OLD)
71-
72-
SET(QT_INCLUDES ${Qt6Core_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS}
73-
${Qt6Network_INCLUDE_DIRS} ${Qt6Xml_INCLUDE_DIRS} ${Qt6Svg_INCLUDE_DIRS})
74-
75-
SET(QT_QTCORE_LIBRARIES Qt6::Core)
76-
SET(QT_QTWIDGETS_LIBRARIES Qt6::Widgets)
77-
SET(QT_QTGUI_LIBRARIES Qt6::Gui)
78-
SET(QT_QTNETWORK_LIBRARIES Qt6::Network)
79-
SET(QT_QTXML_LIBRARIES Qt6::Xml)
80-
SET(QT_QTSVG_LIBRARIES Qt6::Svg)
81-
82-
SET(QT_QTCORE_LIBRARY Qt6::Core)
83-
SET(QT_QTWIDGETS_LIBRARY Qt6::Widgets)
84-
SET(QT_QTGUI_LIBRARY Qt6::Gui)
85-
SET(QT_QTNETWORK_LIBRARY Qt6::Network)
86-
SET(QT_QTXML_LIBRARY Qt6::Xml)
87-
SET(QT_QTSVG_LIBRARY Qt6::Svg)
8855
ENDIF()
56+
CMAKE_POLICY(SET CMP0020 OLD)

cmake/OpenFLUIDHelpers.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ FUNCTION(_OPENFLUID_WAREPLUGIN_BUILD)
221221
IF(_OPNFLD_QT_REQUIRED)
222222
# SET(CMAKE_INCLUDE_CURRENT_DIR ON)
223223

224-
FIND_PACKAGE(Qt6 COMPONENTS Core Widgets Gui)
224+
FIND_PACKAGE(Qt6 COMPONENTS Core Widgets Gui QUIET)
225225
IF (NOT Qt6_FOUND)
226226
FIND_PACKAGE(Qt5 COMPONENTS Core Widgets REQUIRED)
227227
MESSAGE(STATUS "Found Qt5 (version ${Qt5_VERSION})")

cmake/QtNamespaceFacade.cmake

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
##
2+
#
3+
# This file is part of OpenFLUID software
4+
# Copyright(c) 2007, INRA - Montpellier SupAgro
5+
#
6+
#
7+
# == GNU General Public License Usage ==
8+
#
9+
# OpenFLUID is free software: you can redistribute it and/or modify
10+
# it under the terms of the GNU General Public License as published by
11+
# the Free Software Foundation, either version 3 of the License, or
12+
# (at your option) any later version.
13+
#
14+
# OpenFLUID is distributed in the hope that it will be useful,
15+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
# GNU General Public License for more details.
18+
#
19+
# You should have received a copy of the GNU General Public License
20+
# along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21+
#
22+
#
23+
# == Other Usage ==
24+
#
25+
# Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26+
# license, and requires a written agreement between You and INRA.
27+
# Licensees for Other Usage of OpenFLUID may use this file in accordance
28+
# with the terms contained in the written agreement between You and INRA.
29+
#
30+
##
31+
32+
IF (QT_VERSION_MAJOR LESS 6)
33+
SET(QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}
34+
${Qt5Network_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Svg_INCLUDE_DIRS})
35+
36+
SET(QT_QTCORE_LIBRARIES Qt5::Core)
37+
SET(QT_QTWIDGETS_LIBRARIES Qt5::Widgets)
38+
SET(QT_QTNETWORK_LIBRARIES Qt5::Network)
39+
SET(QT_QTXML_LIBRARIES Qt5::Xml)
40+
SET(QT_QTSVG_LIBRARIES Qt5::Svg)
41+
42+
SET(QT_QTCORE_LIBRARY Qt5::Core)
43+
SET(QT_QTWIDGETS_LIBRARY Qt5::Widgets)
44+
SET(QT_QTNETWORK_LIBRARY Qt5::Network)
45+
SET(QT_QTXML_LIBRARY Qt5::Xml)
46+
SET(QT_QTSVG_LIBRARY Qt5::Svg)
47+
ELSE()
48+
SET(QT_INCLUDES ${Qt6Core_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS}
49+
${Qt6Network_INCLUDE_DIRS} ${Qt6Xml_INCLUDE_DIRS} ${Qt6Svg_INCLUDE_DIRS})
50+
51+
SET(QT_QTCORE_LIBRARIES Qt6::Core)
52+
SET(QT_QTWIDGETS_LIBRARIES Qt6::Widgets)
53+
SET(QT_QTGUI_LIBRARIES Qt6::Gui)
54+
SET(QT_QTNETWORK_LIBRARIES Qt6::Network)
55+
SET(QT_QTXML_LIBRARIES Qt6::Xml)
56+
SET(QT_QTSVG_LIBRARIES Qt6::Svg)
57+
58+
SET(QT_QTCORE_LIBRARY Qt6::Core)
59+
SET(QT_QTWIDGETS_LIBRARY Qt6::Widgets)
60+
SET(QT_QTGUI_LIBRARY Qt6::Gui)
61+
SET(QT_QTNETWORK_LIBRARY Qt6::Network)
62+
SET(QT_QTXML_LIBRARY Qt6::Xml)
63+
SET(QT_QTSVG_LIBRARY Qt6::Svg)
64+
ENDIF()

src/apps/openfluid-builder/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
INCLUDE(${OpenFLUID_DIR}/OpenFLUIDDetectQt.cmake)
2-
add_compile_definitions(QT_VERSION_MAJOR=${QT_VERSION_MAJOR})
1+
INCLUDE(${OpenFLUID_DIR}/QtNamespaceFacade.cmake)
32

43
CONFIGURE_FILE(builderconfig.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/builderconfig.hpp" @ONLY)
54
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}")
@@ -42,7 +41,6 @@ SET(BUILDER_BASE_HPP base/AppCoordinator.hpp base/AppActions.hpp base/WaresTrans
4241
)
4342

4443
# Note: tried a wrapper to handle both qt5 and 6 names but issue with arg forwarding
45-
# TODO: at least group sources in a var to minimize redundancy (eg https://doc.qt.io/qt-5/qtwidgets-cmake-qt-wrap-ui.html#examples)
4644
IF (QT_VERSION_MAJOR LESS 6)
4745
QT5_WRAP_UI(BUILDER_BASE_UI base/HomeModuleWidget.ui base/ProjectModuleWidget.ui
4846
base/NewProjectDialog.ui

0 commit comments

Comments
 (0)