|
| 1 | +# Copyright (c) 2023 Project CHIP Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +import("//build_overrides/chip.gni") |
| 16 | + |
| 17 | +import("${chip_root}/build/chip/buildconfig_header.gni") |
| 18 | +import("${chip_root}/src/platform/device.gni") |
| 19 | + |
| 20 | +declare_args() { |
| 21 | + # By default use default/example implementation of CommissionableDataProvider, |
| 22 | + # DeviceAttestationCredentialsProvider and DeviceInstanceInfoProvider |
| 23 | + chip_use_transitional_commissionable_data_provider = true |
| 24 | + chip_use_factory_data_provider = false |
| 25 | + chip_use_device_info_provider = false |
| 26 | + chip_config_software_version_number = 0 |
| 27 | + chip_enable_chipoble = true |
| 28 | + chip_bt_nimble_enabled = true |
| 29 | + chip_bt_bluedroid_enabled = true |
| 30 | + chip_max_discovered_ip_addresses = 5 |
| 31 | + chip_enable_route_hook = false |
| 32 | +} |
| 33 | + |
| 34 | +buildconfig_header("custom_buildconfig") { |
| 35 | + header = "CHIPDeviceBuildConfig.h" |
| 36 | + header_dir = "platform" |
| 37 | + |
| 38 | + defines = [ |
| 39 | + "CHIP_DEVICE_CONFIG_ENABLE_WPA=false", |
| 40 | + "CHIP_ENABLE_OPENTHREAD=${chip_enable_openthread}", |
| 41 | + "CHIP_DEVICE_CONFIG_THREAD_FTD=${chip_openthread_ftd}", |
| 42 | + "OPENTHREAD_CONFIG_ENABLE_TOBLE=false", |
| 43 | + "CHIP_BYPASS_RENDEZVOUS=false", |
| 44 | + "CHIP_STACK_LOCK_TRACKING_ENABLED=true", |
| 45 | + "CHIP_STACK_LOCK_TRACKING_ERROR_FATAL=false", |
| 46 | + "CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING=false", |
| 47 | + "CHIP_DEVICE_CONFIG_RUN_AS_ROOT=false", |
| 48 | + "CHIP_DEVICE_LAYER_TARGET_ESP32=1", |
| 49 | + "CHIP_DEVICE_LAYER_TARGET=ESP32_custom", |
| 50 | + "CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER=1", |
| 51 | + "BLE_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/BlePlatformConfig.h>", |
| 52 | + "CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/CHIPDevicePlatformConfig.h>", |
| 53 | + "CHIP_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/CHIPPlatformConfig.h>", |
| 54 | + "INET_CONFIG_INCLUDE=<external_platform/ESP32_custom/InetPlatformConfig.h>", |
| 55 | + "SYSTEM_PLATFORM_CONFIG_INCLUDE=<external_platform/ESP32_custom/SystemPlatformConfig.h>", |
| 56 | + "EXTERNAL_CONFIGURATIONMANAGERIMPL_HEADER=<external_platform/ESP32_custom/ConfigurationManagerImpl.h>", |
| 57 | + "EXTERNAL_CHIPDEVICEPLATFORMEVENT_HEADER=<external_platform/ESP32_custom/CHIPDevicePlatformEvent.h>", |
| 58 | + "EXTERNAL_CONNECTIVITYMANAGERIMPL_HEADER=<external_platform/ESP32_custom/ConnectivityManagerImpl.h>", |
| 59 | + "EXTERNAL_BLEMANAGERIMPL_HEADER=<external_platform/ESP32_custom/BLEManagerImpl.h>", |
| 60 | + "EXTERNAL_KEYVALUESTOREMANAGERIMPL_HEADER=<external_platform/ESP32_custom/KeyValueStoreManagerImpl.h>", |
| 61 | + "EXTERNAL_PLATFORMMANAGERIMPL_HEADER=<external_platform/ESP32_custom/PlatformManagerImpl.h>", |
| 62 | + "CHIP_CONFIG_SOFTWARE_VERSION_NUMBER=${chip_config_software_version_number}", |
| 63 | + "CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES=${chip_max_discovered_ip_addresses}", |
| 64 | + ] |
| 65 | + |
| 66 | + if (chip_enable_ota_requestor) { |
| 67 | + defines += [ "CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR=1" ] |
| 68 | + } |
| 69 | +} |
| 70 | + |
| 71 | +group("platform_buildconfig") { |
| 72 | + public_deps = [ ":custom_buildconfig" ] |
| 73 | +} |
| 74 | + |
| 75 | +static_library("ESP32_custom") { |
| 76 | + sources = [ |
| 77 | + "${chip_root}/src/platform/SingletonConfigurationManager.cpp", |
| 78 | + "CHIPDevicePlatformConfig.h", |
| 79 | + "CHIPDevicePlatformEvent.h", |
| 80 | + "ConfigurationManagerImpl.cpp", |
| 81 | + "ConfigurationManagerImpl.h", |
| 82 | + "ConnectivityManagerImpl.cpp", |
| 83 | + "ConnectivityManagerImpl.h", |
| 84 | + "DiagnosticDataProviderImpl.cpp", |
| 85 | + "DiagnosticDataProviderImpl.h", |
| 86 | + "ESP32Config.cpp", |
| 87 | + "ESP32Config.h", |
| 88 | + "ESP32Utils.cpp", |
| 89 | + "ESP32Utils.h", |
| 90 | + "KeyValueStoreManagerImpl.cpp", |
| 91 | + "KeyValueStoreManagerImpl.h", |
| 92 | + "Logging.cpp", |
| 93 | + "LwIPCoreLock.cpp", |
| 94 | + "PlatformManagerImpl.cpp", |
| 95 | + "PlatformManagerImpl.h", |
| 96 | + "SystemTimeSupport.cpp", |
| 97 | + "SystemTimeSupport.h", |
| 98 | + ] |
| 99 | + |
| 100 | + deps = [ |
| 101 | + "${chip_root}/src/lib/dnssd:platform_header", |
| 102 | + "${chip_root}/src/platform/logging:headers", |
| 103 | + "${chip_root}/src/setup_payload", |
| 104 | + ] |
| 105 | + |
| 106 | + public_deps = [ |
| 107 | + ":platform_buildconfig", |
| 108 | + "${chip_root}/src/crypto", |
| 109 | + "${chip_root}/src/platform:platform_base", |
| 110 | + ] |
| 111 | + |
| 112 | + if (chip_enable_ota_requestor) { |
| 113 | + sources += [ |
| 114 | + "OTAImageProcessorImpl.cpp", |
| 115 | + "OTAImageProcessorImpl.h", |
| 116 | + ] |
| 117 | + } |
| 118 | + |
| 119 | + if (chip_enable_chipoble) { |
| 120 | + sources += [ "BLEManagerImpl.h" ] |
| 121 | + } |
| 122 | + |
| 123 | + if (chip_bt_nimble_enabled) { |
| 124 | + sources += [ "nimble/BLEManagerImpl.cpp" ] |
| 125 | + } |
| 126 | + |
| 127 | + if (chip_bt_bluedroid_enabled) { |
| 128 | + sources += [ "bluedroid/BLEManagerImpl.cpp" ] |
| 129 | + } |
| 130 | + |
| 131 | + if (chip_enable_wifi) { |
| 132 | + sources += [ |
| 133 | + "ConnectivityManagerImpl_WiFi.cpp", |
| 134 | + "NetworkCommissioningDriver.cpp", |
| 135 | + "NetworkCommissioningDriver.h", |
| 136 | + "route_hook/ESP32RouteHook.c", |
| 137 | + "route_hook/ESP32RouteHook.h", |
| 138 | + "route_hook/ESP32RouteTable.c", |
| 139 | + "route_hook/ESP32RouteTable.h", |
| 140 | + ] |
| 141 | + if (chip_mdns == "platform") { |
| 142 | + sources += [ |
| 143 | + "DnssdImpl.cpp", |
| 144 | + "DnssdImpl.h", |
| 145 | + ] |
| 146 | + } |
| 147 | + } |
| 148 | + |
| 149 | + if (chip_use_factory_data_provider) { |
| 150 | + sources += [ |
| 151 | + "ESP32FactoryDataProvider.cpp", |
| 152 | + "ESP32FactoryDataProvider.h", |
| 153 | + ] |
| 154 | + } |
| 155 | + |
| 156 | + if (chip_use_device_info_provider) { |
| 157 | + sources += [ |
| 158 | + "ESP32DeviceInfoProvider.cpp", |
| 159 | + "ESP32DeviceInfoProvider.h", |
| 160 | + ] |
| 161 | + } |
| 162 | +} |
0 commit comments