@@ -66,20 +66,35 @@ endfunction()
6666#
6767# Configure ${APP_TARGET} based on the selected data model configuration.
6868# Available options are:
69- # SCOPE CMake scope keyword that defines the scope of included sources.
70- # The default is PRIVATE scope.
71- # BYPASS_IDL Bypass code generation from .matter IDL file.
72- # ZAP_FILE Path to the ZAP file, used to determine the list of clusters
73- # supported by the application.
74- # IDL .matter IDL file to use for codegen. Inferred from ZAP_FILE
75- # if not provided
76- # EXTERNAL_CLUSTERS Clusters with external implementations. The default implementations
77- # will not be used nor required for these clusters.
78- # Format: MY_CUSTOM_CLUSTER'.
69+ # SCOPE CMake scope keyword that defines the scope of included sources.
70+ # The default is PRIVATE scope.
71+ # BYPASS_IDL Bypass code generation from .matter IDL file.
72+ # ZAP_FILE Path to the ZAP file, used to determine the list of clusters
73+ # supported by the application.
74+ # IDL .matter IDL file to use for codegen. Inferred from ZAP_FILE
75+ # if not provided
76+ # EXTERNAL_CLUSTERS Clusters with external implementations. The default implementations
77+ # will not be used nor required for these clusters.
78+ # Format: MY_CUSTOM_CLUSTER'.
79+ # ZCL_PATH [OPTIONAL] Path to a custom ZCL JSON file.
80+ # This maps to the '--zcl' argument in the "scripts/tools/zap/generate.py" script.
81+ # By default, generate.py attempts to autodetect the ZCL path from the .zap
82+ # file which is often a relative path. When the .zap file is relocated or symlinked,
83+ # these relative paths become invalid, causing the build to fail.
84+ # Passing ZCL_PATH explicitly via CMake ensures the build remains robust and portable.
85+ # If ZCL_PATH is not provided, the default behavior is preserved unless CHIP_ENABLE_ZCL_ARG
86+ # is enabled, in which case the default path "src/app/zap-templates/zcl/zcl.json" is
87+ # automatically injected to simplify usage.
7988#
89+ # Example usage:
90+ # chip_configure_data_model(
91+ # APP_TARGET app
92+ # ZAP_FILE "some_file.zap"
93+ # ZCL_PATH "path/to/custom/zcl.json" # Optional: override default ZCL path
94+ # )
8095function (chip_configure_data_model APP_TARGET )
8196 set (SCOPE PRIVATE)
82- cmake_parse_arguments (ARG "BYPASS_IDL" "SCOPE;ZAP_FILE;GEN_DIR;IDL" "EXTERNAL_CLUSTERS" ${ARGN} )
97+ cmake_parse_arguments (ARG "BYPASS_IDL" "SCOPE;ZAP_FILE;GEN_DIR;IDL;ZCL_PATH " "EXTERNAL_CLUSTERS" ${ARGN} )
8398
8499 if (ARG_SCOPE)
85100 set (SCOPE ${ARG_SCOPE} )
@@ -132,12 +147,14 @@ function(chip_configure_data_model APP_TARGET)
132147 GENERATOR "app-templates"
133148 OUTPUTS
134149 "zap-generated/access.h"
135- "zap-generated/CHIPClientCallbacks.h"
136150 "zap-generated/endpoint_config.h"
137151 "zap-generated/gen_config.h"
138152 "zap-generated/IMClusterCommandHandler.cpp"
153+ "zap-generated/CodeDrivenInitShutdown.cpp"
154+ "zap-generated/CodeDrivenCallback.h"
139155 OUTPUT_PATH APP_TEMPLATES_GEN_DIR
140156 OUTPUT_FILES APP_TEMPLATES_GEN_FILES
157+ ZCL_PATH ${ARG_ZCL_PATH}
141158 )
142159 target_include_directories (${APP_TARGET} ${SCOPE} "${APP_TEMPLATES_GEN_DIR} " )
143160 add_dependencies (${APP_TARGET} ${APP_TARGET} -zapgen )
@@ -147,6 +164,7 @@ function(chip_configure_data_model APP_TARGET)
147164 set (APP_GEN_FILES
148165 ${ARG_GEN_DIR} /callback-stub.cpp
149166 ${ARG_GEN_DIR} /IMClusterCommandHandler.cpp
167+ ${ARG_GEN_DIR} /CodeDrivenInitShutdown.cpp
150168 )
151169 endif ()
152170 endif ()
@@ -177,14 +195,13 @@ function(chip_configure_data_model APP_TARGET)
177195 ${CHIP_APP_BASE_DIR} /reporting/reporting.cpp
178196 ${CHIP_APP_BASE_DIR} /util/attribute-storage.cpp
179197 ${CHIP_APP_BASE_DIR} /util/attribute-table.cpp
180- ${CHIP_APP_BASE_DIR} /util/binding-table.cpp
181198 ${CHIP_APP_BASE_DIR} /util/DataModelHandler.cpp
182199 ${CHIP_APP_BASE_DIR} /util/ember-io-storage.cpp
183200 ${CHIP_APP_BASE_DIR} /util/generic-callback-stubs.cpp
184201 ${CHIP_APP_BASE_DIR} /util/privilege-storage.cpp
185202 ${CHIP_APP_BASE_DIR} /util/util.cpp
186- ${CHIP_APP_BASE_DIR} /util/ persistence/AttributePersistenceProvider .cpp
187- ${CHIP_APP_BASE_DIR} /util/ persistence/DefaultAttributePersistenceProvider.cpp
203+ ${CHIP_APP_BASE_DIR} /persistence/AttributePersistenceProviderInstance .cpp
204+ ${CHIP_APP_BASE_DIR} /persistence/DefaultAttributePersistenceProvider.cpp
188205 ${CODEGEN_DATA_MODEL_SOURCES}
189206 ${APP_GEN_FILES}
190207 ${APP_TEMPLATES_GEN_FILES}
0 commit comments