Skip to content

[Cmake] Add option to exclude the integration files at sdk level from cmake.#43193

Open
jadhavrohit924 wants to merge 4 commits intoproject-chip:masterfrom
jadhavrohit924:cmake-sdk-build
Open

[Cmake] Add option to exclude the integration files at sdk level from cmake.#43193
jadhavrohit924 wants to merge 4 commits intoproject-chip:masterfrom
jadhavrohit924:cmake-sdk-build

Conversation

@jadhavrohit924
Copy link
Contributor

Summary

  • Moved SRCS based includes to SRC_DIRS so that apps can be easily build,
  • Add option at clusters sdk level to inlcude/exclude codegen files for the code driven examples.

Related issues

  • All-devices-app for cmake platforms needed manual maintaince of including each source files.

Testing

CI should pass.

Copilot AI review requested due to automatic review settings February 18, 2026 06:58
@jadhavrohit924 jadhavrohit924 requested a review from a team as a code owner February 18, 2026 06:58
@jadhavrohit924 jadhavrohit924 requested review from andy31415 and shubhamdp and removed request for a team and Copilot February 18, 2026 06:58
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a significant improvement to the CMake build system. It adds a new option, CHIP_APP_ENABLE_CLUSTER_CODEGEN_INTEGRATION, to conditionally include codegen integration source files. This allows for more flexible builds, particularly for code-driven examples that do not use the generated code. The all-devices-app for esp32 is refactored to leverage this new option, greatly simplifying its CMakeLists.txt by replacing long, manually maintained source file lists with directory-based source discovery. The changes are extensive but applied consistently and correctly across numerous cluster build files. This is a solid refactoring that enhances maintainability.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new CMake option CHIP_APP_ENABLE_CLUSTER_CODEGEN_INTEGRATION to allow applications to exclude cluster codegen integration files at the SDK level. It also refactors the all-devices-app ESP32 example to use directory-based source inclusion (SRC_DIRS) instead of explicit file lists, simplifying maintenance.

Changes:

  • Added CHIP_APP_ENABLE_CLUSTER_CODEGEN_INTEGRATION option (default ON) to chip_data_model.cmake for controlling codegen integration file inclusion
  • Wrapped CodegenIntegration.cpp and related codegen files in conditional blocks across ~50 cluster app_config_dependent_sources.cmake files
  • Refactored examples/all-devices-app/esp32/main/CMakeLists.txt from explicit SRCS lists to SRC_DIRS for easier maintenance

Reviewed changes

