1 # Copyright (c) 2020 Project CHIP Authors
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 # Debug build. Set this to false to remove development features.
20 if (target_os == "") {
24 if (target_cpu == "") {
28 if (current_cpu == "") {
29 current_cpu = target_cpu
31 if (current_os == "") {
32 current_os = target_os
36 import("//build_overrides/build.gni")
39 _pigweed_overrides = {
40 import("//build_overrides/pigweed.gni")
44 import("${_build_overrides.build_root}/config/defaults.gni")
48 # Toolchain to use for host. This is usually set by default.
52 if (host_toolchain == "") {
53 if (_chip_defaults.is_clang) {
54 host_toolchain = "${_build_overrides.build_root}/toolchain/host:${host_os}_${host_cpu}_clang"
56 host_toolchain = "${_build_overrides.build_root}/toolchain/host:${host_os}_${host_cpu}_gcc"
60 if (_chip_defaults.custom_toolchain != "") {
61 _default_toolchain = _chip_defaults.custom_toolchain
62 } else if (target_os == host_os) {
63 _default_toolchain = host_toolchain
64 } else if (target_os == "all") {
65 _default_toolchain = "${_pigweed_overrides.dir_pw_toolchain}/dummy"
66 } else if (target_os == "freertos") {
67 if (target_cpu == "arm") {
68 _default_toolchain = "${_build_overrides.build_root}/toolchain/arm_gcc"
70 assert(false, "Unsupported target_cpu: ${target_cpu}")
72 } else if (target_os == "android") {
73 if (current_cpu == "arm") {
75 "${_build_overrides.build_root}/toolchain/android:android_arm"
76 } else if (current_cpu == "arm64") {
78 "${_build_overrides.build_root}/toolchain/android:android_arm64"
79 } else if (current_cpu == "x64") {
81 "${_build_overrides.build_root}/toolchain/android:android_x64"
82 } else if (current_cpu == "x86") {
84 "${_build_overrides.build_root}/toolchain/android:android_x86"
86 assert(false, "Unsupported target_cpu: ${current_cpu}")
88 } else if (target_os == "ios") {
90 "${_build_overrides.build_root}/toolchain/ios:ios_${target_cpu}"
92 assert(false, "No toolchain specified, please specify custom_toolchain")
95 set_default_toolchain(_default_toolchain)
97 set_defaults("static_library") {
98 configs = _chip_defaults.default_configs
100 set_defaults("source_set") {
101 configs = _chip_defaults.default_configs
103 set_defaults("executable") {
105 _chip_defaults.default_configs + _chip_defaults.executable_default_configs
107 set_defaults("shared_library") {
108 configs = _chip_defaults.default_configs
110 set_defaults("loadable_module") {
111 configs = _chip_defaults.default_configs