blob: e58f32914695b65ad31424f92cffe35e366c8b08 [file] [log] [blame]
# Copyright (c) 2020-2021 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/lwip/lwip.gni")
declare_args() {
# Use the lwIP library.
chip_system_config_use_lwip = chip_with_lwip && current_os == "freertos"
# Use Network.framework API
chip_system_config_use_network_framework = false
# Mutex implementation: posix, freertos, none.
chip_system_config_locking = ""
# Clock implementation: clock_gettime, gettimeofday
chip_system_config_clock = "clock_gettime"
# Enable metrics collection.
chip_system_config_provide_statistics = true
# Use OpenThread TCP/UDP stack directly
chip_system_config_use_open_thread_inet_endpoints = false
}
declare_args() {
# Use BSD/POSIX socket API.
chip_system_config_use_sockets =
current_os != "freertos" && !chip_system_config_use_network_framework
}
declare_args() {
# do not use libev by default
chip_system_config_use_libev = false
# use the dispatch library on darwin targets
chip_system_config_use_dispatch =
(chip_system_config_use_sockets ||
chip_system_config_use_network_framework) &&
(current_os == "mac" || current_os == "ios")
}
declare_args() {
# Event loop type.
if (chip_system_config_use_lwip ||
chip_system_config_use_open_thread_inet_endpoints) {
chip_system_config_event_loop = "FreeRTOS"
} else {
chip_system_config_event_loop = "Select"
}
}
if (chip_system_config_locking == "") {
if (current_os == "freertos") {
chip_system_config_locking = "freertos"
} else if (current_os == "mbed") {
chip_system_config_locking = "mbed"
} else if (current_os == "cmsis-rtos") {
chip_system_config_locking = "cmsis-rtos"
} else if (current_os == "zephyr") {
chip_system_config_locking = "zephyr"
} else if (chip_system_config_use_dispatch == false) {
chip_system_config_locking = "posix"
} else {
chip_system_config_locking = "none"
}
}
if (target_os == "mac" || target_os == "ios") {
chip_system_config_clock = "gettimeofday"
}
assert(
chip_system_config_locking == "posix" ||
chip_system_config_locking == "freertos" ||
chip_system_config_locking == "none" ||
chip_system_config_locking == "mbed" ||
chip_system_config_locking == "cmsis-rtos" ||
chip_system_config_locking == "zephyr",
"Please select a valid mutex implementation: posix, freertos, mbed, cmsis-rtos, zephyr, none")
assert(
!chip_system_config_use_dispatch || chip_system_config_locking == "none",
"When chip_system_config_use_dispatch is true, chip_system_config_locking must be 'none'")
assert(
chip_system_config_clock == "clock_gettime" ||
chip_system_config_clock == "gettimeofday",
"Please select a valid clock implementation: clock_gettime, gettimeofday")