Skip to content

Commit ea8b849

Browse files
authored
[Matter.framework] Move various #define to src/platform/Darwin/CHIPPlatformConfig.h by defautl instead of relying on CHIPProjectAppConfig.h (#36178)
1 parent 92fa1ad commit ea8b849

File tree

12 files changed

+38
-139
lines changed

12 files changed

+38
-139
lines changed

config/ios/args.gni config/darwin/args.gni

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2020 Project CHIP Authors
1+
# Copyright (c) 2024 Project CHIP Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -14,9 +14,9 @@
1414

1515
import("//build_overrides/chip.gni")
1616

17-
chip_system_config_clock = "gettimeofday"
1817
chip_device_platform = "darwin"
1918

20-
chip_project_config_include_dirs = [ "${chip_root}/config/ios" ]
19+
chip_project_config_include = ""
20+
chip_system_project_config_include = ""
2121

2222
pw_build_PIP_CONSTRAINTS = [ "${chip_root}/scripts/setup/constraints.txt" ]

config/ios/CHIPProjectConfig.h

-52
This file was deleted.

config/ios/SystemProjectConfig.h

-26
This file was deleted.

examples/darwin-framework-tool/args.gni

+1-12
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,4 @@
1414

1515
import("//build_overrides/chip.gni")
1616

17-
import("${chip_root}/config/standalone/args.gni")
18-
19-
chip_crypto = "boringssl"
20-
21-
chip_device_project_config_include =
22-
"${chip_root}/examples/darwin-framework-tool/include/CHIPProjectAppConfig.h"
23-
chip_project_config_include =
24-
"${chip_root}/examples/darwin-framework-tool/include/CHIPProjectAppConfig.h"
25-
26-
chip_project_config_include_dirs =
27-
[ "${chip_root}/examples/darwin-framework-tool/include" ]
28-
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
17+
import("${chip_root}/config/darwin/args.gni")

examples/darwin-framework-tool/include/CHIPProjectAppConfig.h

-31
This file was deleted.

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj

-2
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@
678678
"$(CHIP_ROOT)/src/include",
679679
"$(CHIP_ROOT)/src/lib",
680680
"$(CHIP_ROOT)/src/app",
681-
"$(CHIP_ROOT)/config/ios",
682681
"$(CHIP_ROOT)/src/app/util",
683682
"$(CHIP_ROOT)/third_party/nlassert/repo/include",
684683
"$(CHIP_ROOT)/third_party/nlio/repo/include",
@@ -759,7 +758,6 @@
759758
"$(CHIP_ROOT)/src/include",
760759
"$(CHIP_ROOT)/src/lib",
761760
"$(CHIP_ROOT)/src/app",
762-
"$(CHIP_ROOT)/config/ios",
763761
"$(CHIP_ROOT)/src/app/util",
764762
"$(CHIP_ROOT)/third_party/nlassert/repo/include",
765763
"$(CHIP_ROOT)/third_party/nlio/repo/include",

examples/tv-casting-app/darwin/args.gni

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@
1414

1515
import("//build_overrides/chip.gni")
1616

17-
import("${chip_root}/config/ios/args.gni")
17+
import("${chip_root}/config/darwin/args.gni")
1818

1919
chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
20-
chip_project_config_include = "<CHIPProjectAppConfig.h>"
21-
chip_system_project_config_include = "<SystemProjectConfig.h>"
2220

