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/nlassert.gni")
18 import("//build_overrides/nlfaultinjection.gni")
19 import("//build_overrides/nlio.gni")
21 import("${chip_root}/build/chip/buildconfig_header.gni")
22 import("${chip_root}/build/chip/tests.gni")
23 import("${chip_root}/src/lwip/lwip.gni")
24 import("${chip_root}/src/platform/device.gni")
28 # Extra header to include in SystemConfig.h for project.
29 chip_inet_project_config_include = ""
32 buildconfig_header("inet_buildconfig") {
33 header = "InetBuildConfig.h"
37 "INET_CONFIG_TEST=${chip_build_tests}",
38 "INET_CONFIG_ENABLE_IPV4=${chip_inet_config_enable_ipv4}",
39 "INET_CONFIG_ENABLE_DNS_RESOLVER=${chip_inet_config_enable_dns_resolver}",
40 "INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS=${chip_inet_config_enable_async_dns_sockets}",
41 "INET_CONFIG_ENABLE_RAW_ENDPOINT=${chip_inet_config_enable_raw_endpoint}",
42 "INET_CONFIG_ENABLE_TCP_ENDPOINT=${chip_inet_config_enable_tcp_endpoint}",
43 "INET_CONFIG_ENABLE_UDP_ENDPOINT=${chip_inet_config_enable_udp_endpoint}",
44 "HAVE_LWIP_RAW_BIND_NETIF=true",
47 if (chip_inet_project_config_include != "") {
49 [ "INET_PROJECT_CONFIG_INCLUDE=${chip_inet_project_config_include}" ]
51 if (chip_inet_platform_config_include != "") {
53 [ "INET_PLATFORM_CONFIG_INCLUDE=${chip_inet_platform_config_include}" ]
57 source_set("inet_config_header") {
58 sources = [ "InetConfig.h" ]
60 public_configs = [ "${chip_root}/src:includes" ]
64 "${chip_root}/src/system:system_config_header",
68 static_library("inet") {
69 output_name = "libInetLayer"
75 "IPAddress-StringFuncts.cpp",
78 "IPEndPointBasis.cpp",
87 "InetFaultInjection.h",
96 "arpa-inet-compatibility.h",
100 ":inet_config_header",
101 "${chip_root}/src/lib/support",
102 "${chip_root}/src/system",
106 if (chip_with_lwip) {
107 public_deps += [ "${chip_root}/src/lwip" ]
110 if (chip_inet_config_enable_raw_endpoint) {
117 if (chip_inet_config_enable_tcp_endpoint) {
124 if (chip_inet_config_enable_udp_endpoint) {
131 if (chip_inet_config_enable_dns_resolver) {
138 if (chip_inet_config_enable_async_dns_sockets) {
140 "AsyncDNSResolverSockets.cpp",
141 "AsyncDNSResolverSockets.h",
145 if (chip_with_nlfaultinjection) {
146 sources += [ "InetFaultInjection.cpp" ]
147 public_deps += [ "${nlfaultinjection_root}:nlfaultinjection" ]
150 cflags = [ "-Wconversion" ]
153 if (current_os == "android") {
155 "${chip_root}/third_party/android/platform-libcore/android-platform-libcore/luni/src/main/native",
156 "${chip_root}/third_party/android/platform-libcore/android-platform-libcore/include",