16
16
17
17
set (CHIP_APP_BASE_DIR ${CMAKE_CURRENT_LIST_DIR} )
18
18
19
+ if (NOT CHIP_ROOT)
20
+ get_filename_component (CHIP_ROOT ${CHIP_APP_BASE_DIR} /../.. REALPATH)
21
+ endif ()
22
+
19
23
include ("${CHIP_ROOT} /build/chip/chip_codegen.cmake" )
20
24
21
25
# Configure ${APP_TARGET} with source files associated with ${CLUSTER} cluster
@@ -57,20 +61,22 @@ endfunction()
57
61
#
58
62
# Configure ${APP_TARGET} based on the selected data model configuration.
59
63
# Available options are:
60
- # SCOPE CMake scope keyword that defines the scope of included sources.
61
- # The default is PRIVATE scope.
62
- # INCLUDE_SERVER Include source files from src/app/server directory.
63
- # ZAP_FILE Path to the ZAP file, used to determine the list of clusters
64
- # supported by the application.
65
- # IDL .matter IDL file to use for codegen. Inferred from ZAP_FILE
66
- # if not provided
67
- # EXTERNAL_CLUSTERS Clusters with external implementations. The default implementations
68
- # will not be used nor required for these clusters.
69
- # Format: MY_CUSTOM_CLUSTER'.
64
+ # SCOPE Cmake scope keyword that defines the scope of included sources
65
+ # The default is PRIVATE scope.
66
+ # INCLUDE_SERVER Include source files from src/app/server directory
67
+ # BYPASS_IDL Bypass code generation from .matter IDL file.
68
+ # ZAP_FILE Path to the ZAP file, used to determine the list of clusters
69
+ # supported by the application.
70
+ # IDL .matter IDL file to use for codegen. Inferred from ZAP_FILE
71
+ # if not provided
72
+ # EXTERNAL_CLUSTERS Clusters with external implementations. The default implementations
73
+ # will not be used nor required for these clusters.
74
+ # Format: MY_CUSTOM_CLUSTER'.
70
75
#
76
+
71
77
function (chip_configure_data_model APP_TARGET)
72
78
set (SCOPE PRIVATE )
73
- cmake_parse_arguments (ARG "INCLUDE_SERVER" "SCOPE;ZAP_FILE;IDL" "EXTERNAL_CLUSTERS" ${ARGN} )
79
+ cmake_parse_arguments (ARG "INCLUDE_SERVER;BYPASS_IDL " "SCOPE;ZAP_FILE;GEN_DIR ;IDL" "EXTERNAL_CLUSTERS" ${ARGN} )
74
80
75
81
if (ARG_SCOPE)
76
82
set (SCOPE ${ARG_SCOPE} )
@@ -100,7 +106,7 @@ function(chip_configure_data_model APP_TARGET)
100
106
endif ()
101
107
endif ()
102
108
103
- if (ARG_IDL)
109
+ if (ARG_IDL AND NOT ARG_BYPASS_IDL )
104
110
chip_codegen(${APP_TARGET} -codegen
105
111
INPUT "${ARG_IDL} "
106
112
GENERATOR "cpp-app"
@@ -114,24 +120,30 @@ function(chip_configure_data_model APP_TARGET)
114
120
115
121
target_include_directories (${APP_TARGET} ${SCOPE} "${APP_GEN_DIR} " )
116
122
add_dependencies (${APP_TARGET} ${APP_TARGET} -codegen)
123
+
124
+ chip_zapgen(${APP_TARGET} -zapgen
125
+ INPUT "${ARG_ZAP_FILE} "
126
+ GENERATOR "app-templates"
127
+ OUTPUTS
128
+ "zap-generated/access.h"
129
+ "zap-generated/CHIPClientCallbacks.h"
130
+ "zap-generated/endpoint_config.h"
131
+ "zap-generated/gen_config.h"
132
+ "zap-generated/IMClusterCommandHandler.cpp"
133
+ OUTPUT_PATH APP_TEMPLATES_GEN_DIR
134
+ OUTPUT_FILES APP_TEMPLATES_GEN_FILES
135
+ )
136
+ target_include_directories (${APP_TARGET} ${SCOPE} "${APP_TEMPLATES_GEN_DIR} " )
137
+ add_dependencies (${APP_TARGET} ${APP_TARGET} -zapgen)
117
138
else ()
118
- set (APP_GEN_FILES)
139
+ target_compile_definitions (${APP_TARGET} PRIVATE CHIP_BYPASS_IDL)
140
+ target_include_directories (${APP_TARGET} ${SCOPE} ${ARG_GEN_DIR} )
141
+ set (APP_GEN_FILES
142
+ ${ARG_GEN_DIR} /callback-stub.cpp
143
+ ${ARG_GEN_DIR} /IMClusterCommandHandler.cpp
144
+ )
119
145
endif ()
120
146
121
- chip_zapgen(${APP_TARGET} -zapgen
122
- INPUT "${ARG_ZAP_FILE} "
123
- GENERATOR "app-templates"
124
- OUTPUTS
125
- "zap-generated/access.h"
126
- "zap-generated/endpoint_config.h"
127
- "zap-generated/gen_config.h"
128
- "zap-generated/IMClusterCommandHandler.cpp"
129
- OUTPUT_PATH APP_TEMPLATES_GEN_DIR
130
- OUTPUT_FILES APP_TEMPLATES_GEN_FILES
131
- )
132
- target_include_directories (${APP_TARGET} ${SCOPE} "${APP_TEMPLATES_GEN_DIR} " )
133
- add_dependencies (${APP_TARGET} ${APP_TARGET} -zapgen)
134
-
135
147
target_sources (${APP_TARGET} ${SCOPE}
136
148
${CHIP_APP_BASE_DIR} /../../zzz_generated/app-common/app-common/zap-generated /attributes/Accessors.cpp
137
149
${CHIP_APP_BASE_DIR} /../../zzz_generated/app-common/app-common/zap-generated /cluster-objects.cpp
0 commit comments