Skip to content

Commit

Permalink
[Matter.framework] Move various #define to src/platform/Darwin/CHIPPl…
Browse files Browse the repository at this point in the history
…atformConfig.h by defautl instead of relying on CHIPProjectAppConfig.h (project-chip#36178)
  • Loading branch information
vivien-apple authored Oct 24, 2024
1 parent 92fa1ad commit ea8b849
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 139 deletions.
6 changes: 3 additions & 3 deletions config/ios/args.gni → config/darwin/args.gni
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020 Project CHIP Authors
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,9 @@

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

chip_system_config_clock = "gettimeofday"
chip_device_platform = "darwin"

chip_project_config_include_dirs = [ "${chip_root}/config/ios" ]
chip_project_config_include = ""
chip_system_project_config_include = ""

pw_build_PIP_CONSTRAINTS = [ "${chip_root}/scripts/setup/constraints.txt" ]
52 changes: 0 additions & 52 deletions config/ios/CHIPProjectConfig.h

This file was deleted.

26 changes: 0 additions & 26 deletions config/ios/SystemProjectConfig.h

This file was deleted.

13 changes: 1 addition & 12 deletions examples/darwin-framework-tool/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,4 @@

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

import("${chip_root}/config/standalone/args.gni")

chip_crypto = "boringssl"

chip_device_project_config_include =
"${chip_root}/examples/darwin-framework-tool/include/CHIPProjectAppConfig.h"
chip_project_config_include =
"${chip_root}/examples/darwin-framework-tool/include/CHIPProjectAppConfig.h"

chip_project_config_include_dirs =
[ "${chip_root}/examples/darwin-framework-tool/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
import("${chip_root}/config/darwin/args.gni")
31 changes: 0 additions & 31 deletions examples/darwin-framework-tool/include/CHIPProjectAppConfig.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,6 @@
"$(CHIP_ROOT)/src/include",
"$(CHIP_ROOT)/src/lib",
"$(CHIP_ROOT)/src/app",
"$(CHIP_ROOT)/config/ios",
"$(CHIP_ROOT)/src/app/util",
"$(CHIP_ROOT)/third_party/nlassert/repo/include",
"$(CHIP_ROOT)/third_party/nlio/repo/include",
Expand Down Expand Up @@ -759,7 +758,6 @@
"$(CHIP_ROOT)/src/include",
"$(CHIP_ROOT)/src/lib",
"$(CHIP_ROOT)/src/app",
"$(CHIP_ROOT)/config/ios",
"$(CHIP_ROOT)/src/app/util",
"$(CHIP_ROOT)/third_party/nlassert/repo/include",
"$(CHIP_ROOT)/third_party/nlio/repo/include",
Expand Down
7 changes: 2 additions & 5 deletions examples/tv-casting-app/darwin/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,14 @@

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

import("${chip_root}/config/ios/args.gni")
import("${chip_root}/config/darwin/args.gni")

chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
chip_project_config_include = "<CHIPProjectAppConfig.h>"
chip_system_project_config_include = "<SystemProjectConfig.h>"

chip_project_config_include_dirs += [
chip_project_config_include_dirs = [
"${chip_root}/examples/tv-casting-app/tv-casting-common/include",
"${chip_root}/examples/tv-casting-app/tv-casting-common",
]
chip_project_config_include_dirs += [ "${chip_root}/config/ios" ]

chip_build_libshell = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@

// Include the CHIPProjectConfig from config/standalone
// Add this at the end so that we can hit our #defines first
#ifndef CHIP_DEVICE_LAYER_TARGET_DARWIN
#include <CHIPProjectConfig.h>
#endif // CHIP_DEVICE_LAYER_TARGET_DARWIN
4 changes: 0 additions & 4 deletions src/darwin/Framework/Matter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2257,7 +2257,6 @@
"$(CHIP_ROOT)/third_party/nlio/repo/include",
"$(CHIP_ROOT)/third_party/jsoncpp/repo/include",
"$(CHIP_ROOT)/zzz_generated/darwin-framework-tool",
"$(CHIP_ROOT)/config/ios",
"$(CHIP_ROOT)/third_party/editline/repo/include",
"$(CHIP_ROOT)/src/include",
"$(CONFIGURATION_TEMP_DIR)/Matter.build/out/gen/include",
Expand Down Expand Up @@ -2334,7 +2333,6 @@
"$(CHIP_ROOT)/zzz_generated/app-common",
"$(CHIP_ROOT)/third_party/nlio/repo/include",
"$(CHIP_ROOT)/third_party/jsoncpp/repo/include",
"$(CHIP_ROOT)/config/ios",
"$(CHIP_ROOT)/third_party/editline/repo/include",
"$(CHIP_ROOT)/third_party/libwebsockets",
"$(CHIP_ROOT)/third_party/libwebsockets/repo/include",
Expand Down Expand Up @@ -2526,7 +2524,6 @@
SYSTEM_HEADER_SEARCH_PATHS = (
"$(TEMP_DIR)/out/gen/include",
"$(CHIP_ROOT)/src/darwin/Framework/CHIP/",
"$(CHIP_ROOT)/config/ios",
"$(CHIP_ROOT)/src",
"$(CHIP_ROOT)/src/include",
"$(CHIP_ROOT)/zzz_generated/",
Expand Down Expand Up @@ -2698,7 +2695,6 @@
SYSTEM_HEADER_SEARCH_PATHS = (
"$(TEMP_DIR)/out/gen/include",
"$(CHIP_ROOT)/src/darwin/Framework/CHIP/",
"$(CHIP_ROOT)/config/ios",
"$(CHIP_ROOT)/src",
"$(CHIP_ROOT)/src/include",
"$(CHIP_ROOT)/zzz_generated/",
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/chip_xcode_build_connector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ done
[[ $ENABLE_BITCODE == YES ]] && target_cflags+=("-flto")

declare -a args=(
'import("//config/darwin/args.gni")'
'default_configs_cosmetic=[]' # suppress colorization
'chip_crypto="boringssl"'
'chip_build_controller_dynamic_server=false'
Expand Down Expand Up @@ -132,7 +133,6 @@ esac
[[ $PLATFORM_FAMILY_NAME != macOS ]] && {
args+=(
'target_os="ios"'
'import("//config/ios/args.gni")'
)
}

Expand Down
28 changes: 25 additions & 3 deletions src/platform/Darwin/CHIPPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#pragma once

#include <TargetConditionals.h>

// ==================== General Platform Adaptations ====================

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

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

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

#ifndef CHIP_CONFIG_KVS_PATH
#if TARGET_OS_IPHONE
#define CHIP_CONFIG_KVS_PATH "chip.store"
#else
#define CHIP_CONFIG_KVS_PATH "/tmp/chip_kvs"
#endif // TARGET_OS_IPHONE
#endif // CHIP_CONFIG_KVS_PATH

#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0

// The session pool size limits how many subscriptions we can have live at
// once. Home supports up to 1000 accessories, and we subscribe to all of them,
// so we need to make sure the pool is big enough for that.
#define CHIP_CONFIG_SECURE_SESSION_POOL_SIZE 1000

#define INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT 0
4 changes: 4 additions & 0 deletions src/system/system.gni
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ if (chip_system_config_locking == "") {
}
}

if (target_os == "mac" || target_os == "ios") {
chip_system_config_clock = "gettimeofday"
}

assert(
chip_system_config_locking == "posix" ||
chip_system_config_locking == "freertos" ||
Expand Down

0 comments on commit ea8b849

Please sign in to comment.