Copilot reviewed 50 out of 50 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/app/chip_data_model.cmake Adds CHIP_APP_ENABLE_CLUSTER_CODEGEN_INTEGRATION option with default value ON
src/app/clusters/*/app_config_dependent_sources.cmake Wraps CodegenIntegration files in conditional blocks across multiple clusters
src/app/clusters/icd-management-server/app_config_dependent_sources.cmake Wraps codegen integration, but incorrectly includes cluster implementation files in conditional
src/app/clusters/boolean-state-configuration-server/app_config_dependent_sources.cmake Wraps CodegenIntegration but missing other codegen-dependent files from conditional
src/app/clusters/on-off-server/app_config_dependent_sources.cmake Provides both codegen and code-driven implementations with if/else structure
src/app/clusters/level-control/app_config_dependent_sources.cmake Provides both codegen and code-driven implementations with if/else structure
examples/all-devices-app/esp32/main/CMakeLists.txt Refactors from explicit file lists to SRC_DIRS, but pulls in extra unintended files

Comment on lines 16 to 24
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ICDManagementCluster.cpp and ICDManagementCluster.h files should not be inside the CHIP_APP_ENABLE_CLUSTER_CODEGEN_INTEGRATION conditional block. These files are always included in the BUILD.gn source_set and are not part of the codegen integration sources. Only CodegenIntegration.cpp should be conditionally included, as indicated by the app_config_dependent_sources.gni file. These cluster implementation files should be moved to a separate TARGET_SOURCES block outside the conditional, similar to how other clusters like groups-server and software-diagnostics-server handle this.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Feb 18, 2026

PR #43193: Size comparison from 1be2abb to 085356b

Full report (27 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32)
platform target config section 1be2abb 085356b change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1108172 1108172 0 0.0
RAM 178674 178674 0 0.0
bl702 lighting-app bl702+eth FLASH 663248 663248 0 0.0
RAM 134689 134689 0 0.0
bl702+wifi FLASH 838954 838954 0 0.0
RAM 124213 124213 0 0.0
bl706+mfd+rpc+littlefs FLASH 1073182 1073182 0 0.0
RAM 117157 117157 0 0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 905796 905796 0 0.0
RAM 105748 105748 0 0.0
lighting-app bl702l+mfd+littlefs FLASH 986248 986248 0 0.0
RAM 109644 109644 0 0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777436 777436 0 0.0
RAM 103280 103280 0 0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786000 786000 0 0.0
RAM 108496 108496 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 731068 731068 0 0.0
RAM 97260 97260 0 0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 715596 715596 0 0.0
RAM 97460 97460 0 0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 556508 556508 0 0.0
RAM 204448 204448 0 0.0
lock CC3235SF_LAUNCHXL FLASH 590704 590704 0 0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 969152 969144 -8 -0.0
RAM 125476 125476 0 0.0
BRD4338a FLASH 757708 757700 -8 -0.0
RAM 237712 237712 0 0.0
window-app BRD4187C FLASH 1066872 1066864 -8 -0.0
RAM 126700 126700 0 0.0
esp32 all-clusters-app c3devkit DRAM 98260 98268 8 0.0
FLASH 1590114 1590122 8 0.0
IRAM 93514 93514 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 955936 956060 124 0.0
RAM 162081 162081 0 0.0
nxp contact mcxw71+release FLASH 746432 746432 0 0.0
RAM 66912 66912 0 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1701804 1701804 0 0.0
RAM 213852 213852 0 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1602924 1602924 0 0.0
RAM 210740 210740 0 0.0
light cy8ckit_062s2_43012 FLASH 1468652 1468652 0 0.0
RAM 196936 196936 0 0.0
lock cy8ckit_062s2_43012 FLASH 1496788 1496788 0 0.0
RAM 224720 224720 0 0.0
qpg lighting-app qpg6200+debug FLASH 840292 840292 0 0.0
RAM 127764 127764 0 0.0
lock-app qpg6200+debug FLASH 778904 778904 0 0.0
RAM 118712 118712 0 0.0
realtek light-switch-app rtl8777g FLASH 704952 704952 0 0.0
RAM 113440 113432 -8 -0.0
lighting-app rtl8777g FLASH 750648 750656 8 0.0
RAM 114640 114640 0 0.0
stm32 light STM32WB5MM-DK FLASH 477256 477256 0 0.0
RAM 141280 141280 0 0.0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than making these includes at cmake-level, how about including cluster dependencies in https://github.com/project-chip/connectedhomeip/blob/master/BUILD.gn#L144 (i.e. default libchip build) and then we can have only codegen specific files in cmake?

This should then avoid having to manually add individual clusters to apps and get LTO cleaning out what is not needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, instead of "default" we probably want https://github.com/project-chip/connectedhomeip/blob/master/src/lib/BUILD.gn#L19

That one gets placed into libchip.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to libchip

@mergify mergify bot added the conflict label Feb 18, 2026
Copilot AI review requested due to automatic review settings February 19, 2026 09:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

PR #43193: Size comparison from 4f9f696 to 1b4d57d

Full report (35 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, efr32, esp32, nrfconnect, nxp, psoc6, qpg, realtek, stm32, telink)
platform target config section 4f9f696 1b4d57d change % change
bl602 lighting-app bl602+mfd+littlefs+rpc FLASH 1108150 1108116 -34 -0.0
RAM 178674 178682 8 0.0
bl702 lighting-app bl702+eth FLASH 663226 663192 -34 -0.0
RAM 134689 134689 0 0.0
bl702+wifi FLASH 838932 838898 -34 -0.0
RAM 124229 124181 -48 -0.0
bl706+mfd+rpc+littlefs FLASH 1073160 1073156 -4 -0.0
RAM 117157 117149 -8 -0.0
bl702l contact-sensor-app bl702l+mfd+littlefs FLASH 905774 905768 -6 -0.0
RAM 105748 105740 -8 -0.0
lighting-app bl702l+mfd+littlefs FLASH 986226 986224 -2 -0.0
RAM 109644 109636 -8 -0.0
cc13x4_26x4 lighting-app LP_EM_CC1354P10_6 FLASH 777652 777640 -12 -0.0
RAM 103288 103280 -8 -0.0
lock-ftd LP_EM_CC1354P10_6 FLASH 786000 785980 -20 -0.0
RAM 108504 108504 0 0.0
pump-app LP_EM_CC1354P10_6 FLASH 731076 731080 4 0.0
RAM 97268 97248 -20 -0.0
pump-controller-app LP_EM_CC1354P10_6 FLASH 715596 715592 -4 -0.0
RAM 97468 97456 -12 -0.0
cc32xx air-purifier CC3235SF_LAUNCHXL FLASH 556508 556478 -30 -0.0
RAM 204456 204464 8 0.0
lock CC3235SF_LAUNCHXL FLASH 590704 590662 -42 -0.0
RAM 204744 204744 0 0.0
efr32 lock-app BRD4187C FLASH 969152 969148 -4 -0.0
RAM 125476 125476 0 0.0
BRD4338a FLASH 757724 757700 -24 -0.0
RAM 237712 237712 0 0.0
window-app BRD4187C FLASH 1066872 1066864 -8 -0.0
RAM 126700 126700 0 0.0
esp32 all-clusters-app c3devkit DRAM 98268 98260 -8 -0.0
FLASH 1590246 1590238 -8 -0.0
IRAM 93514 93514 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 FLASH 956056 956180 124 0.0
RAM 162085 162085 0 0.0
nxp contact mcxw71+release FLASH 746448 746456 8 0.0
RAM 66912 66916 4 0.0
psoc6 all-clusters cy8ckit_062s2_43012 FLASH 1701916 1701860 -56 -0.0
RAM 213860 213868 8 0.0
all-clusters-minimal cy8ckit_062s2_43012 FLASH 1602924 1602916 -8 -0.0
RAM 210748 210756 8 0.0
light cy8ckit_062s2_43012 FLASH 1468764 1468756 -8 -0.0
RAM 196944 196956 12 0.0
lock cy8ckit_062s2_43012 FLASH 1496804 1496772 -32 -0.0
RAM 224720 224732 12 0.0
qpg lighting-app qpg6200+debug FLASH 840308 840296 -12 -0.0
RAM 127772 127772 0 0.0
lock-app qpg6200+debug FLASH 778904 778916 12 0.0
RAM 118720 118720 0 0.0
realtek light-switch-app rtl8777g FLASH 704952 704912 -40 -0.0
RAM 113440 113440 0 0.0
lighting-app rtl8777g FLASH 750848 750864 16 0.0
RAM 114648 114648 0 0.0
stm32 light STM32WB5MM-DK FLASH 477456 477456 0 0.0
RAM 141280 141264 -16 -0.0
telink bridge-app tl7218x FLASH 726494 726482 -12 -0.0
RAM 95712 95712 0 0.0
light-app-ota-compress-lzma-shell-factory-data tl3218x FLASH 851370 851360 -10 -0.0
RAM 44152 44152 0 0.0
tl7218x FLASH 842770 842760 -10 -0.0
RAM 99536 99536 0 0.0
light-switch-app-ota-compress-lzma-factory-data tl7218x_retention FLASH 725070 725058 -12 -0.0
RAM 55732 55732 0 0.0
light-switch-app-ota-compress-lzma-shell-factory-data tlsr9528a FLASH 787696 787684 -12 -0.0
RAM 74916 74916 0 0.0
light-switch-app-ota-factory-data tl3218x_retention FLASH 725070 725058 -12 -0.0
RAM 33216 33216 0 0.0
lighting-app-ota-factory-data tlsr9118bdk40d FLASH 613970 613964 -6 -0.0
RAM 118200 118200 0 0.0
lighting-app-ota-rpc-factory-data-4mb tlsr9518adk80d FLASH 841620 841612 -8 -0.0
RAM 97244 97244 0 0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments