blob: ba7e4acfadb08aed9b1027c0476238cdb96f047b [file] [log] [blame]
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/chip.gni")
import("//build_overrides/nlassert.gni")
import("//build_overrides/nlfaultinjection.gni")
import("//build_overrides/nlio.gni")
import("${chip_root}/gn/chip/tests.gni")
import("inet.gni")
declare_args() {
# Extra header to include in SystemConfig.h for project.
inet_project_config_include = ""
# Extra header to include in SystemConfig.h for platform.
inet_platform_config_include = ""
}
config("inet_config") {
configs = [ "${chip_root}/src:includes" ]
defines = []
if (inet_project_config_include != "") {
defines += [ "INET_PROJECT_CONFIG_INCLUDE=${inet_project_config_include}" ]
}
if (inet_platform_config_include != "") {
defines +=
[ "INET_PLATFORM_CONFIG_INCLUDE=${inet_platform_config_include}" ]
}
if (chip_build_tests) {
defines += [ "INET_CONFIG_TEST=1" ]
} else {
defines += [ "INET_CONFIG_TEST=0" ]
}
if (inet_config_enable_ipv4) {
defines += [ "INET_CONFIG_ENABLE_IPV4=1" ]
} else {
defines += [ "INET_CONFIG_ENABLE_IPV4=0" ]
}
if (inet_config_enable_dns_resolver) {
defines += [ "INET_CONFIG_ENABLE_DNS_RESOLVER=1" ]
} else {
defines += [ "INET_CONFIG_ENABLE_DNS_RESOLVER=0" ]
}
if (inet_config_enable_async_dns_sockets) {
defines += [ "INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS=1" ]
} else {
defines += [ "INET_CONFIG_ENABLE_ASYNC_DNS_SOCKETS=0" ]
}
if (inet_config_enable_raw_endpoint) {
defines += [ "INET_CONFIG_ENABLE_RAW_ENDPOINT=1" ]
} else {
defines += [ "INET_CONFIG_ENABLE_RAW_ENDPOINT=0" ]
}
if (inet_config_enable_tcp_endpoint) {
defines += [ "INET_CONFIG_ENABLE_TCP_ENDPOINT=1" ]
} else {
defines += [ "INET_CONFIG_ENABLE_TCP_ENDPOINT=0" ]
}
if (inet_config_enable_tun_endpoint) {
defines += [ "INET_CONFIG_ENABLE_TUN_ENDPOINT=1" ]
} else {
defines += [ "INET_CONFIG_ENABLE_TUN_ENDPOINT=0" ]
}
if (inet_config_enable_udp_endpoint) {
defines += [ "INET_CONFIG_ENABLE_UDP_ENDPOINT=1" ]
} else {
assert(false, "CHIP currently request UDP endpoint")
}
}
source_set("inet_config_header") {
sources = [ "InetConfig.h" ]
public_configs = [ ":inet_config" ]
public_deps = [ "${chip_root}/src/system:system_config_header" ]
}
static_library("inet") {
output_name = "libInetLayer"
sources = [
"EndPointBasis.cpp",
"EndPointBasis.h",
"IANAConstants.h",
"IPAddress-StringFuncts.cpp",
"IPAddress.cpp",
"IPAddress.h",
"IPEndPointBasis.cpp",
"IPEndPointBasis.h",
"IPPrefix.cpp",
"IPPrefix.h",
"Inet.h",
"InetArgParser.cpp",
"InetArgParser.h",
"InetError.cpp",
"InetError.h",
"InetFaultInjection.h",
"InetInterface.cpp",
"InetInterface.h",
"InetLayer.cpp",
"InetLayer.h",
"InetLayerBasis.cpp",
"InetLayerBasis.h",
"InetLayerEvents.h",
"InetUtils.cpp",
"RawEndPoint.cpp",
"RawEndPoint.h",
"TCPEndPoint.cpp",
"TCPEndPoint.h",
"UDPEndPoint.cpp",
"UDPEndPoint.h",
"arpa-inet-compatibility.h",
]
public_deps = [
":inet_config_header",
"${chip_root}/src/lib/support",
"${chip_root}/src/system",
"${nlio_root}:nlio",
]
if (inet_config_enable_dns_resolver) {
sources += [
"DNSResolver.cpp",
"DNSResolver.h",
]
}
if (inet_config_enable_async_dns_sockets) {
sources += [
"AsyncDNSResolverSockets.cpp",
"AsyncDNSResolverSockets.h",
]
}
if (inet_config_enable_tun_endpoint) {
sources += [
"TunEndPoint.cpp",
"TunEndPoint.h",
]
}
if (chip_with_nlfaultinjection) {
sources += [ "InetFaultInjection.cpp" ]
public_deps += [ "${nlfaultinjection_root}:nlfaultinjection" ]
}
}