| # 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_overrides/chip.gni") |
| import("//build_overrides/nlio.gni") |
| |
| import("device.gni") |
| |
| if (device_platform != "none") { |
| declare_args() { |
| # Extra header to include in CHIPDeviceConfig.h for project. |
| chip_device_project_config_include = "" |
| } |
| |
| config("platform_config") { |
| configs = [ "${chip_root}/src:includes" ] |
| |
| defines = [] |
| 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 (device_platform == "linux") { |
| defines += [ |
| "CONFIG_DEVICE_LAYER=1", |
| "CHIP_DEVICE_LAYER_TARGET_LINUX=1", |
| "CHIP_DEVICE_LAYER_TARGET=Linux", |
| ] |
| } else { |
| defines += [ "CHIP_DEVICE_LAYER_TARGET_LINUX=0" ] |
| } |
| if (device_platform == "nrf5") { |
| defines += [ |
| "CONFIG_DEVICE_LAYER=1", |
| "CHIP_DEVICE_LAYER_TARGET_NRF5=1", |
| "CHIP_DEVICE_LAYER_TARGET=nRF5", |
| ] |
| } else { |
| defines += [ "CHIP_DEVICE_LAYER_TARGET_NRF5=0" ] |
| } |
| } |
| |
| 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/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_NoTunnel.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h", |
| "../include/platform/internal/GenericConnectivityManagerImpl_Thread.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", |
| ] |
| |
| public_deps = [ |
| "${chip_root}/src/ble", |
| "${chip_root}/src/inet", |
| "${chip_root}/src/lib/core:chip_config_header", |
| "${chip_root}/src/lib/support", |
| "${nlio_root}:nlio", |
| ] |
| |
| public_configs = [ ":platform_config" ] |
| |
| if (chip_enable_openthread) { |
| sources += [ "OpenThread/OpenThreadUtils.cpp" ] |
| } |
| |
| if (device_platform == "linux") { |
| sources += [ |
| "Linux/BLEManagerImpl.cpp", |
| "Linux/BLEManagerImpl.h", |
| "Linux/BlePlatformConfig.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/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_openthread) { |
| sources += [ |
| "Linux/ThreadStackManagerImpl.cpp", |
| "Linux/ThreadStackManagerImpl.h", |
| ] |
| } |
| |
| public_deps += [ "${chip_root}/third_party/inipp" ] |
| } else if (device_platform == "nrf5") { |
| sources += [ |
| "FreeRTOS/SystemTimeSupport.cpp", |
| "nRF5/BLEManagerImpl.cpp", |
| "nRF5/BLEManagerImpl.h", |
| "nRF5/BlePlatformConfig.h", |
| "nRF5/CHIPDevicePlatformConfig.h", |
| "nRF5/CHIPDevicePlatformEvent.h", |
| "nRF5/CHIPPlatformConfig.h", |
| "nRF5/ConfigurationManagerImpl.cpp", |
| "nRF5/ConfigurationManagerImpl.h", |
| "nRF5/ConnectivityManagerImpl.cpp", |
| "nRF5/ConnectivityManagerImpl.h", |
| "nRF5/InetPlatformConfig.h", |
| "nRF5/Logging.cpp", |
| "nRF5/PlatformManagerImpl.cpp", |
| "nRF5/PlatformManagerImpl.h", |
| "nRF5/SystemPlatformConfig.h", |
| "nRF5/nRF5Config.cpp", |
| "nRF5/nRF5Config.h", |
| "nRF5/nRF5Utils.cpp", |
| "nRF5/nRF5Utils.h", |
| ] |
| |
| if (chip_enable_openthread) { |
| sources += [ |
| "nRF5/ThreadStackManagerImpl.cpp", |
| "nRF5/ThreadStackManagerImpl.h", |
| ] |
| } |
| } |
| |
| allow_circular_includes_from = [ "${chip_root}/src/lib/support" ] |
| } |
| } else { |
| group("platform") { |
| } |
| } |