Skip to content

Commit

Permalink
Remove usage of __has_include and usage of USE_ZAP_CONFIG (projec…
Browse files Browse the repository at this point in the history
…t-chip#29492)

* Start removing split defines and setups for InitDataModelHandler

* Restyle

* Add EmptyDataModelHandler to Matter.framework.

---------

Co-authored-by: Andrei Litvin <[email protected]>
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
3 people authored and HunsupJung committed Oct 23, 2023
1 parent f7730c4 commit dd33d0e
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ list(
-DINET_CONFIG_ENABLE_IPV4=0
-DCHIP_PROJECT=1
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
-DCHIP_SHELL_MAX_TOKENS=11
Expand Down
1 change: 0 additions & 1 deletion examples/all-clusters-minimal-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ list(
-DINET_CONFIG_ENABLE_IPV4=0
-DCHIP_PROJECT=1
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
)
Expand Down
1 change: 0 additions & 1 deletion examples/chef/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ list(
-DINET_CONFIG_ENABLE_IPV4=0
-DCHIP_PROJECT=1
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${CONFIG_DEVICE_PRODUCT_ID}
Expand Down
1 change: 0 additions & 1 deletion examples/light-switch-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ list(
-DINET_CONFIG_ENABLE_IPV4=0
-DCHIP_PROJECT=1
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
)
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ list(
-DINET_CONFIG_ENABLE_IPV4=0
-DCHIP_PROJECT=1
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
)
Expand Down
1 change: 0 additions & 1 deletion examples/ota-requestor-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ list(
-DINET_CONFIG_ENABLE_IPV4=0
-DCHIP_PROJECT=1
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
)
Expand Down
1 change: 0 additions & 1 deletion examples/pigweed-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ list(
-DINET_CONFIG_ENABLE_IPV4=0
-DCHIP_PROJECT=1
-DCHIP_DEVICE_LAYER_TARGET=Ameba
-DUSE_ZAP_CONFIG
-DCHIP_HAVE_CONFIG_H
-DMBEDTLS_CONFIG_FILE=<mbedtls_config.h>
-DCONFIG_ENABLE_PW_RPC=1
Expand Down
5 changes: 0 additions & 5 deletions src/app/util/DataModelHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@

#include <app/util/DataModelHandler.h>

#if __has_include(<zap-generated/endpoint_config.h>)
#define USE_ZAP_CONFIG 1
#include <app/util/attribute-storage.h>
#include <app/util/util.h>
#endif
#include <lib/support/logging/CHIPLogging.h>

using namespace ::chip;

void InitDataModelHandler()
{
#ifdef USE_ZAP_CONFIG
ChipLogProgress(Zcl, "Using ZAP configuration...");
emberAfEndpointConfigure();
emberAfInit();
#endif
}
7 changes: 6 additions & 1 deletion src/controller/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ import("${chip_root}/src/lib/lib.gni")
import("${chip_root}/src/platform/device.gni")
import("${chip_root}/src/platform/python.gni")

source_set("nodatamodel") {
sources = [ "EmptyDataModelHandler.cpp" ]

public_deps = [ "${chip_root}/src/app" ]
}

static_library("controller") {
output_name = "libChipController"

Expand All @@ -39,7 +45,6 @@ static_library("controller") {
"CommissioningDelegate.cpp",
"DeviceDiscoveryDelegate.h",
"DevicePairingDelegate.h",
"EmptyDataModelHandler.cpp",
"ExampleOperationalCredentialsIssuer.cpp",
"ExampleOperationalCredentialsIssuer.h",
"SetUpCodePairer.cpp",
Expand Down
2 changes: 1 addition & 1 deletion src/controller/EmptyDataModelHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@

#include <app/util/DataModelHandler.h>

__attribute__((weak)) void InitDataModelHandler() {}
void InitDataModelHandler() {}
6 changes: 6 additions & 0 deletions src/darwin/Framework/Matter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
51B22C2A2740CB47008D5055 /* MTRCommandPayloadsObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B22C292740CB47008D5055 /* MTRCommandPayloadsObjc.mm */; };
51C8E3F82825CDB600D47D00 /* MTRTestKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = 51C8E3F72825CDB600D47D00 /* MTRTestKeys.m */; };
51C984622A61CE2A00B0AD9A /* MTRFabricInfoChecker.m in Sources */ = {isa = PBXBuildFile; fileRef = 51C984602A61CE2A00B0AD9A /* MTRFabricInfoChecker.m */; };
51CFDDB12AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CFDDB02AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp */; };
51CFDDB22AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CFDDB02AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp */; };
51D10D2E2808E2CA00E8CA3D /* MTRTestStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 51D10D2D2808E2CA00E8CA3D /* MTRTestStorage.m */; };
51E24E73274E0DAC007CCF6E /* MTRErrorTestUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E24E72274E0DAC007CCF6E /* MTRErrorTestUtils.mm */; };
51E4D121291D0EB400C8C535 /* MTRBaseClusterUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E4D120291D0EB400C8C535 /* MTRBaseClusterUtils.h */; };
Expand Down Expand Up @@ -537,6 +539,7 @@
51C8E3F72825CDB600D47D00 /* MTRTestKeys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRTestKeys.m; sourceTree = "<group>"; };
51C984602A61CE2A00B0AD9A /* MTRFabricInfoChecker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRFabricInfoChecker.m; sourceTree = "<group>"; };
51C984612A61CE2A00B0AD9A /* MTRFabricInfoChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRFabricInfoChecker.h; sourceTree = "<group>"; };
51CFDDB02AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EmptyDataModelHandler.cpp; path = ../controller/EmptyDataModelHandler.cpp; sourceTree = "<group>"; };
51D10D2D2808E2CA00E8CA3D /* MTRTestStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRTestStorage.m; sourceTree = "<group>"; };
51E24E72274E0DAC007CCF6E /* MTRErrorTestUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRErrorTestUtils.mm; sourceTree = "<group>"; };
51E4D120291D0EB400C8C535 /* MTRBaseClusterUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRBaseClusterUtils.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -956,6 +959,7 @@
isa = PBXGroup;
children = (
5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */,
51CFDDB02AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp */,
);
name = app;
path = ../../../app;
Expand Down Expand Up @@ -1668,6 +1672,7 @@
039145E12993102B00257B3E /* main.mm in Sources */,
037C3DD42991BD5200B7EEE2 /* logging.mm in Sources */,
B45374012A9FEC4F00807602 /* unix-sockets.c in Sources */,
51CFDDB22AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp in Sources */,
03F430A82994112B00166449 /* editline.c in Sources */,
B45373E92A9FEBC100807602 /* server.c in Sources */,
037C3DB32991BD5000B7EEE2 /* OpenCommissioningWindowCommand.mm in Sources */,
Expand Down Expand Up @@ -1736,6 +1741,7 @@
5A7947E427C0129600434CF2 /* MTRDeviceController+XPC.mm in Sources */,
5A6FEC9027B563D900F25F42 /* MTRDeviceControllerOverXPC.mm in Sources */,
B289D4222639C0D300D4E314 /* MTROnboardingPayloadParser.mm in Sources */,
51CFDDB12AC5F78F00DA7CA5 /* EmptyDataModelHandler.cpp in Sources */,
3CF134AD289D8E570017A19E /* MTRDeviceAttestationInfo.mm in Sources */,
2C1B027A2641DB4E00780EF1 /* MTROperationalCredentialsDelegate.mm in Sources */,
7560FD1C27FBBD3F005E85B3 /* MTREventTLVValueDecoder.mm in Sources */,
Expand Down

0 comments on commit dd33d0e

Please sign in to comment.