From 6ebb42dc6be1da6dfd7e65f747d3710d530b4581 Mon Sep 17 00:00:00 2001 From: Tadej Novak Date: Sat, 11 Jan 2025 11:20:56 +0100 Subject: [PATCH] [qt] Drop support for Qt5 and update to Qt 6.8.1 --- .github/actions/qt5-build/Dockerfile | 5 -- .github/actions/qt5-build/action.yml | 6 -- .github/actions/qt5-build/entrypoint.sh | 19 ----- .github/workflows/qt-ci.yml | 70 +++++-------------- platform/qt/qt.cmake | 2 +- platform/qt/src/mbgl/http_file_source.cpp | 11 --- platform/qt/src/mbgl/image.cpp | 5 -- .../qt/src/mbgl/local_glyph_rasterizer.cpp | 9 --- platform/qt/src/mbgl/sqlite3.cpp | 8 --- platform/qt/src/mbgl/timer.cpp | 8 --- 10 files changed, 17 insertions(+), 126 deletions(-) delete mode 100644 .github/actions/qt5-build/Dockerfile delete mode 100644 .github/actions/qt5-build/action.yml delete mode 100755 .github/actions/qt5-build/entrypoint.sh diff --git a/.github/actions/qt5-build/Dockerfile b/.github/actions/qt5-build/Dockerfile deleted file mode 100644 index 66b144e83d1..00000000000 --- a/.github/actions/qt5-build/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ghcr.io/maplibre/linux-builder:centos7-gcc11 - -# Copy and set the entry point -COPY entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/qt5-build/action.yml b/.github/actions/qt5-build/action.yml deleted file mode 100644 index c0dcb66689a..00000000000 --- a/.github/actions/qt5-build/action.yml +++ /dev/null @@ -1,6 +0,0 @@ -# action.yml -name: 'Qt5 Linux Builder' -description: 'Helper action to build in a specific Docker container' -runs: - using: 'docker' - image: 'Dockerfile' diff --git a/.github/actions/qt5-build/entrypoint.sh b/.github/actions/qt5-build/entrypoint.sh deleted file mode 100755 index e651013cda7..00000000000 --- a/.github/actions/qt5-build/entrypoint.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -l - -source scl_source enable devtoolset-11 rh-git218 - -set -e -set -x - -export CCACHE_DIR="$GITHUB_WORKSPACE/.ccache" -export PATH="$QT_ROOT_DIR/bin:$PATH" - -mkdir build && cd build -cmake ../source/ \ - -G Ninja \ - -DCMAKE_BUILD_TYPE="Release" \ - -DCMAKE_C_COMPILER_LAUNCHER="ccache" \ - -DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \ - -DMLN_WITH_QT=ON \ - -DMLN_QT_IGNORE_ICU=OFF -ninja diff --git a/.github/workflows/qt-ci.yml b/.github/workflows/qt-ci.yml index 521f0217963..e889c5cd685 100644 --- a/.github/workflows/qt-ci.yml +++ b/.github/workflows/qt-ci.yml @@ -60,64 +60,40 @@ jobs: matrix: include: - name: Linux - os: ubuntu-22.04 - build_type: RelWithDebInfo - qt_version: 5.15.2 - qt_target: desktop - compiler: "" - - name: Linux - os: ubuntu-22.04 + os: ubuntu-24.04 build_type: RelWithDebInfo - qt_version: 6.7.0 + qt_version: 6.8.1 qt_target: desktop compiler: "" - name: Linux_GCC13 os: ubuntu-24.04 build_type: RelWithDebInfo - qt_version: 6.7.0 + qt_version: 6.8.1 qt_target: desktop compiler: "gcc-13" - - name: macOS - os: macos-13 - build_type: RelWithDebInfo - qt_version: 5.15.2 - qt_target: desktop - deployment_target: 10.15 - deployment_arch: "x86_64" - compiler: "" - name: macOS os: macos-14 build_type: RelWithDebInfo - qt_version: 6.7.0 + qt_version: 6.8.1 qt_target: desktop - deployment_target: 11.0 + deployment_target: 12.0 deployment_arch: "x86_64;arm64" compiler: "" - - name: macOS_LLVM18 + - name: macOS_LLVM os: macos-14 build_type: RelWithDebInfo - qt_version: 6.7.0 + qt_version: 6.8.1 qt_target: desktop - deployment_target: 11.0 + deployment_target: 12.0 deployment_arch: "arm64" compiler: "llvm" - - name: win64_msvc2019 - os: windows-2022 - build_type: "RelWithDebInfo" - compiler_type: x64 - compiler_version: 14.29 - qt_version: 5.15.2 - qt_target: desktop - qt_arch: win64_msvc2019_64 - qt_tools: "" - - name: win64_msvc2019 + - name: win64_msvc2022 os: windows-2022 build_type: "RelWithDebInfo" compiler_type: x64 - compiler_version: 14.29 - qt_version: 6.7.0 + qt_version: 6.8.1 qt_target: desktop - qt_arch: win64_msvc2019_64 + qt_arch: win64_msvc2022_64 qt_tools: "" runs-on: ${{ matrix.os }} env: @@ -200,11 +176,10 @@ jobs: xcode-version: latest-stable - name: Setup MSVC - if: matrix.qt_arch == 'win64_msvc2019_64' + if: matrix.qt_arch == 'win64_msvc2022_64' uses: ilammy/msvc-dev-cmd@v1 with: arch: ${{ matrix.compiler_type }} - toolset: ${{ matrix.compiler_version }} - name: Setup ninja uses: seanmiddleditch/gha-setup-ninja@v5 @@ -220,15 +195,6 @@ jobs: tools: ${{ matrix.qt_tools }} extra: --base https://mirrors.ocf.berkeley.edu/qt/ - - name: Update ccache - if: runner.os == 'Windows' - shell: bash - run: | - # version is pinned due to issues with caching MSVC in 4.8 - choco.exe install ccache --version=4.7.5 --no-progress - ccache.exe --version - echo "CCACHE_CONFIGPATH=C:/Users/runneradmin/AppData/Roaming/ccache/ccache.conf" >> "$GITHUB_ENV" - - name: Set up ccache uses: hendrikmuhs/ccache-action@v1 with: @@ -249,16 +215,12 @@ jobs: -DMLN_WITH_QT=ON ninja - - name: Build maplibre-native (Linux, Qt5) - if: runner.os == 'Linux' && matrix.qt_version == '5.15.2' - uses: ./source/.github/actions/qt5-build - - name: Build maplibre-native (Linux, Qt6) - if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler == '' + if: runner.os == 'Linux' && matrix.compiler == '' uses: ./source/.github/actions/qt6-build - name: Build maplibre-native (Linux, Qt6, custom compiler) - if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != '' + if: runner.os == 'Linux' && matrix.compiler != '' run: | mkdir build && cd build qt-cmake ../source/ \ @@ -270,7 +232,7 @@ jobs: ninja - name: Build maplibre-native (Linux, Qt6, custom compiler, internal libraries) - if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != '' + if: runner.os == 'Linux' && matrix.compiler != '' run: | mkdir build-internal && cd build-internal qt-cmake ../source/ \ @@ -284,7 +246,7 @@ jobs: ninja - name: Run tests (Linux) - if: runner.os == 'Linux' && matrix.qt_version != '5.15.2' && matrix.compiler != '' + if: runner.os == 'Linux' && matrix.compiler != '' uses: coactions/setup-xvfb@v1 with: run: ctest --output-on-failure diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake index 04920ca8b38..c6ae2394b98 100644 --- a/platform/qt/qt.cmake +++ b/platform/qt/qt.cmake @@ -32,7 +32,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() if("${QT_VERSION_MAJOR}" STREQUAL "") - find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) + find_package(QT NAMES Qt6 COMPONENTS Core REQUIRED) else() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) endif() diff --git a/platform/qt/src/mbgl/http_file_source.cpp b/platform/qt/src/mbgl/http_file_source.cpp index d8039fac65d..b5885940c15 100644 --- a/platform/qt/src/mbgl/http_file_source.cpp +++ b/platform/qt/src/mbgl/http_file_source.cpp @@ -30,21 +30,10 @@ void HTTPFileSource::Impl::request(HTTPRequest* req) { } QNetworkRequest networkRequest = req->networkRequest(); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) -#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) - networkRequest.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy); -#elif QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) - networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); -#endif -#endif data.first = m_manager->get(networkRequest); connect(data.first, &QNetworkReply::finished, this, &HTTPFileSource::Impl::onReplyFinished); -#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) connect(data.first, &QNetworkReply::errorOccurred, this, &HTTPFileSource::Impl::onReplyFinished); -#else - connect(data.first, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onReplyFinished())); -#endif } void HTTPFileSource::Impl::cancel(HTTPRequest* req) { diff --git a/platform/qt/src/mbgl/image.cpp b/platform/qt/src/mbgl/image.cpp index a4a69a494f8..e666550b3f2 100644 --- a/platform/qt/src/mbgl/image.cpp +++ b/platform/qt/src/mbgl/image.cpp @@ -43,13 +43,8 @@ PremultipliedImage decodeImage(const std::string& string) { throw std::runtime_error("Unsupported image type"); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) auto img = std::make_unique(image.sizeInBytes()); memcpy(img.get(), image.constBits(), image.sizeInBytes()); -#else - auto img = std::make_unique(image.byteCount()); - memcpy(img.get(), image.constBits(), image.byteCount()); -#endif return {{static_cast(image.width()), static_cast(image.height())}, std::move(img)}; } diff --git a/platform/qt/src/mbgl/local_glyph_rasterizer.cpp b/platform/qt/src/mbgl/local_glyph_rasterizer.cpp index 3a3e7c278c0..a123d2238d8 100644 --- a/platform/qt/src/mbgl/local_glyph_rasterizer.cpp +++ b/platform/qt/src/mbgl/local_glyph_rasterizer.cpp @@ -53,11 +53,7 @@ Glyph LocalGlyphRasterizer::rasterizeGlyph(const FontStack&, GlyphID glyphID) { return glyph; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) glyph.metrics.width = impl->metrics->horizontalAdvance(glyphID); -#else - glyph.metrics.width = impl->metrics->width(glyphID); -#endif glyph.metrics.height = impl->metrics->height(); glyph.metrics.left = 3; glyph.metrics.top = -8; @@ -73,13 +69,8 @@ Glyph LocalGlyphRasterizer::rasterizeGlyph(const FontStack&, GlyphID glyphID) { // Render at constant baseline, to align with glyphs that are rendered by node-fontnik. painter.drawText(QPointF(0, 20), QString(QChar(glyphID))); -#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) auto img = std::make_unique(image.sizeInBytes()); memcpy(img.get(), image.constBits(), image.sizeInBytes()); -#else - auto img = std::make_unique(image.byteCount()); - memcpy(img.get(), image.constBits(), image.byteCount()); -#endif glyph.bitmap = AlphaImage{size, std::move(img)}; diff --git a/platform/qt/src/mbgl/sqlite3.cpp b/platform/qt/src/mbgl/sqlite3.cpp index 7300241a3ee..5446e4a5c75 100644 --- a/platform/qt/src/mbgl/sqlite3.cpp +++ b/platform/qt/src/mbgl/sqlite3.cpp @@ -169,11 +169,7 @@ void Database::exec(const std::string& sql) { } void DatabaseImpl::exec(const std::string& sql) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) QStringList statements = QString::fromStdString(sql).split(';', Qt::SkipEmptyParts); -#else - QStringList statements = QString::fromStdString(sql).split(';', QString::SkipEmptyParts); -#endif statements.removeAll("\n"); for (QString statement : statements) { if (!statement.endsWith(';')) { @@ -233,11 +229,7 @@ template <> void Query::bind(int offset, std::nullptr_t) { assert(stmt.impl); // Field numbering starts at 0. -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) stmt.impl->query.bindValue(offset - 1, QVariant(), QSql::In); -#else - stmt.impl->query.bindValue(offset - 1, QVariant(QVariant::Invalid), QSql::In); -#endif checkQueryError(stmt.impl->query); } diff --git a/platform/qt/src/mbgl/timer.cpp b/platform/qt/src/mbgl/timer.cpp index 2980c9de9ec..34a815e2b8a 100644 --- a/platform/qt/src/mbgl/timer.cpp +++ b/platform/qt/src/mbgl/timer.cpp @@ -18,11 +18,7 @@ void Timer::Impl::start(uint64_t timeout, uint64_t repeat_, std::function= QT_VERSION_CHECK(5, 8, 0) timer.start(static_cast(timeout)); -#else - timer.start(static_cast(timeout)); -#endif } void Timer::Impl::stop() { @@ -32,11 +28,7 @@ void Timer::Impl::stop() { void Timer::Impl::timerFired() { if (repeat) { timer.setSingleShot(false); -#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) timer.start(static_cast(repeat)); -#else - timer.start(static_cast(repeat)); -#endif } callback();