Merge bitcoin/bitcoin#33865: cmake: Specify Windows plugin path in test_bitcoin-qt property

0dd8d5c237e2fdb0168d9ca644e7f2f5a8b6ed72 cmake: Specify Windows plugin path in `test_bitcoin-qt` property (Hennadii Stepanov)

Pull request description:

  This PR simplifies testing on Windows by removing the need to set the `QT_PLUGIN_PATH` environment variable for different build configurations. For example, the paths might otherwise be:
  - `C:/Users/hebasto/dev/bitcoin/build/vcpkg_installed/x64-windows/Qt6/plugins/` for "Release"
  - `C:/Users/hebasto/dev/bitcoin/build/vcpkg_installed/x64-windows/debug/Qt6/plugins/` for "Debug"

ACKs for top commit:
  purpleKarrot:
    ACK 0dd8d5c237e2fdb0168d9ca644e7f2f5a8b6ed72

Tree-SHA512: 0418b8fa4d74ca500aae9e36e56ebcefb566d2ac04a9d22e17d309400ad38dd5a6e75f0195c680796b761fb145444c33336b64180f15c6b1125fe190d58396b6
This commit is contained in:
Hennadii Stepanov 2025-11-15 16:19:28 +00:00
commit c66e988754
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F
2 changed files with 8 additions and 6 deletions

View File

@ -295,8 +295,6 @@ jobs:
- name: Run test suite
if: matrix.job-type == 'standard'
working-directory: build
env:
QT_PLUGIN_PATH: '${{ github.workspace }}\build\vcpkg_installed\x64-windows\Qt6\plugins'
run: |
ctest --output-on-failure --stop-on-failure -j $NUMBER_OF_PROCESSORS -C Release

View File

@ -40,11 +40,15 @@ add_test(NAME test_bitcoin-qt
COMMAND test_bitcoin-qt
)
if(WIN32 AND VCPKG_TARGET_TRIPLET)
# On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes
# the "minimal" platform plugin unusable due to internal Qt bugs.
set_tests_properties(test_bitcoin-qt PROPERTIES
ENVIRONMENT "QT_QPA_PLATFORM=windows"
set(plugin_path "$<SHELL_PATH:$<PATH:GET_PARENT_PATH,$<PATH:GET_PARENT_PATH,$<TARGET_PROPERTY:Qt6::QWindowsIntegrationPlugin,LOCATION_$<CONFIG>>>>>")
set_property(TEST test_bitcoin-qt APPEND PROPERTY
ENVIRONMENT_MODIFICATION
# On Windows, vcpkg configures Qt with `-opengl dynamic`, which makes
# the "minimal" platform plugin unusable due to internal Qt bugs.
QT_QPA_PLATFORM=set:windows
QT_PLUGIN_PATH=set:${plugin_path}
)
unset(plugin_path)
endif()
install_binary_component(test_bitcoin-qt INTERNAL)