fix: link Qt CorePrivate for Qt 6.10+ QtXlsx builds - #740
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideQt 6 builds now discover and link the CorePrivate component, enabling the bundled QtXlsx sources to include versioned QtCore private zip headers. File-Level Changes
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="deepin-devicemanager/CMakeLists.txt" line_range="123" />
<code_context>
# Add components only available in Qt6, remove SvgWidgets from Qt5
if(${QT_VERSION_MAJOR} EQUAL 6)
- list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
+ list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets CorePrivate)
else()
# Remove SvgWidgets for Qt5 (not available)
</code_context>
<issue_to_address>
**issue (bug_risk):** CMake treats `CorePrivate` as a standalone Qt component and attempts to resolve a `Qt6CorePrivate` package, but Qt 6 exposes `Qt6::CorePrivate` through the Core package rather than providing a separate component package. Configuration therefore fails before the target can be generated on standard Qt 6 installations.
**Triggers:** When configuring any Qt 6 build with the standard Qt CMake package files.
**Suggested fix:** Keep `CorePrivate` out of `QT_COMPONENTS` and link `Qt6::CorePrivate` after finding the regular `Core` component.
```suggestion
list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| # Add components only available in Qt6, remove SvgWidgets from Qt5 | ||
| if(${QT_VERSION_MAJOR} EQUAL 6) | ||
| list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets) | ||
| list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets CorePrivate) |
There was a problem hiding this comment.
issue (bug_risk): CMake treats CorePrivate as a standalone Qt component and attempts to resolve a Qt6CorePrivate package, but Qt 6 exposes Qt6::CorePrivate through the Core package rather than providing a separate component package. Configuration therefore fails before the target can be generated on standard Qt 6 installations.
Triggers: When configuring any Qt 6 build with the standard Qt CMake package files.
Suggested fix: Keep CorePrivate out of QT_COMPONENTS and link Qt6::CorePrivate after finding the regular Core component.
| list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets CorePrivate) | |
| list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets) |
The bundled QtXlsx sources include QtCore private zip headers, such as private/qzipreader_p.h and private/qzipwriter_p.h. Qt 6.10+ no longer exposes the CorePrivate target through the Core component, so request CorePrivate for those builds and link it to supply the versioned QtCore private include directory.
088fd7f to
81cc02f
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: CMake 语法正确,版本守卫逻辑合理。if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0) 使用了正确的版本比较运算符,list(APPEND QT_COMPONENTS CorePrivate) 语法正确,target_link_libraries 中 Qt${QT_VERSION_MAJOR}::CorePrivate 命名规范。条件嵌套结构清晰,Qt5 不受影响,Qt6 < 6.10.0 不受 find_package 变化影响。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 建议在 if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0) 上方添加简要注释,说明 CorePrivate 组件在 Qt 6.10.0+ 需要显式声明,例如:# CorePrivate required for bundled QtXlsx, explicit component needed since Qt 6.10.0 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: CMake 构建配置变更,不影响运行时性能。版本检查为构建时操作,添加 CorePrivate 链接对构建时间影响可忽略。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: CMake 构建配置中无命令注入风险,无硬编码密钥或敏感信息,无用户输入处理。安全合规。 💡 改进建议代码示例# Add components only available in Qt6, remove SvgWidgets from Qt5
if(${QT_VERSION_MAJOR} EQUAL 6)
list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
# CorePrivate required for bundled QtXlsx, explicit component needed since Qt 6.10.0
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10.0)
list(APPEND QT_COMPONENTS CorePrivate)
endif()
else()
# Remove SvgWidgets for Qt5 (not available)
list(REMOVE_ITEM QT_COMPONENTS SvgWidgets)
endif()本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: felixonmars, lzwind 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 |
The bundled QtXlsx sources include QtCore private zip headers, such as private/qzipreader_p.h and private/qzipwriter_p.h. Qt 6.10+ no longer exposes the CorePrivate target through the Core component, so request CorePrivate for those builds and link it to supply the versioned QtCore private include directory.
Summary by Sourcery
Link Qt CorePrivate for Qt 6.10+ so bundled QtXlsx sources can access versioned private Core headers.
Bug Fixes:
Build: