| # 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("${chip_root}/src/ble/ble.gni") |
| |
| declare_args() { |
| # Device platform layer: cc13x2_26x2, darwin, efr32, esp32, external, freertos, linux, nrfconnect, k32w0, qpg, tizen, none. |
| |
| chip_device_platform = "auto" |
| chip_platform_target = "" |
| |
| # Substitue fake platform when building with chip_device_platform=auto. |
| chip_fake_platform = false |
| } |
| |
| if (chip_device_platform == "auto") { |
| if (chip_fake_platform) { |
| chip_device_platform = "fake" |
| } else if (current_os == "mac" || current_os == "ios") { |
| chip_device_platform = "darwin" |
| } else if (current_os == "linux") { |
| chip_device_platform = "linux" |
| } else if (current_os == "tizen") { |
| chip_device_platform = "tizen" |
| } else if (current_os == "android") { |
| chip_device_platform = "android" |
| } else { |
| chip_device_platform = "none" |
| } |
| } |
| |
| declare_args() { |
| # Enable openthread support. |
| chip_enable_openthread = |
| chip_device_platform == "linux" || chip_device_platform == "qpg" || |
| chip_device_platform == "cc13x2_26x2" || chip_device_platform == "k32w0" |
| |
| # Enable wifi support. |
| chip_enable_wifi = |
| chip_device_platform == "linux" || chip_device_platform == "esp32" || |
| chip_device_platform == "mbed" || chip_device_platform == "tizen" || |
| chip_device_platform == "android" || chip_device_platform == "ameba" |
| |
| # Enable ble support. |
| if (chip_device_platform == "fake") { |
| chip_enable_ble = false |
| } else { |
| chip_enable_ble = chip_config_network_layer_ble |
| } |
| |
| # Enable NFC support |
| chip_enable_nfc = false |
| |
| # Enable OTA requestor support |
| chip_enable_ota_requestor = false |
| |
| # Select DNS-SD implementation |
| if (chip_device_platform == "linux" || chip_device_platform == "esp32" || |
| chip_device_platform == "mbed" || chip_device_platform == "p6" || |
| chip_device_platform == "ameba") { |
| chip_mdns = "minimal" |
| } else if (chip_device_platform == "darwin" || |
| chip_device_platform == "cc13x2_26x2" || current_os == "android" || |
| chip_device_platform == "fake" || |
| chip_device_platform == "tizen") { |
| chip_mdns = "platform" |
| } else { |
| chip_mdns = "none" |
| } |
| } |
| |
| _chip_device_layer = "none" |
| if (chip_device_platform == "cc13x2_26x2") { |
| _chip_device_layer = "cc13x2_26x2" |
| } else if (chip_device_platform == "darwin") { |
| _chip_device_layer = "Darwin" |
| } else if (chip_device_platform == "efr32") { |
| _chip_device_layer = "EFR32" |
| } else if (chip_device_platform == "esp32") { |
| _chip_device_layer = "ESP32" |
| } else if (chip_device_platform == "linux") { |
| _chip_device_layer = "Linux" |
| } else if (chip_device_platform == "tizen") { |
| _chip_device_layer = "Tizen" |
| } else if (chip_device_platform == "nrfconnect") { |
| _chip_device_layer = "nrfconnect" |
| } else if (chip_device_platform == "qpg") { |
| _chip_device_layer = "qpg" |
| } else if (chip_device_platform == "k32w0") { |
| _chip_device_layer = "nxp/k32w/k32w0" |
| } else if (chip_device_platform == "telink") { |
| _chip_device_layer = "telink" |
| } else if (chip_device_platform == "mbed") { |
| _chip_device_layer = "mbed" |
| } else if (chip_device_platform == "p6") { |
| _chip_device_layer = "P6" |
| } else if (chip_device_platform == "android") { |
| _chip_device_layer = "android" |
| } else if (chip_device_platform == "ameba") { |
| _chip_device_layer = "Ameba" |
| } |
| |
| if (chip_device_platform != "external") { |
| chip_ble_platform_config_include = "" |
| chip_device_platform_config_include = "" |
| chip_platform_config_include = "" |
| chip_inet_platform_config_include = "" |
| chip_system_platform_config_include = "" |
| } else { |
| declare_args() { |
| chip_ble_platform_config_include = "" |
| chip_device_platform_config_include = "" |
| chip_platform_config_include = "" |
| chip_inet_platform_config_include = "" |
| chip_system_platform_config_include = "" |
| } |
| } |
| |
| if (_chip_device_layer != "none" && chip_device_platform != "external") { |
| chip_ble_platform_config_include = |
| "<platform/" + _chip_device_layer + "/BlePlatformConfig.h>" |
| chip_device_platform_config_include = |
| "<platform/" + _chip_device_layer + "/CHIPDevicePlatformConfig.h>" |
| chip_platform_config_include = |
| "<platform/" + _chip_device_layer + "/CHIPPlatformConfig.h>" |
| chip_inet_platform_config_include = |
| "<platform/" + _chip_device_layer + "/InetPlatformConfig.h>" |
| chip_system_platform_config_include = |
| "<platform/" + _chip_device_layer + "/SystemPlatformConfig.h>" |
| } |
| |
| assert( |
| (current_os != "freertos" && chip_device_platform == "none") || |
| chip_device_platform == "fake" || |
| chip_device_platform == "cc13x2_26x2" || |
| chip_device_platform == "darwin" || chip_device_platform == "efr32" || |
| chip_device_platform == "esp32" || chip_device_platform == "external" || |
| chip_device_platform == "linux" || chip_device_platform == "tizen" || |
| chip_device_platform == "nrfconnect" || |
| chip_device_platform == "k32w0" || chip_device_platform == "qpg" || |
| chip_device_platform == "telink" || chip_device_platform == "mbed" || |
| chip_device_platform == "p6" || chip_device_platform == "android" || |
| chip_device_platform == "ameba", |
| "Please select a valid value for chip_device_platform") |