23-
chip_project_config_include_dirs += [
21+
chip_project_config_include_dirs = [
2422
"${chip_root}/examples/tv-casting-app/tv-casting-common/include",
2523
"${chip_root}/examples/tv-casting-app/tv-casting-common",
2624
]
27-
chip_project_config_include_dirs += [ "${chip_root}/config/ios" ]
2825

2926
chip_build_libshell = true
3027

examples/tv-casting-app/tv-casting-common/include/CHIPProjectAppConfig.h

+2
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,6 @@
9292

9393
// Include the CHIPProjectConfig from config/standalone
9494
// Add this at the end so that we can hit our #defines first
95+
#ifndef CHIP_DEVICE_LAYER_TARGET_DARWIN
9596
#include <CHIPProjectConfig.h>
97+
#endif // CHIP_DEVICE_LAYER_TARGET_DARWIN

src/darwin/Framework/Matter.xcodeproj/project.pbxproj

-4
Original file line numberDiff line numberDiff line change
@@ -2257,7 +2257,6 @@
22572257
"$(CHIP_ROOT)/third_party/nlio/repo/include",
22582258
"$(CHIP_ROOT)/third_party/jsoncpp/repo/include",
22592259
"$(CHIP_ROOT)/zzz_generated/darwin-framework-tool",
2260-
"$(CHIP_ROOT)/config/ios",
22612260
"$(CHIP_ROOT)/third_party/editline/repo/include",
22622261
"$(CHIP_ROOT)/src/include",
22632262
"$(CONFIGURATION_TEMP_DIR)/Matter.build/out/gen/include",
@@ -2334,7 +2333,6 @@
23342333
"$(CHIP_ROOT)/zzz_generated/app-common",
23352334
"$(CHIP_ROOT)/third_party/nlio/repo/include",
23362335
"$(CHIP_ROOT)/third_party/jsoncpp/repo/include",
2337-
"$(CHIP_ROOT)/config/ios",
23382336
"$(CHIP_ROOT)/third_party/editline/repo/include",
23392337
"$(CHIP_ROOT)/third_party/libwebsockets",
23402338
"$(CHIP_ROOT)/third_party/libwebsockets/repo/include",
@@ -2526,7 +2524,6 @@
25262524
SYSTEM_HEADER_SEARCH_PATHS = (
25272525
"$(TEMP_DIR)/out/gen/include",
25282526
"$(CHIP_ROOT)/src/darwin/Framework/CHIP/",
2529-
"$(CHIP_ROOT)/config/ios",
25302527
"$(CHIP_ROOT)/src",
25312528
"$(CHIP_ROOT)/src/include",
25322529
"$(CHIP_ROOT)/zzz_generated/",
@@ -2698,7 +2695,6 @@
26982695
SYSTEM_HEADER_SEARCH_PATHS = (
26992696
"$(TEMP_DIR)/out/gen/include",
27002697
"$(CHIP_ROOT)/src/darwin/Framework/CHIP/",
2701-
"$(CHIP_ROOT)/config/ios",
27022698
"$(CHIP_ROOT)/src",
27032699
"$(CHIP_ROOT)/src/include",
27042700
"$(CHIP_ROOT)/zzz_generated/",

src/darwin/Framework/chip_xcode_build_connector.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ done
103103
[[ $ENABLE_BITCODE == YES ]] && target_cflags+=("-flto")
104104

105105
declare -a args=(
106+
'import("//config/darwin/args.gni")'
106107
'default_configs_cosmetic=[]' # suppress colorization
107108
'chip_crypto="boringssl"'
108109
'chip_build_controller_dynamic_server=false'
@@ -132,7 +133,6 @@ esac
132133
[[ $PLATFORM_FAMILY_NAME != macOS ]] && {
133134
args+=(
134135
'target_os="ios"'
135-
'import("//config/ios/args.gni")'
136136
)
137137
}
138138

src/platform/Darwin/CHIPPlatformConfig.h

+25-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#pragma once
2525

26+
#include <TargetConditionals.h>
27+
2628
// ==================== General Platform Adaptations ====================
2729

2830
#define CHIP_CONFIG_ABORT() abort()
@@ -53,9 +55,16 @@ extern "C" int __cxa_atexit(void (*f)(void *), void * p, void * d);
5355
#define CHIP_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS 8
5456
#endif // CHIP_CONFIG_MAX_UNSOLICITED_MESSAGE_HANDLERS
5557

56-
#ifndef CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS
57-
#define CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS 8
58-
#endif // CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS
58+
//
59+
// Default of 8 ECs is not sufficient for some of the unit tests
60+
// that try to validate multiple simultaneous interactions.
61+
// In tests like TestReadHandler_MultipleSubscriptions, we are trying to issue as many read / subscription requests as possible in
62+
// parallel. Since the default config says we support 16 fabrics, and we will have 4 read handlers for each fabric (3 subscriptions
63+
// + 1 reserved for read) that is read transactions in parallel. Since the report handlers are allocated on the heap, we will issue
64+
// 65 requests (the TestReadHandler_MultipleSubscriptions will issue CHIP_IM_MAX_NUM_READ_HANDLER + 1 subscriptions to verify heap
65+
// allocation logic) in total and that is 130 ECs. Round this up to 150 ECs
66+
//
67+
#define CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS 150
5968

6069
#ifndef CHIP_LOG_FILTERING
6170
#define CHIP_LOG_FILTERING 1
@@ -66,5 +75,18 @@ extern "C" int __cxa_atexit(void (*f)(void *), void * p, void * d);
6675
#endif // CHIP_CONFIG_BDX_MAX_NUM_TRANSFERS
6776

6877
#ifndef CHIP_CONFIG_KVS_PATH
78+
#if TARGET_OS_IPHONE
79+
#define CHIP_CONFIG_KVS_PATH "chip.store"
80+
#else
6981
#define CHIP_CONFIG_KVS_PATH "/tmp/chip_kvs"
82+
#endif // TARGET_OS_IPHONE
7083
#endif // CHIP_CONFIG_KVS_PATH
84+
85+
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0
86+
87+
// The session pool size limits how many subscriptions we can have live at
88+
// once. Home supports up to 1000 accessories, and we subscribe to all of them,
89+
// so we need to make sure the pool is big enough for that.
90+
#define CHIP_CONFIG_SECURE_SESSION_POOL_SIZE 1000
91+
92+
#define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0

src/system/system.gni

+4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ if (chip_system_config_locking == "") {
7171
}
7272
}
7373

74+
if (target_os == "mac" || target_os == "ios") {
75+
chip_system_config_clock = "gettimeofday"
76+
}
77+
7478
assert(
7579
chip_system_config_locking == "posix" ||
7680
chip_system_config_locking == "freertos" ||

0 commit comments

Comments
 (0)