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.
15 import("//build_overrides/build.gni")
16 import("//build_overrides/chip.gni")
17 import("//build_overrides/lwip.gni")
19 import("${chip_root}/build/chip/buildconfig_header.gni")
20 import("${chip_root}/src/lwip/lwip.gni")
21 import("${lwip_root}/lwip.gni")
23 assert(chip_with_lwip)
25 if (lwip_platform == "") {
26 if (current_os != "freertos") {
27 lwip_platform = "standalone"
31 assert(lwip_platform == "external" || lwip_platform == "standalone" ||
32 lwip_platform == "cc13x2_26x2" || lwip_platform == "efr32" ||
33 lwip_platform == "k32w" || lwip_platform == "qpg6100",
34 "Unsupported lwIP platform: ${lwip_platform}")
36 if (lwip_platform != "external") {
38 # Enable lwIP debugging.
43 if (lwip_platform == "cc13x2_26x2") {
44 import("//build_overrides/ti_simplelink_sdk.gni")
45 } else if (lwip_platform == "efr32") {
46 import("//build_overrides/efr32_sdk.gni")
47 } else if (lwip_platform == "qpg6100") {
48 import("//build_overrides/qpg6100_sdk.gni")
49 } else if (lwip_platform == "k32w") {
50 import("//build_overrides/k32w_sdk.gni")
53 buildconfig_header("lwip_buildconfig") {
54 header = "lwip_buildconfig.h"
57 defines = [ "HAVE_LWIP_UDP_BIND_NETIF=1" ]
58 if (lwip_platform != "external") {
60 # Automatically enable LWIP_DEBUG for internal is_debug builds.
61 defines += [ "LWIP_DEBUG=1" ]
64 if (current_os == "android") {
65 defines += [ "LWIP_NO_STDINT_H=1" ]
70 if (current_os == "zephyr") {
73 } else if (lwip_platform == "external") {
75 public_deps = [ ":lwip_buildconfig" ]
82 config("lwip_config") {
83 include_dirs = [ lwip_platform ]
85 if (lwip_platform != "standalone") {
86 include_dirs += [ "freertos" ]
92 "${lwip_platform}/arch/cc.h",
93 "${lwip_platform}/arch/perf.h",
94 "${lwip_platform}/lwipopts.h",
99 if (lwip_platform == "standalone") {
100 public += [ "standalone/arch/sys_arch.h" ]
101 sources += [ "standalone/sys_arch.c" ]
104 "${lwip_platform}/lwippools.h",
105 "freertos/arch/sys_arch.h",
107 sources += [ "freertos/sys_arch.c" ]
110 public_deps = [ ":lwip_buildconfig" ]
111 if (lwip_platform == "cc13x2_26x2") {
112 public_deps += [ "${ti_simplelink_sdk_build_root}:ti_simplelink_sdk" ]
113 } else if (lwip_platform == "efr32") {
114 public_deps += [ "${efr32_sdk_build_root}:efr32_sdk" ]
115 } else if (lwip_platform == "qpg6100") {
116 public_deps += [ "${qpg6100_sdk_build_root}:qpg6100_sdk" ]
117 } else if (lwip_platform == "standalone") {
118 public_deps += [ "${chip_root}/src/lib/support" ]
119 } else if (lwip_platform == "k32w") {
120 public_deps += [ "${k32w_sdk_build_root}:k32w_sdk" ]
125 "${chip_root}/src:includes",
129 deps = [ ":lwip_all" ]