| # Copyright (c) 2020-2021 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/build.gni") |
| import("//build_overrides/chip.gni") |
| import("//build_overrides/nlassert.gni") |
| import("//build_overrides/nlfaultinjection.gni") |
| import("//build_overrides/nlio.gni") |
| |
| import("${chip_root}/build/chip/buildconfig_header.gni") |
| import("${chip_root}/build/chip/tests.gni") |
| import("${chip_root}/src/lwip/lwip.gni") |
| import("${chip_root}/src/platform/device.gni") |
| import("inet.gni") |
| |
| if (chip_system_config_use_open_thread_udp) { |
| import("//build_overrides/openthread.gni") |
| } |
| |
| declare_args() { |
| # Extra header to include in SystemConfig.h for project. |
| chip_inet_project_config_include = "" |
| } |
| |
| buildconfig_header("inet_buildconfig") { |
| header = "InetBuildConfig.h" |
| header_dir = "inet" |
| |
| defines = [ |
| "INET_CONFIG_TEST=${chip_build_tests}", |
| "INET_CONFIG_ENABLE_IPV4=${chip_inet_config_enable_ipv4}", |
| "INET_CONFIG_ENABLE_TCP_ENDPOINT=${chip_inet_config_enable_tcp_endpoint}", |
| "INET_CONFIG_ENABLE_UDP_ENDPOINT=${chip_inet_config_enable_udp_endpoint}", |
| "HAVE_LWIP_RAW_BIND_NETIF=true", |
| ] |
| |
| if (chip_inet_project_config_include != "") { |
| defines += |
| [ "INET_PROJECT_CONFIG_INCLUDE=${chip_inet_project_config_include}" ] |
| } |
| if (chip_inet_platform_config_include != "") { |
| defines += |
| [ "INET_PLATFORM_CONFIG_INCLUDE=${chip_inet_platform_config_include}" ] |
| } |
| |
| defines += [ "INET_TCP_END_POINT_IMPL_CONFIG_FILE=<inet/TCPEndPointImpl${chip_system_config_inet}.h>" ] |
| if (chip_system_config_use_open_thread_udp) { |
| defines += [ |
| "INET_UDP_END_POINT_IMPL_CONFIG_FILE=<inet/UDPEndPointImpl_OpenThread.h>", |
| ] |
| } else { |
| defines += [ "INET_UDP_END_POINT_IMPL_CONFIG_FILE=<inet/UDPEndPointImpl${chip_system_config_inet}.h>" ] |
| } |
| } |
| |
| source_set("inet_config_header") { |
| sources = [ "InetConfig.h" ] |
| |
| public_configs = [ "${chip_root}/src:includes" ] |
| |
| public_deps = [ |
| ":inet_buildconfig", |
| "${chip_root}/src/system:system_config_header", |
| ] |
| } |
| |
| static_library("inet") { |
| output_name = "libInetLayer" |
| |
| sources = [ |
| "EndPointBasis.h", |
| "EndPointState${chip_system_config_inet}.h", |
| "IANAConstants.h", |
| "IPAddress-StringFuncts.cpp", |
| "IPAddress.cpp", |
| "IPAddress.h", |
| "IPPacketInfo.cpp", |
| "IPPacketInfo.h", |
| "IPPrefix.cpp", |
| "IPPrefix.h", |
| "Inet.h", |
| "InetArgParser.cpp", |
| "InetArgParser.h", |
| "InetError.cpp", |
| "InetError.h", |
| "InetFaultInjection.h", |
| "InetInterface.cpp", |
| "InetInterface.h", |
| "InetLayer.h", |
| "arpa-inet-compatibility.h", |
| ] |
| |
| public_deps = [ |
| ":inet_config_header", |
| "${chip_root}/src/lib/support", |
| "${chip_root}/src/platform:platform_buildconfig", |
| "${chip_root}/src/system", |
| "${nlio_root}:nlio", |
| ] |
| |
| if (chip_system_config_use_lwip) { |
| public_deps += [ "${chip_root}/src/lwip" ] |
| } |
| |
| if (chip_system_config_use_open_thread_udp) { |
| if (chip_openthread_ftd) { |
| public_deps += |
| [ "${chip_root}/third_party/openthread/repo:libopenthread-ftd" ] |
| } else { |
| public_deps += |
| [ "${chip_root}/third_party/openthread/repo:libopenthread-mtd" ] |
| } |
| } |
| |
| if (chip_inet_config_enable_tcp_endpoint) { |
| sources += [ |
| "TCPEndPoint.cpp", |
| "TCPEndPoint.h", |
| "TCPEndPointImpl${chip_system_config_inet}.cpp", |
| "TCPEndPointImpl${chip_system_config_inet}.h", |
| "TCPEndPointImpl.h", |
| ] |
| } |
| |
| if (chip_inet_config_enable_udp_endpoint) { |
| sources += [ |
| "UDPEndPoint.cpp", |
| "UDPEndPoint.h", |
| "UDPEndPointImpl.h", |
| ] |
| |
| if (chip_system_config_use_open_thread_udp) { |
| sources += [ |
| "UDPEndPointImpl_OpenThread.cpp", |
| "UDPEndPointImpl_OpenThread.h", |
| ] |
| } else { |
| sources += [ |
| "UDPEndPointImpl${chip_system_config_inet}.cpp", |
| "UDPEndPointImpl${chip_system_config_inet}.h", |
| ] |
| } |
| } |
| |
| if (chip_with_nlfaultinjection) { |
| sources += [ "InetFaultInjection.cpp" ] |
| public_deps += [ "${nlfaultinjection_root}:nlfaultinjection" ] |
| } |
| |
| cflags = [ "-Wconversion" ] |
| |
| include_dirs = [] |
| if (current_os == "android") { |
| include_dirs += [ |
| "${chip_root}/third_party/android/platform-libcore/android-platform-libcore/luni/src/main/native", |
| "${chip_root}/third_party/android/platform-libcore/android-platform-libcore/include", |
| ] |
| } |
| } |