From 805eed9c4abe8d8a8c4fa94142881e699ac75c97 Mon Sep 17 00:00:00 2001 From: Paul Colby Date: Wed, 8 Jan 2025 20:12:17 +1100 Subject: [PATCH] Enable Clang/LLVM builds for Qt 6.7+ on Windows Note, requires skipping the StatusService::serviceDiscovered() test, due to LLVM/Clang bug [#110975]( https://github.com/llvm/llvm-project/issues/110975). Squashed commit of the following: commit 5f78eb41bcd93aa469619f6cefe8e79ccca4e603 Author: Paul Colby Date: Wed Jan 8 17:36:09 2025 +1100 Restore all remaining (Linux and macOS) builds commit 347614749f828174b0e5f3e445197d9f3d764394 Author: Paul Colby Date: Wed Jan 8 17:22:18 2025 +1100 Restore all other Windows builds commit c3ea43b532437f4bdecb559f6b298fd87594a954 Author: Paul Colby Date: Wed Jan 8 17:06:45 2025 +1100 Restore the msvc and mingw builds commit c4492d688b5f0d692eb42f181f0d05c228b363e2 Author: Paul Colby Date: Tue Jan 7 23:22:15 2025 +1100 Don't include compiler runtime for llvm-mingw Not supported by windeployqt. commit b1e47900e541bb264cd889a79652d4d4a47198c7 Author: Paul Colby Date: Tue Jan 7 23:18:28 2025 +1100 Skip test collation for LLVM builds on Windows No sure why, but lcov fails in this scenario, at least on GitHub hosted runners: > error: Failed to load coverage: 'D:/a/_temp/coverage/src/lib/ > CMakeFiles/QtPokit.dir/QtPokit_autogen/mocs_compilation.cpp.obj': > Malformed coverage data > error: Could not load coverage information commit 776df94eee15b5aee603dc7b1fac6913ae6f64fd Author: Paul Colby Date: Tue Jan 7 23:18:17 2025 +1100 Skip StatusService::serviceDiscovered test on llvm-mingw Thanks to LLVM/Clang bug [#110975]( https://github.com/llvm/llvm-project/issues/110975). commit 78812f68242e79a0f6f9be057da703c1a6c3bcb9 Author: Paul Colby Date: Tue Jan 7 23:16:16 2025 +1100 Test StatusService with text output commit 1ae1534ae7a91af1bb66d0a74bb2d2e9f6012105 Author: Paul Colby Date: Tue Jan 7 23:14:53 2025 +1100 Restore the simplied workflow syntax Since the previous commit fixed it. commit fa85c4088a4949ac21c4e9e9038ea793abf5ccd7 Author: Paul Colby Date: Tue Jan 7 23:13:15 2025 +1100 Don't exclude Window LLVM builds for Qt 6.7+ commit 5240903151a118e404f8962eed5afde71934a34a Author: Paul Colby Date: Tue Jan 7 22:51:45 2025 +1100 Add LLVM test debugging That is, merge the TestStatusService tests from the install-qt-action-4.1.0 branch (which is just much, much easier than trying to merge main into that branch now). commit d662b43ed659db30d0820417f5ee0d0ea34630a6 Author: Paul Colby Date: Tue Jan 7 22:35:59 2025 +1100 Set aqtTools the redundant way for now commit ecf4b20301730ad3877ac4c0866fe2e09f6a6c4b Author: Paul Colby Date: Tue Jan 7 22:33:56 2025 +1100 Include the Qt-supplied llvm-mingw tool/s commit 4b98d52db8107d6c86a2329fd77191f2c8875b9b Author: Paul Colby Date: Tue Jan 7 22:24:25 2025 +1100 Set the generator manually for now Not sure why the existing syntax isn't working. commit 2ba9025f281028be492ec73931eb67fb035c5670 Author: Paul Colby Date: Tue Jan 7 22:09:27 2025 +1100 Try the Qt 6.7+ LLVM builds on Windows --- .github/workflows/build.yaml | 22 +++++++++++++--------- src/cli/CMakeLists.txt | 12 +++++++++++- test/unit/lib/teststatusservice.cpp | 7 +++++++ 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8e4d47f0e..2ea283cc1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -404,10 +404,6 @@ jobs: - { toolchain: llvm, qt: '6.4.3' } - { toolchain: llvm, qt: '6.5.3' } - { toolchain: llvm, qt: '6.6.3' } - # \todo Temporarily exclude LLVM builds for Qt 6.7 and 6.8: https://github.com/miurahr/aqtinstall/issues/825 - - { toolchain: llvm, qt: '6.7.3' } - - { toolchain: llvm, qt: '6.8.1' } - - { toolchain: llvm, qt: '6.9.0' } include: # Map the aqtinstall (aqt) architectures. - { qt: '5.9.9', toolchain: mingw, arch: x86, aqtArch: win32_mingw53 } @@ -459,15 +455,15 @@ jobs: - { qt: '6.6.3', toolchain: mingw, arch: x86-64, aqtArch: win64_mingw } - { qt: '6.6.3', toolchain: msvc, arch: arm64, aqtArch: win64_msvc2019_arm64 } - { qt: '6.6.3', toolchain: msvc, arch: x86-64, aqtArch: win64_msvc2019_64 } - # { qt: '6.7.3', toolchain: llvm, arch: x86-64, aqtArch: win64_llvm_mingw } \todo See temp exclusion above. + - { qt: '6.7.3', toolchain: llvm, arch: x86-64, aqtArch: win64_llvm_mingw } - { qt: '6.7.3', toolchain: mingw, arch: x86-64, aqtArch: win64_mingw } - { qt: '6.7.3', toolchain: msvc, arch: arm64, aqtArch: win64_msvc2019_arm64 } - { qt: '6.7.3', toolchain: msvc, arch: x86-64, aqtArch: win64_msvc2019_64 } - # { qt: '6.8.1', toolchain: llvm, arch: x86-64, aqtArch: win64_llvm_mingw } \todo See temp exclusion above. + - { qt: '6.8.1', toolchain: llvm, arch: x86-64, aqtArch: win64_llvm_mingw } - { qt: '6.8.1', toolchain: mingw, arch: x86-64, aqtArch: win64_mingw } - { qt: '6.8.1', toolchain: msvc, arch: arm64, aqtArch: win64_msvc2022_arm64_cross_compiled } - { qt: '6.8.1', toolchain: msvc, arch: x86-64, aqtArch: win64_msvc2022_64 } - # { qt: '6.9.0', toolchain: llvm, arch: x86-64, aqtArch: win64_llvm_mingw } \todo See temp exclusion above. + - { qt: '6.9.0', toolchain: llvm, arch: x86-64, aqtArch: win64_llvm_mingw } - { qt: '6.9.0', toolchain: mingw, arch: x86-64, aqtArch: win64_mingw } - { qt: '6.9.0', toolchain: msvc, arch: arm64, aqtArch: win64_msvc2022_arm64_cross_compiled } - { qt: '6.9.0', toolchain: msvc, arch: x86-64, aqtArch: win64_msvc2022_64 } @@ -476,7 +472,7 @@ jobs: - { toolchain: msvc, arch: x86, msvcArch: amd64_x86 } - { toolchain: msvc, arch: x86-64, msvcArch: amd64 } # Define the generator and dll names per toolchain. - # { toolchain: 'llvm', generator: 'MinGW Makefiles', dll: libQtPokit.dll } \todo See temp exclusion above. + - { toolchain: 'llvm', generator: 'MinGW Makefiles', dll: libQtPokit.dll } - { toolchain: 'mingw', generator: 'MinGW Makefiles', dll: libQtPokit.dll } - { toolchain: 'msvc', generator: 'NMake Makefiles', dll: QtPokit.dll } # Use Qt-provided 64-bit MinGW for recent Qt's (defaulting to GitHub's 12.2.0 version for older Qt versions). @@ -485,8 +481,11 @@ jobs: - { toolchain: 'mingw', arch: x86-64, qt: '6.4.3', aqtTools: 'tools_mingw1310' } - { toolchain: 'mingw', arch: x86-64, qt: '6.5.3', aqtTools: 'tools_mingw1310' } - { toolchain: 'mingw', arch: x86-64, qt: '6.6.3', aqtTools: 'tools_mingw1310' } + - { toolchain: 'llvm', arch: x86-64, qt: '6.7.3', aqtTools: 'tools_llvm_mingw1706' } - { toolchain: 'mingw', arch: x86-64, qt: '6.7.3', aqtTools: 'tools_mingw1310' } + - { toolchain: 'llvm', arch: x86-64, qt: '6.8.1', aqtTools: 'tools_llvm_mingw1706' } - { toolchain: 'mingw', arch: x86-64, qt: '6.8.1', aqtTools: 'tools_mingw1310' } + - { toolchain: 'llvm', arch: x86-64, qt: '6.9.0', aqtTools: 'tools_llvm_mingw1706' } - { toolchain: 'mingw', arch: x86-64, qt: '6.9.0', aqtTools: 'tools_mingw1310' } steps: - name: Configure path @@ -602,6 +601,11 @@ jobs: copy /v /b src\lib\${{ matrix.dll }} /b test\unit\cli copy /v /b src\lib\${{ matrix.dll }} /b test\unit\lib working-directory: ${{ runner.temp }}/release + # \todo Remove this step when https://github.com/llvm/llvm-project/issues/110975 is resolved. + - name: Test StatusService for LLVM debugging + if: matrix.toolchain == 'llvm' + shell: bash + run: /d/a/_temp/coverage/test/unit/lib/testStatusService.exe -o output,txt || :; cat output - name: Test w/ coverage # We can't execute arm64 binaries on an x86-64 host. if: matrix.arch != 'arm64' && matrix.toolchain != 'msvc' run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%/coverage" --verbose @@ -609,7 +613,7 @@ jobs: if: matrix.arch != 'arm64' run: ctest --output-on-failure --test-dir "%RUNNER_TEMP%/release" --verbose - name: Collate test coverage - if: matrix.toolchain != 'msvc' + if: matrix.toolchain != 'msvc' && matrix.toolchain != 'llvm' run: cmake --build "%RUNNER_TEMP%/coverage" --target coverage --verbose - name: Upload test results if: matrix.arch != 'arm64' && ( matrix.toolchain != 'msvc' || fromJSON(steps.post-build.outputs.tap) ) diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt index 72b6e8c1b..9a6611aa6 100644 --- a/src/cli/CMakeLists.txt +++ b/src/cli/CMakeLists.txt @@ -108,16 +108,26 @@ endif() find_program(WINDEPLOYQT NAMES windeployqt windeployqt.exe) if (WINDEPLOYQT) message(STATUS "Found windeployqt: ${WINDEPLOYQT}") + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") + message( + NOTICE + "${CMAKE_CXX_COMPILER_ID} compiler runtime not supported by windeployqt, " + "so compiler runtime will not be included in portable builds.") + set(DOKIT_INCLUDE_COMPILER_RUNTIME false) + else() + set(DOKIT_INCLUDE_COMPILER_RUNTIME true) + endif() file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/portable) add_custom_target( cli-portable COMMAND ${CMAKE_COMMAND} -E copy "$" "${PROJECT_BINARY_DIR}/portable" COMMAND ${CMAKE_COMMAND} -E copy "$" "${PROJECT_BINARY_DIR}/portable" - COMMAND ${WINDEPLOYQT} --compiler-runtime --release --verbose 2 + COMMAND ${WINDEPLOYQT} "$<$:--compiler-runtime>" --release --verbose 2 "$" "$" COMMENT "Bundling portable version" DEPENDS cli QtPokit + COMMAND_EXPAND_LISTS VERBATIM WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/portable) endif() diff --git a/test/unit/lib/teststatusservice.cpp b/test/unit/lib/teststatusservice.cpp index ea47a5280..802320787 100644 --- a/test/unit/lib/teststatusservice.cpp +++ b/test/unit/lib/teststatusservice.cpp @@ -605,6 +605,13 @@ void TestStatusService::serviceDiscovered() // Pokit Meter's Status service UUId will be assigned. service.d_func()->serviceDiscovered(StatusService::ServiceUuids::pokitMeter); + #if defined(Q_OS_WIN) && defined(Q_CC_CLANG) + qInfo() << "service.d_func()->serviceUuid" << service.d_func()->serviceUuid; + qInfo() << "StatusService::ServiceUuids::pokitMeter" << StatusService::ServiceUuids::pokitMeter; + qInfo() << "\\todo Once llvm-mingw is updated such that the above two match, then remove the following QSKIP()"; + qInfo() << "\\todo See https://github.com/llvm/llvm-project/issues/110975"; + QSKIP("LLVM has known 'const static inline variable initialisation' bug on Windows #110975"); + #endif QCOMPARE(service.d_func()->serviceUuid, StatusService::ServiceUuids::pokitMeter); // Pokit Pro's Status service UUId will be assigned.