From 7e0cb82d371b00914ff5d17890b0133d7f3d7597 Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Fri, 28 Jul 2023 14:06:28 -0700 Subject: [PATCH 1/5] prepare for Qt6 --- .github/workflows/build-test.yml | 12 ++++-------- CMakeLists.txt | 3 ++- src/CMakeLists.txt | 8 ++++---- src/mapstorage/XmlMapStorage.cpp | 2 +- src/mpi/remoteeditwidget.cpp | 3 +-- src/roompanel/RoomMobs.h | 2 +- tests/CMakeLists.txt | 18 +++++++++++------- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index af68ab7b9..9df5f9927 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -14,19 +14,15 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2022, macos-11.0, ubuntu-22.04] - compiler: ['clang', 'gcc', 'msvc'] - exclude: + include: - os: ubuntu-22.04 - compiler: 'msvc' - - os: macos-11.0 compiler: 'gcc' + - os: ubuntu-22.04 + compiler: 'clang' - os: macos-11.0 - compiler: 'msvc' - - os: windows-2022 compiler: 'clang' - os: windows-2022 - compiler: 'gcc' + compiler: msvc steps: - uses: actions/checkout@v3 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index dbdb816a4..d92f2b9f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,8 @@ if(WIN32 AND MINGW) option(WITH_DRMINGW "Include Dr. Mingw crash dumping (Windows only)" ON) endif() -find_package(Qt5 COMPONENTS REQUIRED Core Widgets Network OpenGL Test) +find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS REQUIRED Core Widgets Network OpenGL Test) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 86738adff..a90aae0b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -493,10 +493,10 @@ add_executable(mmapper WIN32 MACOSX_BUNDLE ) target_link_libraries(mmapper PUBLIC - Qt5::Core - Qt5::Widgets - Qt5::Network - Qt5::OpenGL + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Widgets + Qt${QT_VERSION_MAJOR}::Network + Qt${QT_VERSION_MAJOR}::OpenGL ) set_target_properties( diff --git a/src/mapstorage/XmlMapStorage.cpp b/src/mapstorage/XmlMapStorage.cpp index e15917eb3..23bbcd27a 100644 --- a/src/mapstorage/XmlMapStorage.cpp +++ b/src/mapstorage/XmlMapStorage.cpp @@ -321,7 +321,7 @@ void XmlMapStorage::loadRoom(QXmlStreamReader &stream) throwErrorFmt(stream, "duplicate room id \"%1\"", idstr.toString()); } room.setId(roomId); - if (attrs.value("uptodate") == "false") { + if (attrs.value("uptodate") == QStringLiteral("false")) { room.setOutDated(); } else { room.setUpToDate(); diff --git a/src/mpi/remoteeditwidget.cpp b/src/mpi/remoteeditwidget.cpp index 9acf560e2..d75d537bb 100644 --- a/src/mpi/remoteeditwidget.cpp +++ b/src/mpi/remoteeditwidget.cpp @@ -25,7 +25,6 @@ #include #include "../configuration/configuration.h" -#include "../global/RAII.h" #include "../global/TextUtils.h" #include "../global/entities.h" #include "../global/utils.h" @@ -247,7 +246,7 @@ class LineHighlighter final : public QSyntaxHighlighter default: if (hasLast && (isClamped(static_cast(c), 0x80, 0xbf) - && (last == 0xc2 || last == 0xc3))) { + && (last.unicode() == 0xc2 || last.unicode() == 0xc3))) { // Sometimes these are UTF-8 encoded Latin1 values, // but they could also be intended, so they're not errors. // TODO: add a feature to fix these on a case-by-case basis? diff --git a/src/roompanel/RoomMobs.h b/src/roompanel/RoomMobs.h index c9fc055f7..f50085535 100644 --- a/src/roompanel/RoomMobs.h +++ b/src/roompanel/RoomMobs.h @@ -8,8 +8,8 @@ #include #include #include -#include #include +#include #include #include "../global/RuleOf5.h" diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 187395aec..1e0ba28d2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,7 +21,7 @@ set(clock_SRCS set(TestClock_SRCS testclock.cpp) add_executable(TestClock ${TestClock_SRCS} ${clock_SRCS}) add_dependencies(TestClock glm) -target_link_libraries(TestClock Qt5::Test coverage_config) +target_link_libraries(TestClock PRIVATE Qt${QT_VERSION_MAJOR}::Test coverage_config) set_target_properties( TestClock PROPERTIES CXX_STANDARD 17 @@ -57,7 +57,7 @@ file(GLOB_RECURSE expandoracommon_SRCS set(TestExpandoraCommon_SRCS testexpandoracommon.cpp) add_executable(TestExpandoraCommon ${TestExpandoraCommon_SRCS} ${expandoracommon_SRCS}) add_dependencies(TestExpandoraCommon glm) -target_link_libraries(TestExpandoraCommon Qt5::Test coverage_config) +target_link_libraries(TestExpandoraCommon PRIVATE Qt${QT_VERSION_MAJOR}::Test coverage_config) set_target_properties( TestExpandoraCommon PROPERTIES CXX_STANDARD 17 @@ -91,7 +91,7 @@ set(parser_SRCS set(TestParser_SRCS testparser.cpp) add_executable(TestParser ${TestParser_SRCS} ${parser_SRCS}) add_dependencies(TestParser glm) -target_link_libraries(TestParser Qt5::Test coverage_config) +target_link_libraries(TestParser PRIVATE Qt${QT_VERSION_MAJOR}::Test coverage_config) set_target_properties( TestParser PROPERTIES CXX_STANDARD 17 @@ -116,7 +116,7 @@ set(proxy_SRCS set(TestProxy_SRCS TestProxy.cpp) add_executable(TestProxy ${TestProxy_SRCS} ${proxy_SRCS}) add_dependencies(TestProxy glm) -target_link_libraries(TestProxy Qt5::Test coverage_config) +target_link_libraries(TestProxy Qt${QT_VERSION_MAJOR}::Test coverage_config) set_target_properties( TestProxy PROPERTIES CXX_STANDARD 17 @@ -136,7 +136,7 @@ set(mainwindow_SRCS set(TestMainWindow_SRCS TestMainWindow.cpp) add_executable(TestMainWindow ${TestMainWindow_SRCS} ${mainwindow_SRCS}) add_dependencies(TestMainWindow glm) -target_link_libraries(TestMainWindow Qt5::Widgets Qt5::Network Qt5::Test coverage_config) +target_link_libraries(TestMainWindow PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Test coverage_config) set_target_properties( TestMainWindow PROPERTIES CXX_STANDARD 17 @@ -162,7 +162,7 @@ set(global_SRCS set(TestGlobal_SRCS TestGlobal.cpp) add_executable(TestGlobal ${TestGlobal_SRCS} ${global_SRCS}) add_dependencies(TestGlobal glm) -target_link_libraries(TestGlobal Qt5::Widgets Qt5::Test coverage_config) +target_link_libraries(TestGlobal PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Test coverage_config) set_target_properties( TestGlobal PROPERTIES CXX_STANDARD 17 @@ -190,15 +190,19 @@ set(adventure_SRCS ../src/global/NamedColors.h ../src/global/utils.cpp ../src/global/utils.h + ../src/global/TextUtils.cpp + ../src/global/TextUtils.h ../src/observer/gameobserver.cpp ../src/observer/gameobserver.h ../src/parser/parserutils.cpp ../src/parser/parserutils.h + ../src/proxy/GmcpMessage.cpp + ../src/proxy/GmcpMessage.h ) set(TestAdventure_SRCS testadventure.cpp testadventure.h) add_executable(TestAdventure ${TestAdventure_SRCS} ${adventure_SRCS}) add_dependencies(TestAdventure glm) -target_link_libraries(TestAdventure Qt5::Widgets Qt5::Network Qt5::Test coverage_config) +target_link_libraries(TestAdventure PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Test coverage_config) set_target_properties( TestAdventure PROPERTIES CXX_STANDARD 17 From d617d4114848cd988960efb3250e276e3aa6d839 Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Fri, 28 Jul 2023 14:13:04 -0700 Subject: [PATCH 2/5] support Qt6 --- .github/workflows/build-test.yml | 39 ++++++++++++++++++++----- CMakeLists.txt | 14 ++++++--- src/CMakeLists.txt | 24 +++++++++++++-- src/adventure/xpstatuswidget.cpp | 4 +++ src/adventure/xpstatuswidget.h | 4 +++ src/client/displaywidget.cpp | 6 ++-- src/client/inputwidget.cpp | 4 ++- src/global/TextUtils.cpp | 30 +++++++++---------- src/global/TextUtils.h | 12 ++++---- src/global/entities.cpp | 8 ++--- src/main.cpp | 6 ++-- src/mapstorage/mapstorage.cpp | 2 +- src/mpi/mpifilter.cpp | 6 ++-- src/mpi/remoteeditwidget.cpp | 14 +++++---- src/pandoragroup/CGroupCommunicator.cpp | 1 - src/parser/abstractparser.cpp | 4 +-- src/parser/mumexmlparser.cpp | 2 +- src/proxy/AbstractTelnet.cpp | 8 +++-- src/proxy/GmcpMessage.cpp | 2 +- tests/CMakeLists.txt | 6 ++++ 20 files changed, 133 insertions(+), 63 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 9df5f9927..f994b5d14 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -17,12 +17,19 @@ jobs: include: - os: ubuntu-22.04 compiler: 'gcc' + qt: qt5 - os: ubuntu-22.04 compiler: 'clang' + qt: qt5 - os: macos-11.0 compiler: 'clang' + qt: qt5 - os: windows-2022 compiler: msvc + qt: qt5 + - os: macos-11.0 + compiler: 'clang' + qt: qt6 steps: - uses: actions/checkout@v3 with: @@ -39,7 +46,15 @@ jobs: name: Install Packages for Ubuntu run: | sudo apt update -qq - sudo apt install -y build-essential git qt5-qmake libqt5opengl5-dev zlib1g-dev libssl-dev libminiupnpc-dev + sudo apt install -y build-essential git zlib1g-dev libssl-dev libminiupnpc-dev + - if: contains( matrix.os, 'ubuntu' ) && matrix.qt == 'qt5' + name: Install Qt5 for Ubuntu + run: | + sudo apt install -y qt5-qmake libqt5opengl5-dev + - if: contains( matrix.os, 'ubuntu' ) && matrix.qt == 'qt6' + name: Install Qt6 for Ubuntu + run: | + sudo apt install -y qmake6 libqt6opengl6-dev libqt6core5compat6-dev - if: contains( matrix.os, 'ubuntu' ) && matrix.compiler == 'gcc' name: Install GCC for Ubuntu run: | @@ -65,11 +80,21 @@ jobs: - if: runner.os == 'macOS' name: Install Packages for Mac run: | - brew install qt5 openssl\@1.1 lcov miniupnpc + brew install lcov miniupnpc + - if: runner.os == 'macOS' && matrix.qt == 'qt5' + name: Install Qt5 for Mac + run: | + brew install qt5 openssl\@1.1 brew link qt5 --force echo "$(brew --prefix qt5)/bin" >> $GITHUB_PATH - echo "MMAPPER_CMAKE_EXTRA=-DUSE_CODE_COVERAGE=true -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1" >> $GITHUB_ENV - echo "COVERAGE=true" >> $GITHUB_ENV + echo "MMAPPER_CMAKE_EXTRA=-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1" >> $GITHUB_ENV + - if: runner.os == 'macOS' && matrix.qt == 'qt6' + name: Install Qt6 for Mac + run: | + brew install qt6 openssl\@3 + brew link qt6 --force + echo "$(brew --prefix qt6)/bin" >> $GITHUB_PATH + echo "MMAPPER_CMAKE_EXTRA=-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3" >> $GITHUB_ENV # @@ -169,17 +194,17 @@ jobs: name: Upload Package for Mac uses: actions/upload-artifact@v3 with: - name: build-test Mac ${{ matrix.os }} ${{ matrix.compiler }} + name: build-test Mac ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.qt }} path: ${{ github.workspace }}/artifact/*.dmg - if: contains( matrix.os, 'ubuntu' ) name: Upload Package for Ubuntu uses: actions/upload-artifact@v3 with: - name: build-test Linux ${{ matrix.os }} ${{ matrix.compiler }} + name: build-test Linux ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.qt }} path: ${{ github.workspace }}/artifact/*.deb - if: runner.os == 'Windows' name: Upload Package for Windows uses: actions/upload-artifact@v3 with: - name: build-test Windows ${{ matrix.os }} ${{ matrix.compiler }} + name: build-test Windows ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.qt }} path: ${{ github.workspace }}/artifact/*.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index d92f2b9f9..d84d07beb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ if(WIN32 AND MINGW) option(WITH_DRMINGW "Include Dr. Mingw crash dumping (Windows only)" ON) endif() -find_package(QT NAMES Qt5 COMPONENTS Core REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS REQUIRED Core Widgets Network OpenGL Test) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -39,9 +39,15 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -if(Qt5Core_FOUND) - if(Qt5Core_VERSION VERSION_LESS 5.15.0) - message(FATAL_ERROR "Minimum supported Qt version is 5.15") +if(Qt5Core_FOUND OR Qt6Core_FOUND) + if(QT_VERSION_MAJOR MATCHES 5) + message(STATUS "Qt5 found") + if (Qt5Core_VERSION VERSION_LESS 5.15.0) + message(FATAL_ERROR "Minimum supported Qt version is 5.15") + endif() + elseif(QT_VERSION_MAJOR MATCHES 6) + message(STATUS "Qt6 found") + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS REQUIRED OpenGLWidgets Core5Compat) endif() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a90aae0b9..e80af9a61 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -499,6 +499,13 @@ target_link_libraries(mmapper PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL ) +if (QT_VERSION_MAJOR MATCHES 6) + target_link_libraries(mmapper PUBLIC + Qt::OpenGLWidgets + Qt::Core5Compat + ) +endif() + set_target_properties( mmapper PROPERTIES CXX_STANDARD 17 @@ -676,12 +683,20 @@ if(UNIX AND NOT APPLE) # Debian set(CPACK_DEBIAN_PACKAGE_MAINTAINER "nschimme@gmail.com") set(CPACK_DEBIAN_PACKAGE_NAME "mmapper") - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5core5a (>= 5.15.0), libqt5gui5 (>= 5.15.0), libqt5opengl5 (>= 5.15.0), libqt5network5 (>= 5.15.0)") + if (QT_VERSION_MAJOR MATCHES 5) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5core5a (>= 5.15.0), libqt5gui5 (>= 5.15.0), libqt5opengl5 (>= 5.15.0), libqt5network5 (>= 5.15.0)") + else() + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6core6, libqt6gui6, libqt6opengl6, libqt6network6, libqt6core5compat6") + endif() if(WITH_ZLIB) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, zlib1g") endif() if(WITH_OPENSSL) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libssl1.1") + if (QT_VERSION_MAJOR MATCHES 5) + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libssl1.1") + else() + set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libssl3") + endif() endif() if(WITH_MINIUPNPC) set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libminiupnpc${MINIUPNPC_API_VERSION}") @@ -701,7 +716,10 @@ if(WIN32) ) # Bundle Library Files - set(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} --dir ${CMAKE_CURRENT_BINARY_DIR}/bin --compiler-runtime --no-angle) + set(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} --dir ${CMAKE_CURRENT_BINARY_DIR}/bin --compiler-runtime) + if (QT_VERSION_MAJOR MATCHES 5) + set(WINDEPLOYQT_ARGS ${WINDEPLOYQT_ARGS} --no-angle) + endif() find_program(WINDEPLOYQT_APP windeployqt HINTS ${QTDIR} ENV QTDIR PATH_SUFFIXES bin) message(" - windeployqt path: ${WINDEPLOYQT_APP}") message(" - windeployqt args: ${WINDEPLOYQT_ARGS}") diff --git a/src/adventure/xpstatuswidget.cpp b/src/adventure/xpstatuswidget.cpp index e05c711bc..3cbd39aa2 100644 --- a/src/adventure/xpstatuswidget.cpp +++ b/src/adventure/xpstatuswidget.cpp @@ -69,7 +69,11 @@ void XPStatusWidget::slot_updatedSession(const std::shared_ptr updateContent(); } +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) void XPStatusWidget::enterEvent(QEvent *event) +#else +void XPStatusWidget::enterEvent(QEnterEvent *event) +#endif { if (m_session) { auto xpHourly = m_session->calculateHourlyRateXP(); diff --git a/src/adventure/xpstatuswidget.h b/src/adventure/xpstatuswidget.h index 9dcbd421e..a99ff2096 100644 --- a/src/adventure/xpstatuswidget.h +++ b/src/adventure/xpstatuswidget.h @@ -22,7 +22,11 @@ public slots: void slot_updatedSession(const std::shared_ptr &session); protected: +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) void enterEvent(QEvent *event) override; +#else + void enterEvent(QEnterEvent *event) override; +#endif void leaveEvent(QEvent *event) override; private: diff --git a/src/client/displaywidget.cpp b/src/client/displaywidget.cpp index 81e9fd2d1..a4448c838 100644 --- a/src/client/displaywidget.cpp +++ b/src/client/displaywidget.cpp @@ -129,10 +129,10 @@ void DisplayWidget::slot_displayText(const QString &str) QRegularExpressionMatchIterator it = ansiRx.globalMatch(str); while (it.hasNext()) { QRegularExpressionMatch match = it.next(); - ansiIndex = match.capturedStart(0); + ansiIndex = static_cast(match.capturedStart(0)); textList << str.mid(textIndex, ansiIndex - textIndex); ansiList << match.captured(1); - textIndex = match.capturedEnd(0); + textIndex = static_cast(match.capturedEnd(0)); } if (textIndex < str.length()) { textList << str.mid(textIndex); @@ -149,7 +149,7 @@ void DisplayWidget::slot_displayText(const QString &str) m_cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, 1); m_backspace = false; } - int backspaceIndex = textStr.indexOf('\10'); + auto backspaceIndex = textStr.indexOf('\10'); if (backspaceIndex == -1) { // No backspace m_cursor.insertText(textStr, m_format); diff --git a/src/client/inputwidget.cpp b/src/client/inputwidget.cpp index 495970c71..a5c92f86f 100644 --- a/src/client/inputwidget.cpp +++ b/src/client/inputwidget.cpp @@ -303,7 +303,9 @@ void InputWidget::tabComplete() // Found a previous word to complete to current.insertText(word); if (current.movePosition(QTextCursor::StartOfWord, QTextCursor::KeepAnchor)) { - current.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, m_tabFragment.size()); + current.movePosition(QTextCursor::Right, + QTextCursor::KeepAnchor, + static_cast(m_tabFragment.size())); setTextCursor(current); } m_tabHistory.forward(); diff --git a/src/global/TextUtils.cpp b/src/global/TextUtils.cpp index 89c6b2190..a649caaf1 100644 --- a/src/global/TextUtils.cpp +++ b/src/global/TextUtils.cpp @@ -123,8 +123,8 @@ void AnsiColorParser::for_each(QStringView ansi) const // ESC[...m -> ... ansi = ansi.mid(2, ansi.length() - 3); - const int len = ansi.length(); - int pos = 0; + const auto len = ansi.length(); + qsizetype pos = 0; const auto try_report = [this, &ansi, &pos](const auto idx) -> void { if (idx <= pos) @@ -181,7 +181,7 @@ int findTrailingWhitespace(const QStringView line) auto m = trailingWhitespaceRegex.match(line); if (!m.hasMatch()) return -1; - return m.capturedStart(); + return static_cast(m.capturedStart()); } int findTrailingWhitespace(const QString &line) @@ -618,7 +618,7 @@ struct NODISCARD Prefix final { auto m = quotePrefixRegex.match(line); if (m.hasMatch()) { - const int len = m.capturedLength(0); + const auto len = m.capturedLength(0); quotePrefix = line.left(len); prefixLen = measureExpandedTabsOneLine(quotePrefix, 0); @@ -639,7 +639,7 @@ struct NODISCARD Prefix final if (m.hasMatch()) { const QStringView sv = m.capturedView(); /* this could fail if someone breaks the regex pattern for the escaped asterisk */ - bulletLength = sv.length(); + bulletLength = static_cast(sv.length()); prefixLen = measureExpandedTabsOneLine(sv, prefixLen); hasPrefix2 = true; append(sv); @@ -771,7 +771,7 @@ TextBuffer normalizeAnsi(const QStringView old) } TextBuffer output; - output.reserve(2 * old.length()); /* no idea */ + output.reserve(2 * static_cast(old.length())); /* no idea */ const auto reset = AnsiString::get_reset_string(); @@ -797,15 +797,15 @@ TextBuffer normalizeAnsi(const QStringView old) output.append(sv); }; - int pos = 0; + auto pos = 0; foreachAnsi(line, [&next, &line, &pos, &print](const auto begin, const QStringView ansiStr) { assert(line.at(begin) == '\x1b'); if (begin > pos) { print(line.mid(pos, begin - pos)); } - pos = begin + ansiStr.length(); - ansiForeachColorCode(ansiStr, [&next](int code) { next.process_code(code); }); + pos = static_cast(begin + ansiStr.length()); + ansiForeachColorCode(ansiStr, [&next](auto code) { next.process_code(code); }); }); if (pos < line.length()) { @@ -839,9 +839,9 @@ AnsiStringToken::AnsiStringToken(AnsiStringToken::TokenTypeEnum _type, , length_{_length} { const auto maxlen = _text.length(); - assert(isClamped(start_offset(), 0, maxlen)); - assert(isClamped(length(), 0, maxlen)); - assert(isClamped(end_offset(), 0, maxlen)); + assert(isClamped(start_offset(), static_cast(0), maxlen)); + assert(isClamped(length(), static_cast(0), maxlen)); + assert(isClamped(end_offset(), static_cast(0), maxlen)); } QStringView AnsiStringToken::getQStringView() const @@ -859,7 +859,7 @@ AnsiTokenizer::Iterator::Iterator(const QString &_str, AnsiTokenizer::Iterator:: : str_{_str} , pos_{_pos} { - assert(isClamped(pos_, 0, str_.size())); + assert(isClamped(pos_, static_cast(0), str_.size())); } AnsiStringToken AnsiTokenizer::Iterator::next() @@ -867,9 +867,9 @@ AnsiStringToken AnsiTokenizer::Iterator::next() assert(hasNext()); const auto len = str_.size(); const auto token = getCurrent(); - assert(isClamped(pos_, 0, len)); + assert(isClamped(pos_, static_cast(0), len)); assert(token.start_offset() == pos_); - assert(isClamped(token.length(), 1, len - pos_)); + assert(isClamped(token.length(), static_cast(1), len - pos_)); pos_ = token.end_offset(); return token; } diff --git a/src/global/TextUtils.h b/src/global/TextUtils.h index ecb271261..a234d0af0 100644 --- a/src/global/TextUtils.h +++ b/src/global/TextUtils.h @@ -77,7 +77,7 @@ void foreachChar(const QStringView input, char c, Callback &&callback) assert(next >= pos); assert(input[next] == c); callback(next); - pos = static_cast(next + 1); + pos = static_cast(next) + 1; } } @@ -102,7 +102,7 @@ void foreachLine(const QStringView input, Callback &&callback) assert(next >= pos); assert(input[next] == '\n'); callback(input.mid(pos, next - pos), true); - pos = static_cast(next + 1); + pos = static_cast(next) + 1; } if (pos < len) callback(input.mid(pos, len - pos), false); @@ -129,13 +129,13 @@ template void foreachAnsi(const QStringView line, Callback &&callback) { const auto len = line.size(); - int pos = 0; + auto pos = 0; while (pos < len) { auto m = weakAnsiRegex.match(line, pos); if (!m.hasMatch()) break; callback(m.capturedStart(), m.capturedView()); - pos = m.capturedEnd(); + pos = static_cast(m.capturedEnd()); } } @@ -389,7 +389,7 @@ class NODISCARD AnsiStringToken final public: NODISCARD QChar at(const size_type pos) const { - assert(isClamped(pos, 0, length_)); + assert(isClamped(pos, static_cast(0), length_)); return text_.at(offset_ + pos); } NODISCARD QChar operator[](const size_type pos) const { return at(pos); } @@ -467,7 +467,7 @@ struct NODISCARD AnsiTokenizer final { const auto len = str_.size(); const auto start = pos_; - assert(isClamped(start, 0, len)); + assert(isClamped(start, static_cast(0), len)); auto it = start + 1; for (; it < len; ++it) if (check(str_[it]) == ResultEnum::STOP) diff --git a/src/global/entities.cpp b/src/global/entities.cpp index 773328fa9..e84e15fee 100644 --- a/src/global/entities.cpp +++ b/src/global/entities.cpp @@ -363,7 +363,7 @@ struct NODISCARD EntityTable final { struct NODISCARD MyHash final { - uint32_t operator()(const QString &qs) const { return qHash(qs); } + uint32_t operator()(const QString &qs) const { return static_cast(qHash(qs)); } }; std::unordered_map by_short_name; @@ -671,7 +671,7 @@ NODISCARD static OptQChar tryParseHex(const QChar *const beg, const QChar *const if (val > MAX_UNICODE_CODEPOINT) return OptQChar{}; } - return OptQChar{val}; + return OptQChar{std::clamp(static_cast(val), 0x0, 0xffff)}; } // TODO: test with strings like "", "&;", "&&", "&&;", "<", "<" "<<", @@ -763,7 +763,7 @@ auto entities::decode(const EncodedLatin1 &input) -> DecodedUnicode public: const EncodedLatin1 &input; DecodedUnicode out; - int pos = 0; + qsizetype pos = 0; public: explicit MyEntityCallback(const EncodedLatin1 &_input) @@ -784,7 +784,7 @@ auto entities::decode(const EncodedLatin1 &input) -> DecodedUnicode } public: - void skipto(int start) + void skipto(qsizetype start) { assert(start >= this->pos); if (start == this->pos) diff --git a/src/main.cpp b/src/main.cpp index d67077263..d614223b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,10 +74,12 @@ class Splash final : public ISplash Splash::~Splash() = default; -static void useHighDpi() +static void tryUseHighDpi() { +#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif } static void setHighDpiScaleFactorRoundingPolicy() @@ -165,7 +167,7 @@ static void setSurfaceFormat() int main(int argc, char **argv) { - useHighDpi(); + tryUseHighDpi(); setHighDpiScaleFactorRoundingPolicy(); setEnteredMain(); if constexpr (IS_DEBUG_BUILD) { diff --git a/src/mapstorage/mapstorage.cpp b/src/mapstorage/mapstorage.cpp index bddcb7e19..cbe19561a 100644 --- a/src/mapstorage/mapstorage.cpp +++ b/src/mapstorage/mapstorage.cpp @@ -674,7 +674,7 @@ bool MapStorage::saveData(bool baseMapOnly) log(QString("Map compressed (compression ratio of %1:1)") .arg(QString::number(compressionRatio, 'f', 1))); - fileStream.writeRawData(compressedData.data(), compressedData.size()); + fileStream.writeRawData(compressedData.data(), static_cast(compressedData.size())); log("Writing data finished."); m_mapData.unsetDataChanged(); diff --git a/src/mpi/mpifilter.cpp b/src/mpi/mpifilter.cpp index ab2ba73b0..dc5d033c9 100644 --- a/src/mpi/mpifilter.cpp +++ b/src/mpi/mpifilter.cpp @@ -90,13 +90,13 @@ void MpiFilter::parseEditMessage(const QByteArray &buffer) qWarning() << "Expected 'M' character in remote editing protocol"; return; } - int sessionEnd = buffer.indexOf('\n', 1); + auto sessionEnd = buffer.indexOf('\n', 1); if (sessionEnd == -1) { qWarning() << "Unable to detect remote editing session end"; return; } const RemoteSession sessionId = RemoteSession(buffer.mid(1, sessionEnd - 1).toStdString()); - int descriptionEnd = buffer.indexOf('\n', sessionEnd + 1); + auto descriptionEnd = buffer.indexOf('\n', sessionEnd + 1); if (descriptionEnd == -1) { qWarning() << "Unable to detect remote editing description end"; return; @@ -114,7 +114,7 @@ void MpiFilter::parseEditMessage(const QByteArray &buffer) void MpiFilter::parseViewMessage(const QByteArray &buffer) { - int descriptionEnd = buffer.indexOf('\n'); + auto descriptionEnd = buffer.indexOf('\n'); if (descriptionEnd == -1) { qWarning() << "Unable to detect remote viewing description end"; return; diff --git a/src/mpi/remoteeditwidget.cpp b/src/mpi/remoteeditwidget.cpp index d75d537bb..7db490c72 100644 --- a/src/mpi/remoteeditwidget.cpp +++ b/src/mpi/remoteeditwidget.cpp @@ -128,7 +128,7 @@ class LineHighlighter final : public QSyntaxHighlighter return fmt; }; - const auto length = line.length() - breakPos; + const int length = static_cast(line.length()) - breakPos; setFormat(breakPos, length, getFmt()); } @@ -139,7 +139,7 @@ class LineHighlighter final : public QSyntaxHighlighter return; } - const auto length = line.length() - breakPos; + const int length = static_cast(line.length()) - breakPos; setFormat(breakPos, length, getBackgroundFormat(Qt::red)); } @@ -378,7 +378,7 @@ static void tryRemoveLeadingSpaces(QTextCursor line, const int max_spaces) return; const int to_remove = [&text, max_spaces]() -> int { - const int len = std::min(max_spaces, text.length()); + const int len = std::min(max_spaces, static_cast(text.length())); int n = 0; while (n < len && text.at(n) == C_SPACE) ++n; @@ -1042,8 +1042,9 @@ void RemoteEditWidget::slot_updateStatusBar() const auto plural = [](auto n) { return (n == 1) ? "" : "s"; }; const QString selection = cur.selection().toPlainText(); - const int selectionLength = selection.length(); - const int selectionLines = selection.count('\n') + (selection.endsWith('\n') ? 0 : 1); + const int selectionLength = static_cast(selection.length()); + const int selectionLines = static_cast(selection.count('\n') + + (selection.endsWith('\n') ? 0 : 1)); status.append(QString(", Selection: %1 char%2 on %3 line%4") .arg(selectionLength) @@ -1091,7 +1092,8 @@ void RemoteEditWidget::slot_justifyText() { const QString &old = m_textEdit->toPlainText(); TextBuffer text; - text.reserve(2 * old.length()); // Just a wild guess in case there's a lot of wrapping. + text.reserve( + 2 * static_cast(old.length())); // Just a wild guess in case there's a lot of wrapping. foreachLine(old, [&text, maxLen = MAX_LENGTH](const QStringView line, bool /*hasNewline*/) { text.appendJustified(line, maxLen); text.append('\n'); diff --git a/src/pandoragroup/CGroupCommunicator.cpp b/src/pandoragroup/CGroupCommunicator.cpp index 68cfee753..95bfd3f46 100644 --- a/src/pandoragroup/CGroupCommunicator.cpp +++ b/src/pandoragroup/CGroupCommunicator.cpp @@ -42,7 +42,6 @@ QByteArray CGroupCommunicator::formMessageBlock(const MessagesEnum message, cons { QByteArray block; QXmlStreamWriter xml(&block); - xml.setCodec("ISO 8859-1"); xml.setAutoFormatting(LOG_MESSAGE_INFO); xml.writeStartDocument(); xml.writeStartElement("datagram"); diff --git a/src/parser/abstractparser.cpp b/src/parser/abstractparser.cpp index c41e3b9db..1f386c08b 100644 --- a/src/parser/abstractparser.cpp +++ b/src/parser/abstractparser.cpp @@ -359,7 +359,7 @@ void AbstractParser::parseExits(std::ostream &os) } } else { // Player exits - const int length = str.length(); + const int length = static_cast(str.length()); for (int i = 7; i < length; i++) { const char c = str.at(i).toLatin1(); if (!parse_exit_flag(c)) { @@ -440,7 +440,7 @@ void AbstractParser::parseExits(std::ostream &os) if (const Room *const room = rs.getRoom(getNextPosition())) { const QByteArray cn = enhanceExits(room); const auto right_trim = [](const QString &str) -> QString { - for (int n = str.size() - 1; n >= 0; --n) { + for (int n = static_cast(str.size()) - 1; n >= 0; --n) { if (!str.at(n).isSpace()) { return str.left(n + 1); } diff --git a/src/parser/mumexmlparser.cpp b/src/parser/mumexmlparser.cpp index 71fcb2350..e2f943d30 100644 --- a/src/parser/mumexmlparser.cpp +++ b/src/parser/mumexmlparser.cpp @@ -193,7 +193,7 @@ void MumeXmlParser::parse(const TelnetData &data, const bool isGoAhead) bool MumeXmlParser::element(const QByteArray &line) { - const int length = line.length(); + const auto length = line.length(); // REVISIT: Merge this logic with the state machine in parse() const auto attributes = [&line]() { diff --git a/src/proxy/AbstractTelnet.cpp b/src/proxy/AbstractTelnet.cpp index 7c26d14ca..43bda88af 100644 --- a/src/proxy/AbstractTelnet.cpp +++ b/src/proxy/AbstractTelnet.cpp @@ -742,11 +742,13 @@ void AbstractTelnet::onReadInternal(const QByteArray &data) AppendBuffer cleanData; cleanData.reserve(data.size()); - int pos = 0; + auto pos = 0; while (pos < data.size()) { if (inflateTelnet) { - int remaining = onReadInternalInflate(data.data() + pos, data.size() - pos, cleanData); - pos = data.length() - remaining; + int remaining = onReadInternalInflate(data.data() + pos, + static_cast(data.size()) - pos, + cleanData); + pos = static_cast(data.length()) - remaining; // Continue because there might be additional chunks left to inflate continue; } diff --git a/src/proxy/GmcpMessage.cpp b/src/proxy/GmcpMessage.cpp index b2c9d0dc2..91beb893b 100644 --- a/src/proxy/GmcpMessage.cpp +++ b/src/proxy/GmcpMessage.cpp @@ -86,7 +86,7 @@ QByteArray GmcpMessage::toRawBytes() const GmcpMessage GmcpMessage::fromRawBytes(const QByteArray &ba) { - const int pos = ba.indexOf(' '); + const auto pos = ba.indexOf(' '); // is optional if (pos == -1) return GmcpMessage(ba.toStdString()); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1e0ba28d2..391f13a96 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -100,6 +100,9 @@ set_target_properties( COMPILE_FLAGS "${WARNING_FLAGS}" UNITY_BUILD ${USE_UNITY_BUILD} ) +if (QT_VERSION_MAJOR MATCHES 6) + target_link_libraries(TestParser PUBLIC Qt::Core5Compat) +endif() add_test(NAME TestParser COMMAND TestParser) # Proxy @@ -163,6 +166,9 @@ set(TestGlobal_SRCS TestGlobal.cpp) add_executable(TestGlobal ${TestGlobal_SRCS} ${global_SRCS}) add_dependencies(TestGlobal glm) target_link_libraries(TestGlobal PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Test coverage_config) +if (QT_VERSION_MAJOR MATCHES 6) + target_link_libraries(TestGlobal PUBLIC Qt::Core5Compat) +endif() set_target_properties( TestGlobal PROPERTIES CXX_STANDARD 17 From 36b62b18d065d360e7c2c547bafd28c90e26ae68 Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Fri, 28 Jul 2023 14:28:58 -0700 Subject: [PATCH 3/5] switch to Ninja build for Windows MSVC --- .github/workflows/build-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f994b5d14..66a4e3616 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -107,7 +107,7 @@ jobs: dir: 'C:\' arch: win64_msvc2019_64 cache: true - tools: 'tools_openssl_x64' + tools: 'tools_ninja tools_openssl_x64' @@ -122,7 +122,7 @@ jobs: mkdir -p build cd build cmake --version - cmake -DCMAKE_BUILD_TYPE=Debug -G "NMake Makefiles" -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/artifact -DUSE_UNITY_BUILD=false -DCMAKE_PREFIX_PATH="C:\Qt\5.12.2\msvc2019_64" -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64 -S .. || exit -1 + cmake -DCMAKE_BUILD_TYPE=Debug -G "Ninja" -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/artifact -DUSE_UNITY_BUILD=false -DCMAKE_PREFIX_PATH="C:\Qt\5.12.2\msvc2019_64" -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64 -S .. || exit -1 cmake --build . -j %NUMBER_OF_PROCESSORS% - if: runner.os == 'Linux' || runner.os == 'macOS' name: Build MMapper for Linux and Mac From b5bcb6c92174d620bca53b26e5fc1f3599f7f93d Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Fri, 28 Jul 2023 15:05:19 -0700 Subject: [PATCH 4/5] try Qt6 MinGW build --- .github/workflows/build-test.yml | 60 +++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 66a4e3616..f9626bcf5 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -16,19 +16,25 @@ jobs: matrix: include: - os: ubuntu-22.04 - compiler: 'gcc' + compiler: gcc qt: qt5 - os: ubuntu-22.04 - compiler: 'clang' + compiler: clang qt: qt5 - os: macos-11.0 - compiler: 'clang' + compiler: clang + qt: qt5 + - os: windows-2022 + compiler: gcc qt: qt5 - os: windows-2022 compiler: msvc qt: qt5 + - os: windows-2022 + compiler: gcc + qt: qt6 - os: macos-11.0 - compiler: 'clang' + compiler: clang qt: qt6 steps: - uses: actions/checkout@v3 @@ -100,7 +106,8 @@ jobs: # # Install Packages (Windows) # - - if: runner.os == 'Windows' + - if: runner.os == 'Windows' && matrix.compiler == 'msvc' + name: Install Qt5 MSVC for Windows uses: jurplel/install-qt-action@v3 with: version: 5.15.2 @@ -108,28 +115,49 @@ jobs: arch: win64_msvc2019_64 cache: true tools: 'tools_ninja tools_openssl_x64' + - if: runner.os == 'Windows' && matrix.compiler == 'msvc' + name: Setup Qt5 MSVC for Windows + run: | + echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\5.12.2\msvc2019_64 -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64" >> $GITHUB_ENV + - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt5' + name: Install Qt5 GCC for Windows + uses: jurplel/install-qt-action@v3 + with: + version: 5.15.2 + dir: 'C:\' + arch: win64_mingw81 + cache: true + tools: 'tools_ninja tools_openssl_x64 tools_mingw90 tools_vcredist,qt.tools.vcredist_msvc2019_x64' + - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt5' + name: Setup Qt5 GCC for Windows + run: | + echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\5.12.2\win64_mingw81 -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64" >> $GITHUB_ENV + - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt6' + name: Install Qt6 GCC for Windows + uses: jurplel/install-qt-action@v3 + with: + version: 6.5.2 + dir: 'C:\' + arch: win64_mingw + cache: true + modules: 'qt5compat' + tools: 'tools_ninja tools_opensslv3_x64 tools_vcredist,qt.tools.vcredist_msvc2019_x64' + - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt6' + name: Setup Qt6 GCC for Windows + run: | + echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\6.5.2\win64_mingw -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64" >> $GITHUB_ENV # # Build # - - if: runner.os == 'Windows' && matrix.compiler == 'msvc' - name: Build MMapper for Windows - shell: cmd + - name: Build MMapper run: | mkdir -p ${{ github.workspace }}/artifact mkdir -p build cd build cmake --version - cmake -DCMAKE_BUILD_TYPE=Debug -G "Ninja" -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/artifact -DUSE_UNITY_BUILD=false -DCMAKE_PREFIX_PATH="C:\Qt\5.12.2\msvc2019_64" -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64 -S .. || exit -1 - cmake --build . -j %NUMBER_OF_PROCESSORS% - - if: runner.os == 'Linux' || runner.os == 'macOS' - name: Build MMapper for Linux and Mac - run: | - mkdir -p build ${{ github.workspace }}/artifact - cd build - cmake --version cmake -DCMAKE_BUILD_TYPE=Debug -G 'Ninja' -DUSE_UNITY_BUILD=false -DCPACK_PACKAGE_DIRECTORY=${{ github.workspace }}/artifact $MMAPPER_CMAKE_EXTRA -S .. || exit -1 cmake --build . From e955972bf05de746b7101f797db9059b8803a34c Mon Sep 17 00:00:00 2001 From: Nils Schimmelmann Date: Fri, 28 Jul 2023 16:11:30 -0700 Subject: [PATCH 5/5] simplify build --- .github/workflows/build-test.yml | 35 ++++++++------------------------ 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index f9626bcf5..427dfe90d 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -30,9 +30,6 @@ jobs: - os: windows-2022 compiler: msvc qt: qt5 - - os: windows-2022 - compiler: gcc - qt: qt6 - os: macos-11.0 compiler: clang qt: qt6 @@ -107,45 +104,29 @@ jobs: # Install Packages (Windows) # - if: runner.os == 'Windows' && matrix.compiler == 'msvc' - name: Install Qt5 MSVC for Windows + name: Install Qt for Windows MSVC uses: jurplel/install-qt-action@v3 with: version: 5.15.2 dir: 'C:\' arch: win64_msvc2019_64 cache: true - tools: 'tools_ninja tools_openssl_x64' - if: runner.os == 'Windows' && matrix.compiler == 'msvc' - name: Setup Qt5 MSVC for Windows + name: Add MSVC to PATH for Windows run: | - echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\5.12.2\msvc2019_64 -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64" >> $GITHUB_ENV - - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt5' - name: Install Qt5 GCC for Windows + echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\5.12.2\msvc2019_64" >> $GITHUB_ENV + - if: runner.os == 'Windows' && matrix.compiler == 'gcc' + name: Install Qt for Windows GCC uses: jurplel/install-qt-action@v3 with: version: 5.15.2 dir: 'C:\' arch: win64_mingw81 cache: true - tools: 'tools_ninja tools_openssl_x64 tools_mingw90 tools_vcredist,qt.tools.vcredist_msvc2019_x64' - - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt5' - name: Setup Qt5 GCC for Windows - run: | - echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\5.12.2\win64_mingw81 -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64" >> $GITHUB_ENV - - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt6' - name: Install Qt6 GCC for Windows - uses: jurplel/install-qt-action@v3 - with: - version: 6.5.2 - dir: 'C:\' - arch: win64_mingw - cache: true - modules: 'qt5compat' - tools: 'tools_ninja tools_opensslv3_x64 tools_vcredist,qt.tools.vcredist_msvc2019_x64' - - if: runner.os == 'Windows' && matrix.compiler == 'gcc' && matrix.qt == 'qt6' - name: Setup Qt6 GCC for Windows + - if: runner.os == 'Windows' && matrix.compiler == 'gcc' + name: Add GCC to PATH for Windows run: | - echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\6.5.2\win64_mingw -DOPENSSL_ROOT_DIR=C:/Qt/Tools/OpenSSL/Win_x64" >> $GITHUB_ENV + echo "MMAPPER_CMAKE_EXTRA=-DCMAKE_PREFIX_PATH=C:\Qt\5.12.2\win64_mingw81" >> $GITHUB_ENV