Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qt] Drop support for Qt5 and update to Qt 6.8.1 #3138

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/actions/qt5-build/Dockerfile

This file was deleted.

6 changes: 0 additions & 6 deletions .github/actions/qt5-build/action.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/actions/qt5-build/entrypoint.sh

This file was deleted.

70 changes: 16 additions & 54 deletions .github/workflows/qt-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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/ \
Expand All @@ -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/ \
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion platform/qt/qt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 0 additions & 11 deletions platform/qt/src/mbgl/http_file_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 0 additions & 5 deletions platform/qt/src/mbgl/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t[]>(image.sizeInBytes());
memcpy(img.get(), image.constBits(), image.sizeInBytes());
#else
auto img = std::make_unique<uint8_t[]>(image.byteCount());
memcpy(img.get(), image.constBits(), image.byteCount());
#endif

return {{static_cast<uint32_t>(image.width()), static_cast<uint32_t>(image.height())}, std::move(img)};
}
Expand Down
9 changes: 0 additions & 9 deletions platform/qt/src/mbgl/local_glyph_rasterizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<uint8_t[]>(image.sizeInBytes());
memcpy(img.get(), image.constBits(), image.sizeInBytes());
#else
auto img = std::make_unique<uint8_t[]>(image.byteCount());
memcpy(img.get(), image.constBits(), image.byteCount());
#endif

glyph.bitmap = AlphaImage{size, std::move(img)};

Expand Down
8 changes: 0 additions & 8 deletions platform/qt/src/mbgl/sqlite3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(';')) {
Expand Down Expand Up @@ -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);
}

Expand Down
8 changes: 0 additions & 8 deletions platform/qt/src/mbgl/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ void Timer::Impl::start(uint64_t timeout, uint64_t repeat_, std::function<void()
callback = std::move(cb);

timer.setSingleShot(true);
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
timer.start(static_cast<std::chrono::milliseconds>(timeout));
#else
timer.start(static_cast<int>(timeout));
#endif
}

void Timer::Impl::stop() {
Expand All @@ -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<std::chrono::milliseconds>(repeat));
#else
timer.start(static_cast<int>(repeat));
#endif
}

callback();
Expand Down
Loading