Repository navigation
fix: find Qt6 private packages explicitly on Qt >= 6.10 - #226
Conversation
1. Qt 6.10+ no longer implicitly loads Private CMake configs; add
version-gated find_package for Qt6GuiPrivate and
Qt6WaylandClientPrivate in shortcut plugin
2. Required by ${Qt6Gui_PRIVATE_INCLUDE_DIRS},
${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS} and the
Qt6::WaylandClientPrivate link target (tests target inherits
the global imported target)
3. WaylandClient moved into qtbase in Qt 6.12, its Private config
is shipped by qt6-base-dev
Log: fix CMake configure failure on Qt 6.12 ("Target
dde-global-shortcuts-provider links to Qt6::WaylandClientPrivate
but the target was not found"); no runtime behavior change
Influence:
1. Rebuild dde-services against qt6-base 6.12.0.5 in UOS 25
cleanroom, confirm all binary packages are produced
2. Verify global shortcuts provider works (shortcut registration
and triggering) on the Qt 6.12 desktop
3. Run tst-globalshortcutsprovider unit tests
fix: Qt >= 6.10 需显式查找 Qt6 Private 包
1. Qt 6.10 起不再隐式加载 Private CMake 配置,shortcut 插件
增加版本门槛的 Qt6GuiPrivate / Qt6WaylandClientPrivate 查找
2. 覆盖 ${Qt6Gui_PRIVATE_INCLUDE_DIRS}、
${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS} 变量与
Qt6::WaylandClientPrivate 链接目标(tests 目标经全局
imported target 自动可见)
3. Qt 6.12 起 WaylandClient 并入 qtbase,Private 配置由
qt6-base-dev 提供
Log: 修复 Qt 6.12 下 CMake configure 失败("Target
dde-global-shortcuts-provider links to Qt6::WaylandClientPrivate
but the target was not found"),不改变运行时行为
Influence:
1. 在 UOS 25 净室用 qt6-base 6.12.0.5 重新构建 dde-services,
确认全部二进制包产出
2. 在 Qt 6.12 桌面验证全局快捷键注册与触发功能正常
3. 跑 tst-globalshortcutsprovider 单元测试
PMS: TASK-396869
Reviewer's GuideConfigurationExplicitly find Qt private CMake packages on Qt 6.10 and later so their include directories and imported targets are available.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/plugin-qt/shortcut/CMakeLists.txt" line_range="16" />
<code_context>
+# Qt >= 6.10 不再隐式加载 Private 配置, 使用 <Module>_PRIVATE_INCLUDE_DIRS 变量或链接
+# Qt6::<Module>Private target 前需显式查找 (Qt 6.12 起 WaylandClient 并入 qtbase)
+if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0")
+ find_package(Qt6GuiPrivate REQUIRED NO_MODULE)
+endif()
+if (Qt6WaylandClient_VERSION VERSION_GREATER_EQUAL "6.10.0")
</code_context>
<issue_to_address>
**Provider tests miss GUI private headers**
When qt is 6.10 or newer and `BUILD_TESTING` is enabled, unless `Qt6::WaylandClientPrivate` happens to propagate the GUI private include directory transitively, `tst-globalshortcutsprovider` compiles `waylandforeignparent.cpp`, which includes `<qpa/qplatformnativeinterface.h>`, but its include directories do not add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}`. Unlike the provider target, the test target therefore cannot find that private header when tests are built, so the test build fails.
Add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}` to the test target’s include directories or link it to `Qt6::GuiPrivate`.
</issue_to_address>| # Qt >= 6.10 不再隐式加载 Private 配置, 使用 <Module>_PRIVATE_INCLUDE_DIRS 变量或链接 | ||
| # Qt6::<Module>Private target 前需显式查找 (Qt 6.12 起 WaylandClient 并入 qtbase) | ||
| if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0") | ||
| find_package(Qt6GuiPrivate REQUIRED NO_MODULE) |
There was a problem hiding this comment.
🟡 Medium · Provider tests miss GUI private headers
When qt is 6.10 or newer and BUILD_TESTING is enabled, unless Qt6::WaylandClientPrivate happens to propagate the GUI private include directory transitively, tst-globalshortcutsprovider compiles waylandforeignparent.cpp, which includes <qpa/qplatformnativeinterface.h>, but its include directories do not add ${Qt6Gui_PRIVATE_INCLUDE_DIRS}. Unlike the provider target, the test target therefore cannot find that private header when tests are built, so the test build fails.
Add ${Qt6Gui_PRIVATE_INCLUDE_DIRS} to the test target’s include directories or link it to Qt6::GuiPrivate.
Prompt for AI agents
In `src/plugin-qt/shortcut/CMakeLists.txt` at line 16:
**Provider tests miss GUI private headers**
When qt is 6.10 or newer and `BUILD_TESTING` is enabled, unless `Qt6::WaylandClientPrivate` happens to propagate the GUI private include directory transitively, `tst-globalshortcutsprovider` compiles `waylandforeignparent.cpp`, which includes `<qpa/qplatformnativeinterface.h>`, but its include directories do not add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}`. Unlike the provider target, the test target therefore cannot find that private header when tests are built, so the test build fails.
Add `${Qt6Gui_PRIVATE_INCLUDE_DIRS}` to the test target’s include directories or link it to `Qt6::GuiPrivate`.|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Problem
On the Qt 6.12 toolchain the packaging of
dde-servicesfails at cmake configure time (same root cause as deepin-screensaver#139 / fcitx5-qt#13 / kf6-kconfigwidgets#2 / kf6-kdbusaddons#7 / kf6-kirigami#6, and the uos-ai fix of the same family):Two upstream changes stack up:
<Module>PrivateCMake configs. This project only doesfind_package(Qt6 COMPONENTS ... Gui WaylandClient ...), then uses${Qt6Gui_PRIVATE_INCLUDE_DIRS},${Qt6WaylandClient_PRIVATE_INCLUDE_DIRS}and linksQt6::WaylandClientPrivate.Qt6WaylandClientPrivateconfig is now shipped byqt6-base-dev(files exist, just never loaded).Change
src/plugin-qt/shortcut/CMakeLists.txt: version-gated explicit lookup right after the public component find:The tests target (
tst-globalshortcutsprovider) needs no own lookup: the imported target is GLOBAL once the parent directory found it (same mechanism that made it work on Qt <= 6.9). On Qt <= 6.9 (incl. the 6.8 baseline) the gates are not taken and behavior is unchanged.Test
Full binary build of master + this patch in a UOS 25 cleanroom with
qt6-base 6.12.0.5:LC_ALL=C.UTF-8 dpkg-buildpackage -b -us -ucsucceeds,dde-services_1.0.50_amd64.deb(+ dbgsym/buildinfo) produced, previously-failing configure passes (Configuring done (7.7s)).PMS: TASK-396869
Summary by Sourcery
Bug Fixes: