-
Notifications
You must be signed in to change notification settings - Fork 16
fix: resolve missing source file issue for treeland-ddm-v1.c #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1. Replace direct reference to "treeland-ddm-v1.c" in DAEMON_SOURCES
with variable ${TREELAND_DDM_SOURCE} to ensure correct path resolution
2. Restructure protocol file generation using set() and
add_custom_command() for better maintainability and clarity
3. Add DEPENDS and COMMENT fields to improve build system traceability
and debugging
4. Ensure generated source files are correctly referenced during
compilation
fix: 解决 treeland-ddm-v1.c 源文件找不到的问题
1. 将 DAEMON_SOURCES 中对 "treeland-ddm-v1.c" 的硬编码引用替换为变量
${TREELAND_DDM_SOURCE},确保路径正确解析
2. 使用 set() 和 add_custom_command() 重构协议文件生成流程,提高可维护性
和可读性
3. 添加 DEPENDS 和 COMMENT 字段以增强构建系统的可追踪性和调试能力
4. 确保在编译时正确引用生成的源文件
deepin pr auto review这段代码是CMake构建系统的一部分,用于生成Wayland协议相关的文件。我来对这段代码进行分析和评价: 语法逻辑代码语法正确,逻辑清晰。原来的 代码质量
add_custom_target(treeland-ddm ALL
DEPENDS ${TREELAND_DDM_HEADER} ${TREELAND_DDM_SOURCE}
)代码性能
代码安全
总体评价这次重构是一个很好的改进,将简单的 以下是整合了建议的改进版本: # Generate treeland-ddm protocol files
find_program(WAYLAND_SCANNER wayland-scanner)
if(NOT WAYLAND_SCANNER)
message(FATAL_ERROR "wayland-scanner not found")
endif()
set(TREELAND_DDM_HEADER ${CMAKE_CURRENT_BINARY_DIR}/treeland-ddm-v1.h)
set(TREELAND_DDM_SOURCE ${CMAKE_CURRENT_BINARY_DIR}/treeland-ddm-v1.c)
set(TREELAND_DDM_XML ${TREELAND_PROTOCOLS_DATA_DIR}/treeland-ddm-v1.xml)
if(NOT EXISTS ${TREELAND_DDM_XML})
message(FATAL_ERROR "Protocol file ${TREELAND_DDM_XML} not found")
endif()
add_custom_command(
OUTPUT ${TREELAND_DDM_HEADER}
COMMAND ${WAYLAND_SCANNER} client-header < ${TREELAND_DDM_XML} > ${TREELAND_DDM_HEADER}
DEPENDS ${TREELAND_DDM_XML}
COMMENT "Generating treeland-ddm-v1.h"
)
add_custom_command(
OUTPUT ${TREELAND_DDM_SOURCE}
COMMAND ${WAYLAND_SCANNER} private-code < ${TREELAND_DDM_XML} > ${TREELAND_DDM_SOURCE}
DEPENDS ${TREELAND_DDM_XML}
COMMENT "Generating treeland-ddm-v1.c"
)
add_custom_target(treeland-ddm ALL
DEPENDS ${TREELAND_DDM_HEADER} ${TREELAND_DDM_SOURCE}
)这个改进版本增加了工具和输入文件的检查,并添加了一个统一的目标来管理生成的文件,使构建系统更加健壮和可维护。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Group the header and source generation into a single add_custom_command or a dedicated custom target to unify protocol file generation and clarify dependencies.
- Declare the generated files as BYPRODUCTS in your add_custom_command (and consider using MAIN_DEPENDENCY) to ensure correct clean and incremental build behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Group the header and source generation into a single add_custom_command or a dedicated custom target to unify protocol file generation and clarify dependencies.
- Declare the generated files as BYPRODUCTS in your add_custom_command (and consider using MAIN_DEPENDENCY) to ensure correct clean and incremental build behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR replaces hardcoded protocol source references with variables, refactors protocol file generation using set() and add_custom_command(), and enhances the build system with DEPENDS and COMMENT fields for improved maintainability and traceability. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wineee, zccrs 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 |
fix: 解决 treeland-ddm-v1.c 源文件找不到的问题
Summary by Sourcery
Update daemon CMake build to properly generate and include the treeland-ddm-v1 protocol sources
Bug Fixes:
Enhancements:
Build: