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.
17 import("//build_overrides/chip.gni")
18 import("//build_overrides/mbedtls.gni")
19 import("//build_overrides/nlassert.gni")
20 import("//build_overrides/nlio.gni")
21 import("//build_overrides/nlunit_test.gni")
22 import("//build_overrides/pigweed.gni")
24 # This build file should not be used in superproject builds.
25 assert(chip_root == "//")
27 import("${chip_root}/build/chip/tests.gni")
28 import("${chip_root}/build/chip/tools.gni")
30 if (current_toolchain != "${dir_pw_toolchain}/dummy:dummy") {
32 chip_enable_python_modules = false
35 # This is a real toolchain. Build CHIP.
42 "${chip_root}/src/app",
43 "${chip_root}/src/ble",
44 "${chip_root}/src/controller",
45 "${chip_root}/src/crypto",
46 "${chip_root}/src/inet",
47 "${chip_root}/src/lib",
48 "${chip_root}/src/lib/asn1",
49 "${chip_root}/src/lib/core",
50 "${chip_root}/src/lib/shell",
51 "${chip_root}/src/lib/support",
52 "${chip_root}/src/lwip:all",
53 "${chip_root}/src/messaging",
54 "${chip_root}/src/protocols",
55 "${chip_root}/src/setup_payload",
56 "${chip_root}/src/system",
57 "${chip_root}/src/transport",
58 "${mbedtls_root}:mbedtls",
59 "${nlassert_root}:nlassert",
61 "${nlunit_test_root}:nlunit-test",
64 if (chip_build_tests) {
65 deps += [ "//src:tests" ]
68 if (chip_build_tools) {
70 "${chip_root}/examples/shell/standalone:chip-shell",
71 "${chip_root}/src/qrcodetool",
72 "${chip_root}/src/setup_payload",
74 if (chip_enable_python_modules) {
75 deps += [ "${chip_root}/src/controller/python" ]
79 if (current_os == "android") {
81 "${chip_root}/src/controller/java",
82 "${chip_root}/src/setup_payload/java",
87 "${chip_root}/examples/all-clusters-app/linux",
88 "${chip_root}/examples/lighting-app/linux",
89 "${chip_root}/examples/chip-tool",
90 "${chip_root}/examples/minimal-mdns:minimal-mdns-client",
91 "${chip_root}/examples/minimal-mdns:minimal-mdns-server",
92 "${chip_root}/examples/minimal-mdns:mdns-advertiser",
97 if (chip_link_tests) {
98 deps = [ "//src:tests_run" ]
102 # We don't always want to run happy tests, make them a seperate group.
103 if (chip_enable_happy_tests) {
104 group("happy_tests") {
105 if (chip_link_tests) {
106 deps = [ "//src:happy_tests" ]
111 # This is the unified build. Configure various real toolchains.
112 import("${chip_root}/build/chip/chip_build.gni")
114 # Set this to false to disable all builds by default.
115 enable_default_builds = true
117 # Enable building for Android.
118 enable_android_builds = false
120 # Set this to true to enable efr32 builds by default.
121 enable_efr32_builds = false
123 # Set this to true to enable qpg6100 builds by default.
124 enable_qpg6100_builds = false
126 # Set this to true to enable k32w builds by default.
127 enable_k32w_builds = false
131 # Enable building chip with clang.
132 enable_host_clang_build = enable_default_builds
134 # Enable building chip with gcc.
135 enable_host_gcc_build = enable_default_builds
137 # Enable building chip with gcc & mbedtls.
138 enable_host_gcc_mbedtls_build = enable_default_builds
140 # Build the chip-tool example.
141 enable_standalone_chip_tool_build = enable_default_builds
143 # Build the shell example.
144 enable_standalone_shell_build = enable_default_builds
146 # Build the Linux all clusters app example.
147 enable_linux_all_clusters_app_build =
148 enable_default_builds && host_os == "linux"
150 # Build the Linux lighting app example.
151 enable_linux_lighting_app_build =
152 enable_default_builds && host_os == "linux"
154 # Build the efr32 lock app example.
155 enable_efr32_lock_app_build = enable_efr32_builds
157 # Build the qpg6100 lock app example.
158 enable_qpg6100_lock_app_build = enable_qpg6100_builds
160 # Build the efr32 lighting app example.
161 enable_efr32_lighting_app_build = enable_efr32_builds
163 # Build the k32w lock app example.
164 enable_k32w_lock_app_build = enable_k32w_builds
167 if (enable_host_clang_build) {
168 chip_build("host_clang") {
169 toolchain = "//build/toolchain/host:${host_os}_${host_cpu}_clang"
173 if (enable_host_gcc_build) {
174 chip_build("host_gcc") {
175 toolchain = "//build/toolchain/host:${host_os}_${host_cpu}_gcc"
179 if (enable_host_gcc_mbedtls_build) {
180 chip_build("host_gcc_mbedtls") {
181 toolchain = "${chip_root}/config/mbedtls/toolchain:${host_os}_${host_cpu}_gcc_mbedtls"
185 if (enable_android_builds) {
186 chip_build("android_arm") {
187 toolchain = "//build/toolchain/android:android_arm"
190 chip_build("android_arm64") {
191 toolchain = "//build/toolchain/android:android_arm64"
194 chip_build("android_x64") {
195 toolchain = "//build/toolchain/android:android_x64"
198 chip_build("android_x86") {
199 toolchain = "//build/toolchain/android:android_x86"
203 standalone_toolchain = "${chip_root}/config/standalone/toolchain:standalone"
205 if (enable_standalone_chip_tool_build) {
206 group("standalone_chip_tool") {
207 deps = [ "${chip_root}/examples/chip-tool(${standalone_toolchain})" ]
211 if (enable_standalone_shell_build) {
212 group("standalone_shell") {
214 [ "${chip_root}/examples/shell/standalone(${standalone_toolchain})" ]
218 if (enable_linux_all_clusters_app_build) {
219 group("linux_all_clusters_app") {
221 "${chip_root}/examples/all-clusters-app/linux(${standalone_toolchain})",
226 if (enable_linux_lighting_app_build) {
227 group("linux_lighting_app") {
229 "${chip_root}/examples/lighting-app/linux(${standalone_toolchain})",
234 if (enable_efr32_lock_app_build) {
235 group("efr32_lock_app") {
236 deps = [ "${chip_root}/examples/lock-app/efr32(${chip_root}/config/efr32/toolchain:efr32_lock_app)" ]
240 if (enable_qpg6100_lock_app_build) {
241 group("qpg6100_lock_app") {
242 deps = [ "${chip_root}/examples/lock-app/qpg6100(${chip_root}/config/qpg6100/toolchain:qpg6100_lock_app)" ]
246 if (enable_efr32_lighting_app_build) {
247 group("efr32_lighting_app") {
248 deps = [ "${chip_root}/examples/lighting-app/efr32(${chip_root}/config/efr32/toolchain:efr32_lighting_app)" ]
252 if (enable_k32w_lock_app_build) {
253 group("k32w_lock_app") {
254 deps = [ "${chip_root}/examples/lock-app/k32w(${chip_root}/config/k32w/toolchain:k32w_lock_app)" ]
260 if (enable_host_clang_build) {
261 deps += [ ":all_host_clang" ]
263 if (enable_host_gcc_build) {
264 deps += [ ":all_host_gcc" ]
266 if (enable_host_gcc_mbedtls_build) {
267 deps += [ ":all_host_gcc_mbedtls" ]
269 if (enable_android_builds) {
272 ":all_android_arm64",
277 if (enable_standalone_chip_tool_build) {
278 deps += [ ":standalone_chip_tool" ]
280 if (enable_standalone_shell_build) {
281 deps += [ ":standalone_shell" ]
283 if (enable_linux_all_clusters_app_build) {
284 deps += [ ":linux_all_clusters_app" ]
286 if (enable_linux_lighting_app_build) {
287 deps += [ ":linux_lighting_app" ]
289 if (enable_efr32_lock_app_build) {
290 deps += [ ":efr32_lock_app" ]
292 if (enable_k32w_lock_app_build) {
293 deps += [ ":k32w_lock_app" ]
299 if (enable_host_clang_build) {
300 deps += [ ":check_host_clang" ]
302 if (enable_host_gcc_build) {
303 deps += [ ":check_host_gcc" ]
305 if (enable_host_gcc_mbedtls_build) {
306 deps += [ ":check_host_gcc_mbedtls" ]