fix(build): make DConfig optional for 102X-107X compatibility - #216
Conversation
There was a problem hiding this comment.
Sorry @tianming-1996, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideThis PR makes DConfig usage optional by detecting the presence of the DConfig header in DtkCore at CMake configure time and conditionally compiling the DConfig-based logic, with a fallback to hardcoded values when DConfig is unavailable, to allow builds on older 102X–107X environments. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Guard DConfig usage with HAVE_DCONFIG so builds succeed on older dtkcore versions that lack the DConfig header. 用#ifdef HAVE_DCONFIG保护DConfig调用,无DConfig头文件时回退到硬编码, 确保102X~107X全版本可编译。 Log: DConfig改为可选依赖,兼容低版本dtkcore Bug: https://pms.uniontech.com/bug-view-372777.html Influence: 解耦应用在102X~107X全版本可正常编译,低版本回退硬编码UFS版本列表。
8223b49 to
ed3b868
Compare
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 # cmake/DConfigCheck.cmake
# 简要注释:提取公共的 DConfig 探测逻辑,供各子模块复用
if(DtkCore_FOUND)
get_target_property(DTKCORE_INCLUDE_DIRS Dtk::Core INTERFACE_INCLUDE_DIRECTORIES)
find_path(DCONFIG_HEADER_PATH NAMES DConfig PATHS ${DTKCORE_INCLUDE_DIRS})
if(DCONFIG_HEADER_PATH)
add_definitions(-DHAVE_DCONFIG)
endif()
endif()# service/CMakeLists.txt 与 test/CMakeLists.txt 中的替换方式
find_package(DtkCore)
# 引入提取出的公共探测模块,替代原有的内联重复代码
include(${CMAKE_SOURCE_DIR}/cmake/DConfigCheck.cmake)
find_package(DtkGui REQUIRED)
# ... 后续其他逻辑 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: max-lvs, tianming-1996 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 |
|
/merge |
Guard DConfig usage with HAVE_DCONFIG so builds succeed on older
dtkcore versions that lack the DConfig header.
用 #ifdef HAVE_DCONFIG 保护 DConfig 调用,无 DConfig 头文件时回退到硬编码,
确保 102X~107X 全版本可编译。
CMake 用 find_path 直接探测 DConfig 头文件是否存在(而非仅判断 DtkCore_FOUND),
命中才定义 HAVE_DCONFIG,避免 102X 上包找到但头文件缺失导致编译失败。
Bug: https://pms.uniontech.com/bug-view-372777.html
Summary by Sourcery
Make DConfig usage optional to allow building against older DtkCore versions that may not provide the DConfig header.
Enhancements:
Build: