| # Copyright (c) 2020 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. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("//build/config/linux/pkg_config.gni") |
| import("//build_overrides/chip.gni") |
| import("//build_overrides/nlio.gni") |
| |
| import("${chip_root}/build/chip/buildconfig_header.gni") |
| |
| import("device.gni") |
| |
| if (chip_enable_openthread) { |
| import("//build_overrides/openthread.gni") |
| import("//build_overrides/ot_br_posix.gni") |
| } |
| |
| if (chip_device_platform == "linux" && chip_enable_mdns) { |
| pkg_config("avahi_client_config") { |
| packages = [ "avahi-client" ] |
| } |
| } |
| |
| if (chip_device_platform != "none") { |
| declare_args() { |
| # Extra header to include in CHIPDeviceConfig.h for project. |
| chip_device_project_config_include = "" |
| |
| # Date the firmware was built. |
| chip_device_config_firmware_build_date = "" |
| |
| # Time the firmware was built. |
| chip_device_config_firmware_build_time = "" |
| |
| # By pass provision and secure session |
| chip_bypass_rendezvous = false |
| } |
| |
| buildconfig_header("platform_buildconfig") { |
| header = "CHIPDeviceBuildConfig.h" |
| header_dir = "platform" |
| |
| chip_with_gio = chip_enable_wifi |
| chip_device_config_enable_wpa = chip_enable_wifi |
| |
| defines = [ |
| "CHIP_DEVICE_CONFIG_ENABLE_WPA=${chip_device_config_enable_wpa}", |
| "CHIP_ENABLE_OPENTHREAD=${chip_enable_openthread}", |
| "CHIP_ENABLE_MDNS=${chip_enable_mdns}", |
| "CHIP_WITH_GIO=${chip_with_gio}", |
| "OPENTHREAD_CONFIG_ENABLE_TOBLE=false", |
| ] |
| |
| if (chip_device_project_config_include != "") { |
| defines += [ "CHIP_DEVICE_PROJECT_CONFIG_INCLUDE=${chip_device_project_config_include}" ] |
| } |
| if (chip_device_platform_config_include != "") { |
| defines += [ "CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE=${chip_device_platform_config_include}" ] |
| } |
| |
| if (chip_device_config_firmware_build_date != "") { |
| defines += [ "CHIP_DEVICE_CONFIG_FIRWMARE_BUILD_DATE=\"${chip_device_config_firmware_build_date}\"" ] |
| } |
| if (chip_device_config_firmware_build_time != "") { |
| defines += [ "CHIP_DEVICE_CONFIG_FIRMWARE_BUILD_TIME=\"${chip_device_config_firmware_build_time}\"" ] |
| } |
| |
| if (chip_bypass_rendezvous) { |
| defines += [ "CHIP_BYPASS_RENDEZVOUS=1" ] |
| } |
| |
| if (chip_device_platform == "darwin") { |
| defines += [ |
| "CHIP_DEVICE_LAYER_TARGET_DARWIN=1", |
| "CHIP_DEVICE_LAYER_TARGET=Darwin", |
| ] |
| } else if (chip_device_platform == "efr32") { |
| defines += [ |
| "CHIP_DEVICE_LAYER_TARGET_EFR32=1", |
| "CHIP_DEVICE_LAYER_TARGET=EFR32", |
| ] |
| } else if (chip_device_platform == "esp32") { |
| defines += [ |
| "CHIP_DEVICE_LAYER_TARGET_ESP32=1", |
| "CHIP_DEVICE_LAYER_TARGET=ESP32", |
| ] |
| } else if (chip_device_platform == "linux") { |
| defines += [ |
| "CHIP_DEVICE_LAYER_TARGET_LINUX=1", |
| "CHIP_DEVICE_LAYER_TARGET=Linux", |
| ] |
| } else if (chip_device_platform == "nrfconnect") { |
| defines += [ |
| "CHIP_DEVICE_LAYER_TARGET_NRFCONNECT=1", |
| "CHIP_DEVICE_LAYER_TARGET=nrfconnect", |
| ] |
| } else if (chip_device_platform == "qpg6100") { |
| defines += [ |
| "CHIP_DEVICE_LAYER_TARGET_QPG6100=1", |
| "CHIP_DEVICE_LAYER_TARGET=qpg6100", |
| ] |
| } else if (chip_device_platform == "k32w") { |
| defines += [ |
| "CHIP_DEVICE_LAYER_TARGET_K32W=1", |
| "CHIP_DEVICE_LAYER_TARGET=K32W", |
| ] |
| } |
| } |
| } else { |
| buildconfig_header("platform_buildconfig") { |
| header = "CHIPDeviceBuildConfig.h" |
| header_dir = "platform" |
| |
| defines = [ |
| "CHIP_DEVICE_LAYER_NONE=1", |
| "CHIP_DEVICE_LAYER_TARGET=NONE", |
| ] |
| } |
| } |
| |
| if (chip_device_platform != "none" && chip_device_platform != "external") { |
| config("platform_config") { |
| if (chip_device_platform == "darwin") { |
| frameworks = [ |
| "CoreFoundation.framework", |
| "CoreBluetooth.framework", |
| "Foundation.framework", |
| ] |
| } |
| } |
| |
| static_library("platform") { |
| output_name = "libDeviceLayer" |
| |
| sources = [ |
| "../include/platform/CHIPDeviceConfig.h", |
| "../include/platform/CHIPDeviceError.h", |
| "../include/platform/CHIPDeviceEvent.h", |
| "../include/platform/CHIPDeviceLayer.h", |
| "../include/platform/ConfigurationManager.h", |
| "../include/platform/ConnectivityManager.h", |
| "../include/platform/GeneralUtils.h", |
| "../include/platform/PersistedStorage.h", |
| "../include/platform/PlatformManager.h", |
| "../include/platform/SoftwareUpdateManager.h", |
| "../include/platform/SoftwareUpdateManagerImpl.h", |
| "../include/platform/ThreadStackManager.h", |
| "../include/platform/TimeSyncManager.h", |
| "../include/platform/internal/BLEManager.h", |
| "../include/platform/internal/CHIPDeviceLayerInternal.h", |
| "../include/platform/internal/DeviceDescriptionServer.h", |
| "../include/platform/internal/DeviceNetworkInfo.h", |
| "../include/platform/internal/DeviceNetworkProvisioning.h", |
| "../include/platform/internal/EventLogging.h", |
| "../include/platform/internal/GenericConfigurationManagerImpl.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_BLE.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_NoBLE.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_NoThread.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_Thread.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_WiFi.h", |
| "../include/platform/internal/GenericNetworkProvisioningServerImpl.h", |
| "../include/platform/internal/GenericPlatformManagerImpl.h", |
| "../include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.h", |
| "../include/platform/internal/GenericPlatformManagerImpl_POSIX.h", |
| "../include/platform/internal/GenericSoftwareUpdateManagerImpl.h", |
| "../include/platform/internal/GenericSoftwareUpdateManagerImpl_BDX.h", |
| "../include/platform/internal/NetworkProvisioningServer.h", |
| "../include/platform/internal/testing/ConfigUnitTest.h", |
| "GeneralUtils.cpp", |
| "Globals.cpp", |
| "PersistedStorage.cpp", |
| "SystemEventSupport.cpp", |
| "SystemTimerSupport.cpp", |
| "TestIdentity.cpp", |
| ] |
| |
| cflags = [ "-Wconversion" ] |
| |
| public_deps = [ |
| ":platform_buildconfig", |
| "${chip_root}/src/ble", |
| "${chip_root}/src/inet", |
| "${chip_root}/src/lib/core", |
| "${chip_root}/src/lib/core:chip_config_header", |
| "${chip_root}/src/lib/support", |
| "${chip_root}/src/setup_payload", |
| "${nlio_root}:nlio", |
| ] |
| |
| public_configs = [ |
| ":platform_config", |
| "${chip_root}/src:includes", |
| ] |
| |
| if (chip_device_platform == "darwin") { |
| sources += [ |
| "Darwin/BLEManagerImpl.cpp", |
| "Darwin/BLEManagerImpl.h", |
| "Darwin/BlePlatformConfig.h", |
| "Darwin/CHIPDevicePlatformConfig.h", |
| "Darwin/CHIPDevicePlatformEvent.h", |
| "Darwin/CHIPPlatformConfig.h", |
| "Darwin/ConfigurationManagerImpl.cpp", |
| "Darwin/ConfigurationManagerImpl.h", |
| "Darwin/ConnectivityManagerImpl.cpp", |
| "Darwin/ConnectivityManagerImpl.h", |
| "Darwin/InetPlatformConfig.h", |
| "Darwin/PlatformManagerImpl.cpp", |
| "Darwin/PlatformManagerImpl.h", |
| "Darwin/PosixConfig.cpp", |
| "Darwin/PosixConfig.h", |
| "Darwin/SystemPlatformConfig.h", |
| ] |
| |
| if (chip_enable_ble) { |
| sources += [ |
| "Darwin/BleApplicationDelegate.h", |
| "Darwin/BleApplicationDelegateImpl.mm", |
| "Darwin/BleConnectionDelegate.h", |
| "Darwin/BleConnectionDelegateImpl.mm", |
| "Darwin/BlePlatformDelegate.h", |
| "Darwin/BlePlatformDelegateImpl.mm", |
| ] |
| } |
| } else if (chip_device_platform == "efr32") { |
| sources += [ |
| "EFR32/BLEManagerImpl.cpp", |
| "EFR32/BLEManagerImpl.h", |
| "EFR32/BlePlatformConfig.h", |
| "EFR32/CHIPDevicePlatformConfig.h", |
| "EFR32/CHIPDevicePlatformEvent.h", |
| "EFR32/CHIPPlatformConfig.h", |
| "EFR32/ConfigurationManagerImpl.cpp", |
| "EFR32/ConfigurationManagerImpl.h", |
| "EFR32/ConnectivityManagerImpl.cpp", |
| "EFR32/ConnectivityManagerImpl.h", |
| "EFR32/DeviceNetworkProvisioningDelegateImpl.cpp", |
| "EFR32/DeviceNetworkProvisioningDelegateImpl.h", |
| "EFR32/EFR32Config.cpp", |
| "EFR32/EFR32Config.h", |
| "EFR32/InetPlatformConfig.h", |
| "EFR32/Logging.cpp", |
| "EFR32/PlatformManagerImpl.cpp", |
| "EFR32/PlatformManagerImpl.h", |
| "EFR32/SystemPlatformConfig.h", |
| "EFR32/freertos_bluetooth.c", |
| "EFR32/freertos_bluetooth.h", |
| "EFR32/gatt_db.c", |
| "EFR32/gatt_db.h", |
| "FreeRTOS/SystemTimeSupport.cpp", |
| ] |
| if (chip_enable_openthread) { |
| public_deps += [ "${openthread_root}:libopenthread-ftd" ] |
| |
| sources += [ |
| "EFR32/ThreadStackManagerImpl.cpp", |
| "EFR32/ThreadStackManagerImpl.h", |
| "OpenThread/OpenThreadUtils.cpp", |
| ] |
| } |
| } else if (chip_device_platform == "esp32") { |
| sources += [ |
| "ESP32/BLEManagerImpl.h", |
| "ESP32/CHIPDevicePlatformConfig.h", |
| "ESP32/CHIPDevicePlatformEvent.h", |
| "ESP32/ConfigurationManagerImpl.cpp", |
| "ESP32/ConfigurationManagerImpl.h", |
| "ESP32/ConnectivityManagerImpl.cpp", |
| "ESP32/ConnectivityManagerImpl.h", |
| "ESP32/DeviceNetworkProvisioningDelegateImpl.cpp", |
| "ESP32/DeviceNetworkProvisioningDelegateImpl.h", |
| "ESP32/ESP32Config.cpp", |
| "ESP32/ESP32Config.h", |
| "ESP32/ESP32Utils.cpp", |
| "ESP32/ESP32Utils.h", |
| "ESP32/Logging.cpp", |
| "ESP32/LwIPCoreLock.cpp", |
| "ESP32/MdnsImpl.cpp", |
| "ESP32/NetworkProvisioningServerImpl.h", |
| "ESP32/PlatformManagerImpl.cpp", |
| "ESP32/PlatformManagerImpl.h", |
| "ESP32/ServiceProvisioning.cpp", |
| "ESP32/ServiceProvisioning.h", |
| "ESP32/SoftwareUpdateManagerImpl.h", |
| "ESP32/SystemTimeSupport.cpp", |
| "ESP32/bluedroid/BLEManagerImpl.cpp", |
| "ESP32/nimble/BLEManagerImpl.cpp", |
| "FreeRTOS/SystemTimeSupport.cpp", |
| ] |
| } else if (chip_device_platform == "k32w") { |
| sources += [ |
| "FreeRTOS/SystemTimeSupport.cpp", |
| "K32W/BLEManagerImpl.cpp", |
| "K32W/BLEManagerImpl.h", |
| "K32W/CHIPDevicePlatformConfig.h", |
| "K32W/CHIPDevicePlatformEvent.h", |
| "K32W/ConfigurationManagerImpl.cpp", |
| "K32W/ConfigurationManagerImpl.h", |
| "K32W/ConnectivityManagerImpl.cpp", |
| "K32W/ConnectivityManagerImpl.h", |
| "K32W/DeviceNetworkProvisioningDelegateImpl.h", |
| "K32W/K32WConfig.cpp", |
| "K32W/K32WConfig.h", |
| "K32W/Logging.cpp", |
| "K32W/NetworkProvisioningServerImpl.h", |
| "K32W/PlatformManagerImpl.cpp", |
| "K32W/PlatformManagerImpl.h", |
| "K32W/SoftwareUpdateManagerImpl.h", |
| ] |
| |
| if (chip_enable_openthread) { |
| public_deps += [ "${openthread_root}:libopenthread-ftd" ] |
| |
| sources += [ |
| "K32W/ThreadStackManagerImpl.cpp", |
| "K32W/ThreadStackManagerImpl.h", |
| "OpenThread/OpenThreadUtils.cpp", |
| ] |
| } |
| } else if (chip_device_platform == "linux") { |
| sources += [ |
| "Linux/BLEManagerImpl.cpp", |
| "Linux/BLEManagerImpl.h", |
| "Linux/BlePlatformConfig.h", |
| "Linux/CHIPBluezHelper.cpp", |
| "Linux/CHIPBluezHelper.h", |
| "Linux/CHIPDevicePlatformConfig.h", |
| "Linux/CHIPDevicePlatformEvent.h", |
| "Linux/CHIPLinuxStorage.cpp", |
| "Linux/CHIPLinuxStorage.h", |
| "Linux/CHIPLinuxStorageIni.cpp", |
| "Linux/CHIPLinuxStorageIni.h", |
| "Linux/CHIPPlatformConfig.h", |
| "Linux/ConfigurationManagerImpl.cpp", |
| "Linux/ConfigurationManagerImpl.h", |
| "Linux/ConnectivityManagerImpl.cpp", |
| "Linux/ConnectivityManagerImpl.h", |
| "Linux/DeviceNetworkProvisioningDelegateImpl.cpp", |
| "Linux/DeviceNetworkProvisioningDelegateImpl.h", |
| "Linux/InetPlatformConfig.h", |
| "Linux/Logging.cpp", |
| "Linux/PlatformManagerImpl.cpp", |
| "Linux/PlatformManagerImpl.h", |
| "Linux/PosixConfig.cpp", |
| "Linux/PosixConfig.h", |
| "Linux/SystemPlatformConfig.h", |
| "Linux/SystemTimeSupport.cpp", |
| ] |
| |
| if (chip_enable_mdns) { |
| sources += [ |
| "Linux/MdnsImpl.cpp", |
| "Linux/MdnsImpl.h", |
| ] |
| |
| public_deps += [ "${chip_root}/src/lib/mdns:platform_header" ] |
| |
| public_configs += [ ":avahi_client_config" ] |
| } |
| |
| if (chip_enable_openthread) { |
| sources += [ |
| "Linux/ThreadStackManagerImpl.cpp", |
| "Linux/ThreadStackManagerImpl.h", |
| ] |
| public_deps += [ "${ot_br_posix_root}:ot_br_client" ] |
| } |
| |
| if (chip_enable_wifi) { |
| public_deps += [ "Linux/dbus/wpa" ] |
| } |
| |
| if (chip_enable_ble) { |
| public_deps += [ "Linux/dbus/bluez" ] |
| } |
| |
| public_deps += [ "${chip_root}/third_party/inipp" ] |
| } else if (chip_device_platform == "nrfconnect") { |
| sources += [ |
| "Zephyr/SystemTimeSupport.cpp", |
| "nrfconnect/BLEManagerImpl.cpp", |
| "nrfconnect/BLEManagerImpl.h", |
| "nrfconnect/BlePlatformConfig.h", |
| "nrfconnect/CHIPDevicePlatformConfig.h", |
| "nrfconnect/CHIPDevicePlatformEvent.h", |
| "nrfconnect/CHIPPlatformConfig.h", |
| "nrfconnect/ConfigurationManagerImpl.cpp", |
| "nrfconnect/ConfigurationManagerImpl.h", |
| "nrfconnect/ConnectivityManagerImpl.cpp", |
| "nrfconnect/ConnectivityManagerImpl.h", |
| "nrfconnect/DeviceNetworkProvisioningDelegateImpl.cpp", |
| "nrfconnect/DeviceNetworkProvisioningDelegateImpl.h", |
| "nrfconnect/InetPlatformConfig.h", |
| "nrfconnect/Logging.cpp", |
| "nrfconnect/PlatformManagerImpl.cpp", |
| "nrfconnect/PlatformManagerImpl.h", |
| "nrfconnect/SystemPlatformConfig.h", |
| "nrfconnect/ZephyrConfig.cpp", |
| "nrfconnect/ZephyrConfig.h", |
| ] |
| |
| if (chip_enable_openthread) { |
| sources += [ |
| "OpenThread/OpenThreadUtils.cpp", |
| "nrfconnect/ThreadStackManagerImpl.cpp", |
| "nrfconnect/ThreadStackManagerImpl.h", |
| ] |
| } |
| } else if (chip_device_platform == "qpg6100") { |
| sources += [ |
| "FreeRTOS/SystemTimeSupport.cpp", |
| "qpg6100/BLEManagerImpl.cpp", |
| "qpg6100/BLEManagerImpl.h", |
| "qpg6100/BlePlatformConfig.h", |
| "qpg6100/CHIPDevicePlatformConfig.h", |
| "qpg6100/CHIPDevicePlatformEvent.h", |
| "qpg6100/CHIPPlatformConfig.h", |
| "qpg6100/ConfigurationManagerImpl.cpp", |
| "qpg6100/ConfigurationManagerImpl.h", |
| "qpg6100/ConnectivityManagerImpl.cpp", |
| "qpg6100/ConnectivityManagerImpl.h", |
| "qpg6100/DeviceNetworkProvisioningDelegateImpl.h", |
| "qpg6100/InetPlatformConfig.h", |
| "qpg6100/Logging.cpp", |
| "qpg6100/PlatformManagerImpl.cpp", |
| "qpg6100/PlatformManagerImpl.h", |
| "qpg6100/SystemPlatformConfig.h", |
| "qpg6100/qpg6100Config.cpp", |
| "qpg6100/qpg6100Config.h", |
| ] |
| |
| if (chip_enable_openthread) { |
| sources += [ |
| "OpenThread/OpenThreadUtils.cpp", |
| "qpg6100/ThreadStackManagerImpl.cpp", |
| "qpg6100/ThreadStackManagerImpl.h", |
| ] |
| } |
| } |
| |
| allow_circular_includes_from = [ "${chip_root}/src/lib/support" ] |
| } |
| } else if (chip_device_platform == "external") { |
| group("platform") { |
| public_deps = [ "${chip_platform_target}" ] |
| } |
| } else { |
| group("platform") { |
| public_deps = [ ":platform_buildconfig" ] |
| } |
| } |