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/lwip.gni")
18 # Default enablement for lwIP library components.
19 # This has no effect on its own; it only changes between opt-out and opt-in.
20 lwip_default = current_os != "freertos"
24 # Build IPv4 support in lwIP.
25 lwip_ipv4 = lwip_default
27 # Enable IPv6 support in lwIP.
28 lwip_ipv6 = lwip_default
30 # Enable sequential & socket API support in lwIP.
31 lwip_api = lwip_default
33 # Enable ethernet support in lwIP.
34 lwip_ethernet = lwip_default
36 # Enable SLIP interface support in lwIP.
39 # Enable 6LoWPAN support in lwIP.
40 lwip_6lowpan = lwip_default
42 # Enable PPP support in lwIP.
43 lwip_ppp = lwip_default
45 # Default enablement for lwIP application components.
46 # This has no effect on its own; it only changes between opt-out and opt-in.
47 lwip_apps_default = false
51 # Enable SNMPv2c agent application.
52 lwip_snmp = lwip_apps_default
55 lwip_httpd = lwip_apps_default
57 # Enable IPERF server.
58 lwip_iperf = lwip_apps_default
61 lwip_sntp = lwip_apps_default
63 # Enable MDNS responder.
64 lwip_mdns = lwip_apps_default
66 # Enable NetBIOS name server.
67 lwip_netbiosns = lwip_apps_default
70 lwip_tftp = lwip_apps_default
73 lwip_mqtt = lwip_apps_default
76 # Defines a lwIP build target.
78 # lwIP depends on external header files to compile. This template defines
79 # a combined build of the lwIP sources plus target configuration.
80 template("lwip_target") {
81 _lwip_root = "${lwip_root}/repo/lwip"
83 lwip_target_name = target_name
85 config("${lwip_target_name}_warnings") {
90 "-Wno-unused-variable",
91 "-Wno-maybe-uninitialized",
95 config("${lwip_target_name}_base_config") {
97 "${lwip_root}/repo/lwip/src/include",
101 # These options may have overlap with lwipopts.h, however this is harmless
102 # as long the options are the same and if they are not the same it's a
140 "LWIP_IPV4=${enable_ipv4}",
141 "LWIP_IPV6=${enable_ipv6}",
142 "LWIP_API=${enable_api}",
143 "LWIP_ETHERNET=${enable_ethernet}",
144 "LWIP_SLIP=${enable_slip}",
145 "LWIP_6LOWPAN=${enable_6lowpan}",
146 "LWIP_PPP=${enable_ppp}",
150 source_set(lwip_target_name) {
151 forward_variables_from(invoker,
159 # lwIP headers become empty if the relevant feature is disabled, so the
160 # whole interface can be public regardless of build options.
162 "${_lwip_root}/src/include/lwip/api.h",
163 "${_lwip_root}/src/include/lwip/autoip.h",
164 "${_lwip_root}/src/include/lwip/debug.h",
165 "${_lwip_root}/src/include/lwip/def.h",
166 "${_lwip_root}/src/include/lwip/dhcp.h",
167 "${_lwip_root}/src/include/lwip/dhcp6.h",
168 "${_lwip_root}/src/include/lwip/dns.h",
169 "${_lwip_root}/src/include/lwip/err.h",
170 "${_lwip_root}/src/include/lwip/etharp.h",
171 "${_lwip_root}/src/include/lwip/ethip6.h",
172 "${_lwip_root}/src/include/lwip/icmp.h",
173 "${_lwip_root}/src/include/lwip/icmp6.h",
174 "${_lwip_root}/src/include/lwip/if.h",
175 "${_lwip_root}/src/include/lwip/igmp.h",
176 "${_lwip_root}/src/include/lwip/inet.h",
177 "${_lwip_root}/src/include/lwip/inet_chksum.h",
178 "${_lwip_root}/src/include/lwip/init.h",
179 "${_lwip_root}/src/include/lwip/ip.h",
180 "${_lwip_root}/src/include/lwip/ip4_frag.h",
181 "${_lwip_root}/src/include/lwip/ip6.h",
182 "${_lwip_root}/src/include/lwip/ip6_addr.h",
183 "${_lwip_root}/src/include/lwip/ip6_frag.h",
184 "${_lwip_root}/src/include/lwip/ip6_route_table.h",
185 "${_lwip_root}/src/include/lwip/ip_addr.h",
186 "${_lwip_root}/src/include/lwip/mem.h",
187 "${_lwip_root}/src/include/lwip/memp.h",
188 "${_lwip_root}/src/include/lwip/mld6.h",
189 "${_lwip_root}/src/include/lwip/nd6.h",
190 "${_lwip_root}/src/include/lwip/netbuf.h",
191 "${_lwip_root}/src/include/lwip/netdb.h",
192 "${_lwip_root}/src/include/lwip/netif.h",
193 "${_lwip_root}/src/include/lwip/netifapi.h",
194 "${_lwip_root}/src/include/lwip/opt.h",
195 "${_lwip_root}/src/include/lwip/pbuf.h",
196 "${_lwip_root}/src/include/lwip/priv/tcp_priv.h",
197 "${_lwip_root}/src/include/lwip/priv/tcpip_priv.h",
198 "${_lwip_root}/src/include/lwip/prot/autoip.h",
199 "${_lwip_root}/src/include/lwip/prot/dhcp.h",
200 "${_lwip_root}/src/include/lwip/prot/dns.h",
201 "${_lwip_root}/src/include/lwip/prot/ethernet.h",
202 "${_lwip_root}/src/include/lwip/prot/icmp6.h",
203 "${_lwip_root}/src/include/lwip/prot/igmp.h",
204 "${_lwip_root}/src/include/lwip/prot/mld6.h",
205 "${_lwip_root}/src/include/lwip/prot/nd6.h",
206 "${_lwip_root}/src/include/lwip/raw.h",
207 "${_lwip_root}/src/include/lwip/snmp.h",
208 "${_lwip_root}/src/include/lwip/sockets.h",
209 "${_lwip_root}/src/include/lwip/stats.h",
210 "${_lwip_root}/src/include/lwip/sys.h",
211 "${_lwip_root}/src/include/lwip/tcp.h",
212 "${_lwip_root}/src/include/lwip/tcpip.h",
213 "${_lwip_root}/src/include/lwip/timeouts.h",
214 "${_lwip_root}/src/include/lwip/udp.h",
218 "${_lwip_root}/src/core/def.c",
219 "${_lwip_root}/src/core/dns.c",
220 "${_lwip_root}/src/core/inet_chksum.c",
221 "${_lwip_root}/src/core/init.c",
222 "${_lwip_root}/src/core/ip.c",
223 "${_lwip_root}/src/core/mem.c",
224 "${_lwip_root}/src/core/memp.c",
225 "${_lwip_root}/src/core/netif.c",
226 "${_lwip_root}/src/core/pbuf.c",
227 "${_lwip_root}/src/core/raw.c",
228 "${_lwip_root}/src/core/stats.c",
229 "${_lwip_root}/src/core/sys.c",
230 "${_lwip_root}/src/core/tcp.c",
231 "${_lwip_root}/src/core/tcp_in.c",
232 "${_lwip_root}/src/core/tcp_out.c",
233 "${_lwip_root}/src/core/timeouts.c",
234 "${_lwip_root}/src/core/udp.c",
235 "${_lwip_root}/src/include/lwip/priv/api_msg.h",
236 "${_lwip_root}/src/include/lwip/priv/memp_std.h",
237 "${_lwip_root}/src/include/lwip/priv/nd6_priv.h",
242 "${_lwip_root}/src/core/ipv4/autoip.c",
243 "${_lwip_root}/src/core/ipv4/dhcp.c",
244 "${_lwip_root}/src/core/ipv4/etharp.c",
245 "${_lwip_root}/src/core/ipv4/icmp.c",
246 "${_lwip_root}/src/core/ipv4/igmp.c",
247 "${_lwip_root}/src/core/ipv4/ip4.c",
248 "${_lwip_root}/src/core/ipv4/ip4_addr.c",
249 "${_lwip_root}/src/core/ipv4/ip4_frag.c",
255 "${_lwip_root}/src/core/ipv6/dhcp6.c",
256 "${_lwip_root}/src/core/ipv6/ethip6.c",
257 "${_lwip_root}/src/core/ipv6/icmp6.c",
258 "${_lwip_root}/src/core/ipv6/inet6.c",
259 "${_lwip_root}/src/core/ipv6/ip6.c",
260 "${_lwip_root}/src/core/ipv6/ip6_addr.c",
261 "${_lwip_root}/src/core/ipv6/ip6_frag.c",
262 "${_lwip_root}/src/core/ipv6/ip6_route_table.c",
263 "${_lwip_root}/src/core/ipv6/mld6.c",
264 "${_lwip_root}/src/core/ipv6/nd6.c",
270 "${_lwip_root}/src/api/api_lib.c",
271 "${_lwip_root}/src/api/api_msg.c",
272 "${_lwip_root}/src/api/err.c",
273 "${_lwip_root}/src/api/if.c",
274 "${_lwip_root}/src/api/netbuf.c",
275 "${_lwip_root}/src/api/netdb.c",
276 "${_lwip_root}/src/api/netifapi.c",
277 "${_lwip_root}/src/api/sockets.c",
278 "${_lwip_root}/src/api/tcpip.c",
283 sources += [ "${_lwip_root}/src/netif/ethernet.c" ]
287 sources += [ "${_lwip_root}/src/netif/slipif.c" ]
291 sources += [ "${_lwip_root}/src/netif/lowpan6.c" ]
294 # Relax warnings for third_party code.
295 configs += [ ":${lwip_target_name}_warnings" ]
297 public_configs += [ ":${lwip_target_name}_base_config" ]
302 template("lwip_app") {
303 app_name = target_name
305 static_library("${lwip_target_name}_${app_name}") {
306 forward_variables_from(invoker, [ "sources" ])
310 # Relax warnings for third_party code.
311 configs += [ ":${lwip_target_name}_warnings" ]
318 "${_lwip_root}/src/apps/snmp/snmp_asn1.c",
319 "${_lwip_root}/src/apps/snmp/snmp_core.c",
320 "${_lwip_root}/src/apps/snmp/snmp_mib2.c",
321 "${_lwip_root}/src/apps/snmp/snmp_mib2_icmp.c",
322 "${_lwip_root}/src/apps/snmp/snmp_mib2_interfaces.c",
323 "${_lwip_root}/src/apps/snmp/snmp_mib2_ip.c",
324 "${_lwip_root}/src/apps/snmp/snmp_mib2_snmp.c",
325 "${_lwip_root}/src/apps/snmp/snmp_mib2_system.c",
326 "${_lwip_root}/src/apps/snmp/snmp_mib2_tcp.c",
327 "${_lwip_root}/src/apps/snmp/snmp_mib2_udp.c",
328 "${_lwip_root}/src/apps/snmp/snmp_msg.c",
329 "${_lwip_root}/src/apps/snmp/snmp_netconn.c",
330 "${_lwip_root}/src/apps/snmp/snmp_pbuf_stream.c",
331 "${_lwip_root}/src/apps/snmp/snmp_raw.c",
332 "${_lwip_root}/src/apps/snmp/snmp_scalar.c",
333 "${_lwip_root}/src/apps/snmp/snmp_table.c",
334 "${_lwip_root}/src/apps/snmp/snmp_threadsync.c",
335 "${_lwip_root}/src/apps/snmp/snmp_traps.c",
336 "${_lwip_root}/src/apps/snmp/snmpv3.c",
337 "${_lwip_root}/src/apps/snmp/snmpv3_dummy.c",
338 "${_lwip_root}/src/apps/snmp/snmpv3_mbedtls.c",
342 lwip_apps += [ ":${lwip_target_name}_snmp" ]
348 "${_lwip_root}/src/apps/httpd/fs.c",
349 "${_lwip_root}/src/apps/httpd/httpd.c",
353 lwip_apps += [ ":${lwip_target_name}_httpd" ]
357 lwip_app("lwiperf") {
358 sources = [ "${_lwip_root}/src/apps/lwiperf/lwiperf.c" ]
361 lwip_apps += [ ":${lwip_target_name}_lwiperf" ]
366 sources = [ "${_lwip_root}/src/apps/sntp/sntp.c" ]
369 lwip_apps += [ ":${lwip_target_name}_sntp" ]
374 sources = [ "${_lwip_root}/src/apps/mdns/mdns.c" ]
377 lwip_apps += [ ":${lwip_target_name}_mdns" ]
380 if (lwip_netbiosns) {
381 lwip_app("netbiosns") {
382 sources = [ "${_lwip_root}/src/apps/netbiosns/netbiosns.c" ]
385 lwip_apps += [ ":${lwip_target_name}_netbiosns" ]
390 sources = [ "${_lwip_root}/src/apps/tftp/tftp_server.c" ]
393 lwip_apps += [ ":${lwip_target_name}_tftp" ]
398 sources = [ "${_lwip_root}/src/apps/mqtt/mqtt.c" ]
401 lwip_apps += [ ":${lwip_target_name}_mqtt" ]
404 group("${lwip_target_name}_apps") {
408 group("${lwip_target_name}_all") {
410 ":${lwip_target_name}",
411 ":${lwip_target_name}_apps",