Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / inet / BUILD.gn
1 # Copyright (c) 2020 Project CHIP Authors
2 #
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
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
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")
20
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")
25 import("inet.gni")
26
27 declare_args() {
28   # Extra header to include in SystemConfig.h for project.
29   chip_inet_project_config_include = ""
30 }
31
32 buildconfig_header("inet_buildconfig") {
33   header = "InetBuildConfig.h"
34   header_dir = "inet"
35
36   defines = [
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",
45   ]
46
47   if (chip_inet_project_config_include != "") {
48     defines +=
49         [ "INET_PROJECT_CONFIG_INCLUDE=${chip_inet_project_config_include}" ]
50   }
51   if (chip_inet_platform_config_include != "") {
52     defines +=
53         [ "INET_PLATFORM_CONFIG_INCLUDE=${chip_inet_platform_config_include}" ]
54   }
55 }
56
57 source_set("inet_config_header") {
58   sources = [ "InetConfig.h" ]
59
60   public_configs = [ "${chip_root}/src:includes" ]
61
62   public_deps = [
63     ":inet_buildconfig",
64     "${chip_root}/src/system:system_config_header",
65   ]
66 }
67
68 static_library("inet") {
69   output_name = "libInetLayer"
70
71   sources = [
72     "EndPointBasis.cpp",
73     "EndPointBasis.h",
74     "IANAConstants.h",
75     "IPAddress-StringFuncts.cpp",
76     "IPAddress.cpp",
77     "IPAddress.h",
78     "IPEndPointBasis.cpp",
79     "IPEndPointBasis.h",
80     "IPPrefix.cpp",
81     "IPPrefix.h",
82     "Inet.h",
83     "InetArgParser.cpp",
84     "InetArgParser.h",
85     "InetError.cpp",
86     "InetError.h",
87     "InetFaultInjection.h",
88     "InetInterface.cpp",
89     "InetInterface.h",
90     "InetLayer.cpp",
91     "InetLayer.h",
92     "InetLayerBasis.cpp",
93     "InetLayerBasis.h",
94     "InetLayerEvents.h",
95     "InetUtils.cpp",
96     "arpa-inet-compatibility.h",
97   ]
98
99   public_deps = [
100     ":inet_config_header",
101     "${chip_root}/src/lib/support",
102     "${chip_root}/src/system",
103     "${nlio_root}:nlio",
104   ]
105
106   if (chip_with_lwip) {
107     public_deps += [ "${chip_root}/src/lwip" ]
108   }
109
110   if (chip_inet_config_enable_raw_endpoint) {
111     sources += [
112       "RawEndPoint.cpp",
113       "RawEndPoint.h",
114     ]
115   }
116
117   if (chip_inet_config_enable_tcp_endpoint) {
118     sources += [
119       "TCPEndPoint.cpp",
120       "TCPEndPoint.h",
121     ]
122   }
123
124   if (chip_inet_config_enable_udp_endpoint) {
125     sources += [
126       "UDPEndPoint.cpp",
127       "UDPEndPoint.h",
128     ]
129   }
130
131   if (chip_inet_config_enable_dns_resolver) {
132     sources += [
133       "DNSResolver.cpp",
134       "DNSResolver.h",
135     ]
136   }
137
138   if (chip_inet_config_enable_async_dns_sockets) {
139     sources += [
140       "AsyncDNSResolverSockets.cpp",
141       "AsyncDNSResolverSockets.h",
142     ]
143   }
144
145   if (chip_with_nlfaultinjection) {
146     sources += [ "InetFaultInjection.cpp" ]
147     public_deps += [ "${nlfaultinjection_root}:nlfaultinjection" ]
148   }
149
150   cflags = [ "-Wconversion" ]
151
152   include_dirs = []
153   if (current_os == "android") {
154     include_dirs += [
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",
157     ]
158   }
159 }