[build] update GN build file for OpenThread (#5358)

Add the CLI & configuration to the build file.
This commit is contained in:
Michael Spang 2020-08-12 13:27:52 -04:00 committed by GitHub
parent 7dc3b2696a
commit a24737a2ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1440 additions and 196 deletions

2
.gn
View File

@ -1 +1,3 @@
buildconfig = "//third_party/build_gn/BUILDCONFIG.gn"
check_system_includes = true

256
BUILD.gn
View File

@ -25,204 +25,72 @@
# POSSIBILITY OF SUCH DAMAGE.
#
static_library("lib-ot-core") {
import("etc/gn/openthread.gni")
cflags_cc = [ "-Wno-non-virtual-dtor" ]
config("openthread_config") {
if (openthread_config_file != "") {
defines += [ "OPENTHREAD_CONFIG_FILE=${openthread_config_file}" ]
}
sources = [
"src/core/api/backbone_router_api.cpp",
"src/core/api/backbone_router_ftd_api.cpp",
"src/core/api/border_agent_api.cpp",
"src/core/api/border_router_api.cpp",
"src/core/api/channel_manager_api.cpp",
"src/core/api/channel_monitor_api.cpp",
"src/core/api/child_supervision_api.cpp",
"src/core/api/coap_api.cpp",
"src/core/api/coap_secure_api.cpp",
"src/core/api/commissioner_api.cpp",
"src/core/api/crypto_api.cpp",
"src/core/api/dataset_api.cpp",
"src/core/api/dataset_ftd_api.cpp",
"src/core/api/diags_api.cpp",
"src/core/api/dns_api.cpp",
"src/core/api/entropy_api.cpp",
"src/core/api/heap_api.cpp",
"src/core/api/icmp6_api.cpp",
"src/core/api/instance_api.cpp",
"src/core/api/ip6_api.cpp",
"src/core/api/jam_detection_api.cpp",
"src/core/api/joiner_api.cpp",
"src/core/api/link_api.cpp",
"src/core/api/link_raw_api.cpp",
"src/core/api/logging_api.cpp",
"src/core/api/message_api.cpp",
"src/core/api/netdata_api.cpp",
"src/core/api/network_time_api.cpp",
"src/core/api/random_crypto_api.cpp",
"src/core/api/random_noncrypto_api.cpp",
"src/core/api/server_api.cpp",
"src/core/api/sntp_api.cpp",
"src/core/api/tasklet_api.cpp",
"src/core/api/thread_api.cpp",
"src/core/api/thread_ftd_api.cpp",
"src/core/api/udp_api.cpp",
"src/core/backbone_router/bbr_leader.cpp",
"src/core/backbone_router/bbr_local.cpp",
"src/core/backbone_router/bbr_manager.cpp",
"src/core/coap/coap.cpp",
"src/core/coap/coap_message.cpp",
"src/core/coap/coap_secure.cpp",
"src/core/common/crc16.cpp",
"src/core/common/extension_example.cpp",
"src/core/common/instance.cpp",
"src/core/common/logging.cpp",
"src/core/common/message.cpp",
"src/core/common/notifier.cpp",
"src/core/common/random_manager.cpp",
"src/core/common/settings.cpp",
"src/core/common/string.cpp",
"src/core/common/tasklet.cpp",
"src/core/common/timer.cpp",
"src/core/common/tlvs.cpp",
"src/core/common/trickle_timer.cpp",
"src/core/crypto/aes_ccm.cpp",
"src/core/crypto/aes_ecb.cpp",
"src/core/crypto/ecdsa.cpp",
"src/core/crypto/hmac_sha256.cpp",
"src/core/crypto/mbedtls.cpp",
"src/core/crypto/pbkdf2_cmac.cpp",
"src/core/crypto/sha256.cpp",
"src/core/diags/factory_diags.cpp",
"src/core/mac/channel_mask.cpp",
"src/core/mac/data_poll_handler.cpp",
"src/core/mac/data_poll_sender.cpp",
"src/core/mac/link_raw.cpp",
"src/core/mac/mac.cpp",
"src/core/mac/mac_filter.cpp",
"src/core/mac/mac_frame.cpp",
"src/core/mac/mac_types.cpp",
"src/core/mac/sub_mac_callbacks.cpp",
"src/core/mac/sub_mac.cpp",
"src/core/meshcop/announce_begin_client.cpp",
"src/core/meshcop/border_agent.cpp",
"src/core/meshcop/commissioner.cpp",
"src/core/meshcop/dataset.cpp",
"src/core/meshcop/dataset_local.cpp",
"src/core/meshcop/dataset_manager.cpp",
"src/core/meshcop/dataset_manager_ftd.cpp",
"src/core/meshcop/dtls.cpp",
"src/core/meshcop/energy_scan_client.cpp",
"src/core/meshcop/joiner.cpp",
"src/core/meshcop/joiner_router.cpp",
"src/core/meshcop/meshcop.cpp",
"src/core/meshcop/meshcop_leader.cpp",
"src/core/meshcop/meshcop_tlvs.cpp",
"src/core/meshcop/panid_query_client.cpp",
"src/core/meshcop/timestamp.cpp",
"src/core/net/dhcp6_client.cpp",
"src/core/net/dhcp6_server.cpp",
"src/core/net/dns_client.cpp",
"src/core/net/icmp6.cpp",
"src/core/net/ip6_address.cpp",
"src/core/net/ip6.cpp",
"src/core/net/ip6_filter.cpp",
"src/core/net/ip6_headers.cpp",
"src/core/net/ip6_mpl.cpp",
"src/core/net/netif.cpp",
"src/core/net/sntp_client.cpp",
"src/core/net/udp6.cpp",
"src/core/radio/radio_callbacks.cpp",
"src/core/radio/radio_platform.cpp",
"src/core/thread/address_resolver.cpp",
"src/core/thread/announce_begin_server.cpp",
"src/core/thread/announce_sender.cpp",
"src/core/thread/child_table.cpp",
"src/core/thread/discover_scanner.cpp",
"src/core/thread/dua_manager.cpp",
"src/core/thread/energy_scan_server.cpp",
"src/core/thread/indirect_sender.cpp",
"src/core/thread/key_manager.cpp",
"src/core/thread/link_quality.cpp",
"src/core/thread/lowpan.cpp",
"src/core/thread/mesh_forwarder.cpp",
"src/core/thread/mesh_forwarder_ftd.cpp",
"src/core/thread/mesh_forwarder_mtd.cpp",
"src/core/thread/mle.cpp",
"src/core/thread/mle_router.cpp",
"src/core/thread/mle_types.cpp",
"src/core/thread/mlr_manager.cpp",
"src/core/thread/neighbor_table.cpp",
"src/core/thread/network_data.cpp",
"src/core/thread/network_data_leader.cpp",
"src/core/thread/network_data_leader_ftd.cpp",
"src/core/thread/network_data_local.cpp",
"src/core/thread/network_data_notifier.cpp",
"src/core/thread/network_diagnostic.cpp",
"src/core/thread/panid_query_server.cpp",
"src/core/thread/router_table.cpp",
"src/core/thread/src_match_controller.cpp",
"src/core/thread/thread_netif.cpp",
"src/core/thread/time_sync_service.cpp",
"src/core/thread/topology.cpp",
"src/core/utils/channel_manager.cpp",
"src/core/utils/channel_monitor.cpp",
"src/core/utils/child_supervision.cpp",
"src/core/utils/heap.cpp",
"src/core/utils/jam_detector.cpp",
"src/core/utils/parse_cmdline.cpp",
"src/core/utils/slaac_address.cpp",
"src/lib/hdlc/hdlc.cpp",
"src/lib/spinel/spinel.c",
"src/lib/spinel/spinel_decoder.cpp",
"src/lib/spinel/spinel_encoder.cpp",
"third_party/mbedtls/repo/library/md.c",
"third_party/mbedtls/repo/library/md_wrap.c",
"third_party/mbedtls/repo/library/memory_buffer_alloc.c",
"third_party/mbedtls/repo/library/platform.c",
"third_party/mbedtls/repo/library/platform_util.c",
"third_party/mbedtls/repo/library/sha256.c",
"third_party/mbedtls/repo/library/bignum.c",
"third_party/mbedtls/repo/library/ccm.c",
"third_party/mbedtls/repo/library/cipher.c",
"third_party/mbedtls/repo/library/cipher_wrap.c",
"third_party/mbedtls/repo/library/cmac.c",
"third_party/mbedtls/repo/library/ctr_drbg.c",
"third_party/mbedtls/repo/library/debug.c",
"third_party/mbedtls/repo/library/ecjpake.c",
"third_party/mbedtls/repo/library/ecp_curves.c",
"third_party/mbedtls/repo/library/entropy.c",
"third_party/mbedtls/repo/library/entropy_poll.c",
"third_party/mbedtls/repo/library/ssl_cookie.c",
"third_party/mbedtls/repo/library/ssl_ciphersuites.c",
"third_party/mbedtls/repo/library/ssl_cli.c",
"third_party/mbedtls/repo/library/ssl_srv.c",
"third_party/mbedtls/repo/library/ssl_ticket.c",
"third_party/mbedtls/repo/library/ssl_tls.c",
"third_party/mbedtls/repo/library/aes.c",
"third_party/mbedtls/repo/library/ecp.c"
]
include_dirs = openthread_project_include_dirs
# Remove the example as it is not meant for compilation
sources -= [
"src/core/common/extension_example.cpp",
]
include_dirs = [
include_dirs += [
"${root_gen_dir}/include",
"include",
"src",
"src/core",
"src/ncp",
"third_party",
"third_party/mbedtls",
"third_party/mbedtls/repo/include"
]
defines = [
"MBEDTLS_CONFIG_FILE=\"mbedtls-config.h\"",
"OPENTHREAD_FTD=1",
"SPINEL_PLATFORM_HEADER=\"spinel_platform.h\"",
"OPENTHREAD_CONFIG_FILE=<openthread-config-android.h>",
"PACKAGE_NAME=\"OPENTHREAD-CORE\"",
"PACKAGE_VERSION=\"1.0.0\""
]
cflags_cc = [ "-Wno-non-virtual-dtor" ]
}
config("openthread_ftd_config") {
defines = [ "OPENTHREAD_FTD=1" ]
}
config("openthread_mtd_config") {
defines = [ "OPENTHREAD_MTD=1" ]
}
config("openthread_radio_config") {
defines = [ "OPENTHREAD_RADIO=1" ]
}
group("libopenthread-ftd") {
public_deps = [ "include/openthread" ]
deps = [ "src/core:libopenthread-ftd" ]
}
group("libopenthread-mtd") {
public_deps = [ "include/openthread" ]
deps = [ "src/core:libopenthread-mtd" ]
}
group("libopenthread-radio") {
public_deps = [ "include/openthread" ]
deps = [ "src/core:libopenthread-radio" ]
}
group("libopenthread-cli-ftd") {
public_deps = [ "include/openthread" ]
deps = [ "src/cli:libopenthread-cli-ftd" ]
}
group("libopenthread-cli-mtd") {
public_deps = [ "include/openthread" ]
deps = [ "src/cli:libopenthread-cli-mtd" ]
}
group("libopenthread-spinel-ncp") {
public_deps = [ "src/lib/spinel:spinel-api" ]
deps = [ "src/lib/spinel:libopenthread-spinel-ncp" ]
}
group("libopenthread-spinel-rcp") {
public_deps = [ "src/lib/spinel:spinel-api" ]
deps = [ "src/lib/spinel:libopenthread-spinel-rcp" ]
}
if (current_os == "fuchsia") {
group("lib-ot-core") {
public_deps = [ ":libopenthread-ftd" ]
}
}

217
etc/gn/openthread.gni Normal file
View File

@ -0,0 +1,217 @@
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE]
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
_openthread_config_file = ""
if (current_os == "fuchsia") {
_openthread_config_file = "<openthread-config-android.h>"
}
declare_args() {
# OpenThread config header.
openthread_config_file = _openthread_config_file
# Extra deps for OpenThread configuration.
openthread_config_deps = []
# Include directories for project specific configs.
openthread_project_include_dirs = []
# OpenThread project-specific core config header
openthread_project_core_config_file = ""
# OpenThread platform-specific config check header
openthread_core_config_platform_check_file = ""
# Extra deps for OpenThread core configuration.
openthread_core_config_deps = []
# Use external platform.
openthread_external_platform = ""
# Use external mbedtls. If blank, internal mbedtls will be used.
openthread_external_mbedtls = ""
# Package name for OpenThread.
openthread_package_name = "OPENTHREAD"
# Package version for OpenThread.
openthread_package_version = "1.0.0"
}
declare_args() {
# Configure OpenThread via GN arguments.
openthread_enable_core_config_args = openthread_project_core_config_file == ""
}
if (openthread_enable_core_config_args) {
declare_args() {
# Thread version: 1.1, 1.2
openthread_config_thread_version = ""
# Log output: none, debug_uart, app, platform
openthread_config_log_output = ""
# Enable assertions.
openthread_config_assert_enable = true
# Enable backbone router functionality
openthread_config_backbone_router_enable = false
# Enable border agent support
openthread_config_border_agent_enable = false
# Enable border router support
openthread_config_border_router_enable = false
# Enable channel manager support
openthread_config_channel_manager_enable = false
# Enable channel monitor support
openthread_config_channel_monitor_enable = false
# Enable child supervision support
openthread_config_child_supervision_enable = false
# Enable coap api support
openthread_config_coap_api_enable = false
# Enable secure coap api support
openthread_config_coap_secure_api_enable = false
# Enable coap observe (RFC7641) api support
openthread_config_coap_observe_api_enable = false
# Enable commissioner support
openthread_config_commissioner_enable = false
# Enable csl receiver
openthread_config_mac_csl_receiver_enable = false
# Enable DHCP6 client support
openthread_config_dhcp6_client_enable = false
# Enable DHCP6 server support
openthread_config_dhcp6_server_enable = false
# Enable diagnostic support
openthread_config_diag_enable = false
# Enable DNS client support
openthread_config_dns_client_enable = false
# Enable ECDSA support
openthread_config_ecdsa_enable = false
# Enable Domain Unicast Address feature for Thread 1.2
openthread_config_dua_enable = false
# Enable Multicast Listener Registration feature for Thread 1.2
openthread_config_mlr_enable = false
# Enable external heap support
openthread_config_heap_external_enable = false
# Enable ipv6 fragmentation support
openthread_config_ip6_fragmentation_enable = false
# Enable jam detection support
openthread_config_jam_detection_enable = false
# Enable joiner support
openthread_config_joiner_enable = false
# Enable legacy network support
openthread_config_legacy_enable = false
# Enable link raw service
openthread_config_link_raw_enable = false
# Enable dynamic log level control
openthread_config_log_level_dynamic_enable = false
# Enable mac filter support
openthread_config_mac_filter_enable = false
# Enable MLE long routes extension (experimental, breaks Thread conformance]
openthread_config_mle_long_routes_enable = false
# Enable TMF network diagnostics on MTDs
openthread_config_tmf_network_diag_mtd_enable = false
# Enable multiple instances
openthread_config_multiple_instance_enable = false
# Enable platform netif support
openthread_config_platform_netif_enable = false
# Enable platform UDP support
openthread_config_platform_udp_enable = false
# Enable Thread Test Harness reference device support
openthread_config_reference_device_enable = false
# Enable support for injecting Service entries into the Thread Network Data
openthread_config_tmf_netdata_service_enable = false
# Enable volatile-only storage of settings
openthread_settings_ram = false
# Enable support for adding of auto-configured SLAAC addresses by OpenThread
openthread_config_ip6_slaac_enable = false
# Enable SNTP Client support
openthread_config_sntp_client_enable = false
# Enable the time synchronization service feature
openthread_config_time_sync_enable = false
# Enable UDP forward support
openthread_config_udp_forward_enable = false
# Enable full logs
openthread_config_full_logs = false
# Enable OTNS support
openthread_config_otns_enable = false
# Enable NCP SPI support
openthread_config_ncp_spi_enable = false
# Enable NCP UART support
openthread_config_ncp_uart_enable = false
# Enable builtin mbedtls management
openthread_config_enable_builtin_mbedtls_management =
openthread_external_mbedtls == ""
}
}
if (openthread_external_mbedtls != "") {
mbedtls_target = openthread_external_mbedtls
} else {
mbedtls_target = "../../third_party/mbedtls"
}

121
include/openthread/BUILD.gn Normal file
View File

@ -0,0 +1,121 @@
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
import("../../etc/gn/openthread.gni")
copy("copy_openthread_config_generic") {
sources = [ "../../etc/cmake/openthread-config-generic.h.in" ]
outputs = [ "${root_gen_dir}/include/{{source_name_part}}" ]
}
config("openthread_config_generic_config") {
include_dirs = [ "${root_gen_dir}/include" ]
}
source_set("openthread_config_generic") {
sources = [ "${root_gen_dir}/include/openthread-config-generic.h" ]
deps = [ ":copy_openthread_config_generic" ]
public_configs = [ ":openthread_config_generic_config" ]
}
source_set("openthread_config") {
public = [ "config.h" ]
if (openthread_config_file == "") {
public_deps = [ ":openthread_config_generic" ]
} else {
public_deps = openthread_config_deps
}
public_configs = [ "../..:openthread_config" ]
}
source_set("openthread") {
public = [
"backbone_router.h",
"backbone_router_ftd.h",
"border_agent.h",
"border_router.h",
"channel_manager.h",
"channel_monitor.h",
"child_supervision.h",
"cli.h",
"coap.h",
"coap_secure.h",
"commissioner.h",
"crypto.h",
"dataset.h",
"dataset_ftd.h",
"diag.h",
"dns.h",
"entropy.h",
"error.h",
"heap.h",
"icmp6.h",
"instance.h",
"ip6.h",
"jam_detection.h",
"joiner.h",
"link.h",
"link_raw.h",
"logging.h",
"message.h",
"ncp.h",
"netdata.h",
"netdiag.h",
"network_time.h",
"platform/alarm-micro.h",
"platform/alarm-milli.h",
"platform/ble.h",
"platform/debug_uart.h",
"platform/diag.h",
"platform/entropy.h",
"platform/flash.h",
"platform/logging.h",
"platform/memory.h",
"platform/messagepool.h",
"platform/misc.h",
"platform/otns.h",
"platform/radio.h",
"platform/settings.h",
"platform/spi-slave.h",
"platform/time.h",
"platform/toolchain.h",
"platform/uart.h",
"platform/udp.h",
"random_crypto.h",
"random_noncrypto.h",
"server.h",
"sntp.h",
"tasklet.h",
"thread.h",
"thread_ftd.h",
"udp.h",
]
public_deps = [ ":openthread_config" ]
}

View File

@ -36,9 +36,9 @@ set -x
main()
{
gn gen gn-out
gn gen --check gn-out
ninja -C gn-out
test -f gn-out/obj/lib-ot-core.a
test -f gn-out/obj/src/core/libopenthread-ftd.a
}
main "$@"

63
src/cli/BUILD.gn Normal file
View File

@ -0,0 +1,63 @@
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
openthread_cli_sources = [
"cli.cpp",
"cli.hpp",
"cli_coap.cpp",
"cli_coap.hpp",
"cli_coap_secure.cpp",
"cli_coap_secure.hpp",
"cli_commissioner.cpp",
"cli_commissioner.hpp",
"cli_config.h",
"cli_console.cpp",
"cli_console.hpp",
"cli_dataset.cpp",
"cli_dataset.hpp",
"cli_joiner.cpp",
"cli_joiner.hpp",
"cli_server.cpp",
"cli_server.hpp",
"cli_uart.cpp",
"cli_uart.hpp",
"cli_udp.cpp",
"cli_udp.hpp",
"x509_cert_key.hpp",
]
static_library("libopenthread-cli-ftd") {
sources = openthread_cli_sources
public_deps = [ "../core:libopenthread-ftd" ]
visibility = [ "../../*" ]
}
static_library("libopenthread-cli-mtd") {
sources = openthread_cli_sources
public_deps = [ "../core:libopenthread-mtd" ]
visibility = [ "../../*" ]
}

668
src/core/BUILD.gn Normal file
View File

@ -0,0 +1,668 @@
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
import("../../etc/gn/openthread.gni")
visibility = [ "../../*" ]
if (openthread_enable_core_config_args) {
config("core_config_args") {
defines = []
if (openthread_config_thread_version == "1.1") {
defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1" ]
} else if (openthread_config_thread_version == "1.2") {
defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2" ]
} else if (openthread_config_thread_version != "") {
assert(false,
"Unrecognized Thread version: ${openthread_config_thread_version}")
}
if (openthread_config_log_output == "none") {
defines +=
[ "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_NONE" ]
} else if (openthread_config_log_output == "debug_uart") {
defines += [
"OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART",
]
} else if (openthread_config_log_output == "app") {
defines +=
[ "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_APP" ]
} else if (openthread_config_log_output == "platform_defined") {
defines += [ "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED" ]
} else if (openthread_config_log_output != "") {
assert(false, "Unrecognized log output: ${openthread_config_log_output}")
}
if (!openthread_config_assert_enable) {
defines += [ "OPENTHREAD_CONFIG_ASSERT_ENABLE=0" ]
}
if (openthread_config_backbone_router_enable) {
defines += [ "OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1" ]
}
if (openthread_config_border_agent_enable) {
defines += [ "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1" ]
}
if (openthread_config_border_router_enable) {
defines += [ "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1" ]
}
if (openthread_external_mbedtls != "") {
defines += [ "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0" ]
} else if (!openthread_config_enable_builtin_mbedtls_management) {
defines += [ "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0" ]
}
if (openthread_config_channel_manager_enable) {
defines += [ "OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1" ]
}
if (openthread_config_channel_monitor_enable) {
defines += [ "OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1" ]
}
if (openthread_config_child_supervision_enable) {
defines += [ "OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1" ]
}
if (openthread_config_coap_api_enable) {
defines += [ "OPENTHREAD_CONFIG_COAP_API_ENABLE=1" ]
}
if (openthread_config_coap_secure_api_enable) {
defines += [ "OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1" ]
}
if (openthread_config_coap_observe_api_enable) {
defines += [ "OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1" ]
}
if (openthread_config_commissioner_enable) {
defines += [ "OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1" ]
}
if (openthread_config_mac_csl_receiver_enable) {
defines += [ "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1" ]
}
if (openthread_config_dhcp6_client_enable) {
defines += [ "OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1" ]
}
if (openthread_config_dhcp6_server_enable) {
defines += [ "OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1" ]
}
if (openthread_config_diag_enable) {
defines += [ "OPENTHREAD_CONFIG_DIAG_ENABLE=1" ]
}
if (openthread_config_dns_client_enable) {
defines += [ "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1" ]
}
if (openthread_config_ecdsa_enable) {
defines += [ "OPENTHREAD_CONFIG_ECDSA_ENABLE=1" ]
}
if (openthread_config_dua_enable) {
defines += [ "OPENTHREAD_CONFIG_DUA_ENABLE=1" ]
}
if (openthread_config_mlr_enable) {
defines += [ "OPENTHREAD_CONFIG_MLR_ENABLE=1" ]
}
if (openthread_config_heap_external_enable) {
defines += [ "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1" ]
}
if (openthread_config_ip6_fragmentation_enable) {
defines += [ "OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1" ]
}
if (openthread_config_jam_detection_enable) {
defines += [ "OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1" ]
}
if (openthread_config_joiner_enable) {
defines += [ "OPENTHREAD_CONFIG_JOINER_ENABLE=1" ]
}
if (openthread_config_legacy_enable) {
defines += [ "OPENTHREAD_CONFIG_LEGACY_ENABLE=1" ]
}
if (openthread_config_link_raw_enable) {
defines += [ "OPENTHREAD_CONFIG_LINK_RAW_ENABLE=1" ]
}
if (openthread_config_log_level_dynamic_enable) {
defines += [ "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1" ]
}
if (openthread_config_mac_filter_enable) {
defines += [ "OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1" ]
}
if (openthread_config_mle_long_routes_enable) {
defines += [ "OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1" ]
}
if (openthread_config_tmf_network_diag_mtd_enable) {
defines += [ "OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1" ]
}
if (openthread_config_multiple_instance_enable) {
defines += [ "OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1" ]
}
if (openthread_config_platform_netif_enable) {
defines += [ "OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1" ]
}
if (openthread_config_platform_udp_enable) {
defines += [ "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1" ]
}
if (openthread_config_reference_device_enable) {
defines += [ "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1" ]
}
if (openthread_config_tmf_netdata_service_enable) {
defines += [ "OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1" ]
}
if (openthread_settings_ram) {
defines += [ "OPENTHREAD_SETTINGS_RAM=1" ]
}
if (openthread_config_ip6_slaac_enable) {
defines += [ "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1" ]
}
if (openthread_config_sntp_client_enable) {
defines += [ "OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1" ]
}
if (openthread_config_time_sync_enable) {
defines += [ "OPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1" ]
}
if (openthread_config_udp_forward_enable) {
defines += [ "OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1" ]
}
if (openthread_config_full_logs) {
defines += [
"OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG",
"OPENTHREAD_CONFIG_LOG_API=1",
"OPENTHREAD_CONFIG_LOG_ARP=1",
"OPENTHREAD_CONFIG_LOG_BBR=1",
"OPENTHREAD_CONFIG_LOG_CLI=1",
"OPENTHREAD_CONFIG_LOG_COAP=1",
"OPENTHREAD_CONFIG_LOG_DUA=1",
"OPENTHREAD_CONFIG_LOG_ICMP=1",
"OPENTHREAD_CONFIG_LOG_IP6=1",
"OPENTHREAD_CONFIG_LOG_MAC=1",
"OPENTHREAD_CONFIG_LOG_MEM=1",
"OPENTHREAD_CONFIG_LOG_MESHCOP=1",
"OPENTHREAD_CONFIG_LOG_MLE=1",
"OPENTHREAD_CONFIG_LOG_MLR=1",
"OPENTHREAD_CONFIG_LOG_NETDATA=1",
"OPENTHREAD_CONFIG_LOG_NETDIAG=1",
"OPENTHREAD_CONFIG_LOG_PKT_DUMP=1",
"OPENTHREAD_CONFIG_LOG_PLATFORM=1",
"OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1",
"OPENTHREAD_CONFIG_LOG_PREPEND_REGION=1",
]
}
if (openthread_config_otns_enable) {
defines += [ "OPENTHREAD_CONFIG_OTNS_ENABLE=1" ]
}
}
}
config("core_config") {
defines = []
configs = []
if (openthread_project_core_config_file != "") {
defines += [ "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${openthread_project_core_config_file}\"" ]
}
if (openthread_core_config_platform_check_file != "") {
defines += [ "OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"${openthread_core_config_platform_check_file}\"" ]
}
if (openthread_package_name != "") {
defines += [ "PACKAGE_NAME=\"${openthread_package_name}\"" ]
}
if (openthread_package_version != "") {
defines += [ "PACKAGE_VERSION=\"${openthread_package_version}\"" ]
}
if (openthread_enable_core_config_args) {
configs += [ ":core_config_args" ]
}
include_dirs = [
"..",
".",
]
}
openthread_core_files = [
"api/backbone_router_api.cpp",
"api/backbone_router_ftd_api.cpp",
"api/border_agent_api.cpp",
"api/border_router_api.cpp",
"api/channel_manager_api.cpp",
"api/channel_monitor_api.cpp",
"api/child_supervision_api.cpp",
"api/coap_api.cpp",
"api/coap_secure_api.cpp",
"api/commissioner_api.cpp",
"api/crypto_api.cpp",
"api/dataset_api.cpp",
"api/dataset_ftd_api.cpp",
"api/diags_api.cpp",
"api/dns_api.cpp",
"api/entropy_api.cpp",
"api/heap_api.cpp",
"api/icmp6_api.cpp",
"api/instance_api.cpp",
"api/ip6_api.cpp",
"api/jam_detection_api.cpp",
"api/joiner_api.cpp",
"api/link_api.cpp",
"api/link_raw_api.cpp",
"api/logging_api.cpp",
"api/message_api.cpp",
"api/netdata_api.cpp",
"api/netdiag_api.cpp",
"api/network_time_api.cpp",
"api/random_crypto_api.cpp",
"api/random_noncrypto_api.cpp",
"api/server_api.cpp",
"api/sntp_api.cpp",
"api/tasklet_api.cpp",
"api/thread_api.cpp",
"api/thread_ftd_api.cpp",
"api/udp_api.cpp",
"backbone_router/bbr_leader.cpp",
"backbone_router/bbr_leader.hpp",
"backbone_router/bbr_local.cpp",
"backbone_router/bbr_local.hpp",
"backbone_router/bbr_manager.cpp",
"backbone_router/bbr_manager.hpp",
"coap/coap.cpp",
"coap/coap.hpp",
"coap/coap_message.cpp",
"coap/coap_message.hpp",
"coap/coap_secure.cpp",
"coap/coap_secure.hpp",
"common/bit_vector.hpp",
"common/clearable.hpp",
"common/code_utils.hpp",
"common/crc16.cpp",
"common/crc16.hpp",
"common/debug.hpp",
"common/encoding.hpp",
"common/equatable.hpp",
"common/extension.hpp",
"common/instance.cpp",
"common/instance.hpp",
"common/linked_list.hpp",
"common/locator-getters.hpp",
"common/locator.hpp",
"common/logging.cpp",
"common/logging.hpp",
"common/message.cpp",
"common/message.hpp",
"common/new.hpp",
"common/non_copyable.hpp",
"common/notifier.cpp",
"common/notifier.hpp",
"common/pool.hpp",
"common/random.hpp",
"common/random_manager.cpp",
"common/random_manager.hpp",
"common/settings.cpp",
"common/settings.hpp",
"common/string.cpp",
"common/string.hpp",
"common/tasklet.cpp",
"common/tasklet.hpp",
"common/time.hpp",
"common/timer.cpp",
"common/timer.hpp",
"common/tlvs.cpp",
"common/tlvs.hpp",
"common/trickle_timer.cpp",
"common/trickle_timer.hpp",
"crypto/aes_ccm.cpp",
"crypto/aes_ccm.hpp",
"crypto/aes_ecb.cpp",
"crypto/aes_ecb.hpp",
"crypto/ecdsa.cpp",
"crypto/ecdsa.hpp",
"crypto/hmac_sha256.cpp",
"crypto/hmac_sha256.hpp",
"crypto/mbedtls.cpp",
"crypto/mbedtls.hpp",
"crypto/pbkdf2_cmac.cpp",
"crypto/pbkdf2_cmac.h",
"crypto/sha256.cpp",
"crypto/sha256.hpp",
"diags/factory_diags.cpp",
"diags/factory_diags.hpp",
"mac/channel_mask.cpp",
"mac/channel_mask.hpp",
"mac/data_poll_handler.cpp",
"mac/data_poll_handler.hpp",
"mac/data_poll_sender.cpp",
"mac/data_poll_sender.hpp",
"mac/link_raw.cpp",
"mac/link_raw.hpp",
"mac/mac.cpp",
"mac/mac.hpp",
"mac/mac_filter.cpp",
"mac/mac_filter.hpp",
"mac/mac_frame.cpp",
"mac/mac_frame.hpp",
"mac/mac_types.cpp",
"mac/mac_types.hpp",
"mac/sub_mac.cpp",
"mac/sub_mac.hpp",
"mac/sub_mac_callbacks.cpp",
"meshcop/announce_begin_client.cpp",
"meshcop/announce_begin_client.hpp",
"meshcop/border_agent.cpp",
"meshcop/border_agent.hpp",
"meshcop/commissioner.cpp",
"meshcop/commissioner.hpp",
"meshcop/dataset.cpp",
"meshcop/dataset.hpp",
"meshcop/dataset_local.cpp",
"meshcop/dataset_local.hpp",
"meshcop/dataset_manager.cpp",
"meshcop/dataset_manager.hpp",
"meshcop/dataset_manager_ftd.cpp",
"meshcop/dtls.cpp",
"meshcop/dtls.hpp",
"meshcop/energy_scan_client.cpp",
"meshcop/energy_scan_client.hpp",
"meshcop/joiner.cpp",
"meshcop/joiner.hpp",
"meshcop/joiner_router.cpp",
"meshcop/joiner_router.hpp",
"meshcop/meshcop.cpp",
"meshcop/meshcop.hpp",
"meshcop/meshcop_leader.cpp",
"meshcop/meshcop_leader.hpp",
"meshcop/meshcop_tlvs.cpp",
"meshcop/meshcop_tlvs.hpp",
"meshcop/panid_query_client.cpp",
"meshcop/panid_query_client.hpp",
"meshcop/timestamp.cpp",
"meshcop/timestamp.hpp",
"net/dhcp6.hpp",
"net/dhcp6_client.cpp",
"net/dhcp6_client.hpp",
"net/dhcp6_server.cpp",
"net/dhcp6_server.hpp",
"net/dns_client.cpp",
"net/dns_client.hpp",
"net/dns_headers.hpp",
"net/icmp6.cpp",
"net/icmp6.hpp",
"net/ip6.cpp",
"net/ip6.hpp",
"net/ip6_address.cpp",
"net/ip6_address.hpp",
"net/ip6_filter.cpp",
"net/ip6_filter.hpp",
"net/ip6_headers.cpp",
"net/ip6_headers.hpp",
"net/ip6_mpl.cpp",
"net/ip6_mpl.hpp",
"net/netif.cpp",
"net/netif.hpp",
"net/sntp_client.cpp",
"net/sntp_client.hpp",
"net/socket.hpp",
"net/tcp.hpp",
"net/udp6.cpp",
"net/udp6.hpp",
"radio/radio.cpp",
"radio/radio.hpp",
"radio/radio_callbacks.cpp",
"radio/radio_platform.cpp",
"thread/address_resolver.cpp",
"thread/address_resolver.hpp",
"thread/announce_begin_server.cpp",
"thread/announce_begin_server.hpp",
"thread/announce_sender.cpp",
"thread/announce_sender.hpp",
"thread/child_mask.hpp",
"thread/child_table.cpp",
"thread/child_table.hpp",
"thread/discover_scanner.cpp",
"thread/discover_scanner.hpp",
"thread/dua_manager.cpp",
"thread/dua_manager.hpp",
"thread/energy_scan_server.cpp",
"thread/energy_scan_server.hpp",
"thread/indirect_sender.cpp",
"thread/indirect_sender.hpp",
"thread/indirect_sender_frame_context.hpp",
"thread/key_manager.cpp",
"thread/key_manager.hpp",
"thread/link_quality.cpp",
"thread/link_quality.hpp",
"thread/lowpan.cpp",
"thread/lowpan.hpp",
"thread/mesh_forwarder.cpp",
"thread/mesh_forwarder.hpp",
"thread/mesh_forwarder_ftd.cpp",
"thread/mesh_forwarder_mtd.cpp",
"thread/mle.cpp",
"thread/mle.hpp",
"thread/mle_router.cpp",
"thread/mle_router.hpp",
"thread/mle_tlvs.hpp",
"thread/mle_types.cpp",
"thread/mle_types.hpp",
"thread/mlr_manager.cpp",
"thread/mlr_manager.hpp",
"thread/mlr_types.hpp",
"thread/neighbor_table.cpp",
"thread/network_data.cpp",
"thread/network_data.hpp",
"thread/network_data_leader.cpp",
"thread/network_data_leader.hpp",
"thread/network_data_leader_ftd.cpp",
"thread/network_data_leader_ftd.hpp",
"thread/network_data_local.cpp",
"thread/network_data_local.hpp",
"thread/network_data_notifier.cpp",
"thread/network_data_notifier.hpp",
"thread/network_data_tlvs.hpp",
"thread/network_diagnostic.cpp",
"thread/network_diagnostic.hpp",
"thread/network_diagnostic_tlvs.hpp",
"thread/panid_query_server.cpp",
"thread/panid_query_server.hpp",
"thread/router_table.cpp",
"thread/router_table.hpp",
"thread/src_match_controller.cpp",
"thread/src_match_controller.hpp",
"thread/thread_netif.cpp",
"thread/thread_netif.hpp",
"thread/thread_tlvs.hpp",
"thread/thread_uri_paths.hpp",
"thread/time_sync_service.cpp",
"thread/time_sync_service.hpp",
"thread/topology.cpp",
"thread/topology.hpp",
"utils/channel_manager.cpp",
"utils/channel_manager.hpp",
"utils/channel_monitor.cpp",
"utils/channel_monitor.hpp",
"utils/child_supervision.cpp",
"utils/child_supervision.hpp",
"utils/flash.cpp",
"utils/flash.hpp",
"utils/heap.cpp",
"utils/heap.hpp",
"utils/jam_detector.cpp",
"utils/jam_detector.hpp",
"utils/otns.cpp",
"utils/otns.hpp",
"utils/parse_cmdline.cpp",
"utils/parse_cmdline.hpp",
"utils/slaac_address.cpp",
"utils/slaac_address.hpp",
]
openthread_radio_sources = [
"api/diags_api.cpp",
"api/instance_api.cpp",
"api/link_raw_api.cpp",
"api/logging_api.cpp",
"api/random_noncrypto_api.cpp",
"api/tasklet_api.cpp",
"common/instance.cpp",
"common/logging.cpp",
"common/random_manager.cpp",
"common/string.cpp",
"common/tasklet.cpp",
"common/timer.cpp",
"crypto/aes_ccm.cpp",
"crypto/aes_ecb.cpp",
"diags/factory_diags.cpp",
"mac/link_raw.cpp",
"mac/mac_frame.cpp",
"mac/mac_types.cpp",
"mac/sub_mac.cpp",
"mac/sub_mac_callbacks.cpp",
"radio/radio.cpp",
"radio/radio_callbacks.cpp",
"radio/radio_platform.cpp",
"thread/link_quality.cpp",
"utils/parse_cmdline.cpp",
]
header_pattern = [
"*.h",
"*.hpp",
]
openthread_core_headers = filter_include(openthread_core_files, header_pattern)
openthread_core_sources = filter_exclude(openthread_core_files, header_pattern)
source_set("libopenthread_core_config") {
public = [
"config/announce_sender.h",
"config/backbone_router.h",
"config/border_router.h",
"config/channel_manager.h",
"config/channel_monitor.h",
"config/child_supervision.h",
"config/coap.h",
"config/commissioner.h",
"config/dhcp6_client.h",
"config/dhcp6_server.h",
"config/diag.h",
"config/dns_client.h",
"config/ip6.h",
"config/joiner.h",
"config/link_quality.h",
"config/link_raw.h",
"config/logging.h",
"config/mac.h",
"config/mle.h",
"config/openthread-core-config-check.h",
"config/openthread-core-default-config.h",
"config/parent_search.h",
"config/platform.h",
"config/sntp_client.h",
"config/time_sync.h",
"config/tmf.h",
"openthread-core-config.h",
]
public_configs = [
":core_config",
"../..:openthread_config",
]
public_deps = [ "../../include/openthread:openthread_config" ]
public_deps += openthread_core_config_deps
}
source_set("libopenthread_core_headers") {
public = openthread_core_headers
public_deps = [
":libopenthread_core_config",
"../../include/openthread",
]
visibility += [ "*" ]
}
group("libopenthread_platform") {
public_deps = []
if (openthread_external_platform != "") {
public_deps += [ openthread_external_platform ]
}
public_deps += [
":libopenthread_core_headers",
"${mbedtls_target}",
]
}
static_library("libopenthread-ftd") {
sources = openthread_core_sources
public_deps = [ ":libopenthread_platform" ]
public_configs = [ "../..:openthread_ftd_config" ]
}
static_library("libopenthread-mtd") {
sources = openthread_core_sources
public_deps = [ ":libopenthread_platform" ]
public_configs = [ "../..:openthread_mtd_config" ]
}
static_library("libopenthread-radio") {
sources = openthread_radio_sources
public_deps = [ ":libopenthread_platform" ]
public_configs = [ "../..:openthread_radio_config" ]
}

34
src/lib/hdlc/BUILD.gn Normal file
View File

@ -0,0 +1,34 @@
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
static_library("libopenthread-hdlc") {
sources = [
"hdlc.cpp",
"hdlc.hpp",
]
configs += [ "../..:openthread_config" ]
}

75
src/lib/spinel/BUILD.gn Normal file
View File

@ -0,0 +1,75 @@
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
visibility = [ "../../../*" ]
declare_args() {
# Platform portability header for spinel.
spinel_platform_header = "\"spinel_platform.h\""
}
spinel_sources = [
"openthread-spinel-config.h",
"radio_spinel.hpp",
"radio_spinel_impl.hpp",
"spinel.c",
"spinel_buffer.cpp",
"spinel_buffer.hpp",
"spinel_decoder.cpp",
"spinel_decoder.hpp",
"spinel_encoder.cpp",
"spinel_encoder.hpp",
"spinel_platform.h",
]
config("spinel_config") {
defines = [ "SPINEL_PLATFORM_HEADER=${spinel_platform_header}" ]
include_dirs = [ ".." ]
}
source_set("spinel-api") {
public = [ "spinel.h" ]
public_configs = [ ":spinel_config" ]
}
static_library("libopenthread-spinel-ncp") {
sources = spinel_sources
public_deps = [
":spinel-api",
"../../core:libopenthread_core_headers",
]
defines = [ "OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1" ]
}
static_library("libopenthread-spinel-rcp") {
sources = spinel_sources
public_deps = [
":spinel-api",
"../../core:libopenthread_core_headers",
]
defines = [ "OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=0" ]
}

196
third_party/mbedtls/BUILD.gn vendored Normal file
View File

@ -0,0 +1,196 @@
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
declare_args() {
# Configuration file for MbedTLS.
mbedtls_config_file = "mbedtls-config.h"
# Extra dependencies for MbedTLS
mbedtls_deps = [ "../../src/core:libopenthread_core_config" ]
}
config("mbedtls_config") {
include_dirs = [
".",
"repo/include",
]
defines = [ "MBEDTLS_CONFIG_FILE=\"${mbedtls_config_file}\"" ]
}
static_library("mbedtls") {
sources = [
"repo/include/mbedtls/aes.h",
"repo/include/mbedtls/aesni.h",
"repo/include/mbedtls/arc4.h",
"repo/include/mbedtls/aria.h",
"repo/include/mbedtls/asn1.h",
"repo/include/mbedtls/asn1write.h",
"repo/include/mbedtls/base64.h",
"repo/include/mbedtls/bignum.h",
"repo/include/mbedtls/blowfish.h",
"repo/include/mbedtls/bn_mul.h",
"repo/include/mbedtls/camellia.h",
"repo/include/mbedtls/ccm.h",
"repo/include/mbedtls/certs.h",
"repo/include/mbedtls/chacha20.h",
"repo/include/mbedtls/chachapoly.h",
"repo/include/mbedtls/check_config.h",
"repo/include/mbedtls/cipher.h",
"repo/include/mbedtls/cipher_internal.h",
"repo/include/mbedtls/cmac.h",
"repo/include/mbedtls/compat-1.3.h",
"repo/include/mbedtls/config.h",
"repo/include/mbedtls/ctr_drbg.h",
"repo/include/mbedtls/debug.h",
"repo/include/mbedtls/des.h",
"repo/include/mbedtls/dhm.h",
"repo/include/mbedtls/ecdh.h",
"repo/include/mbedtls/ecdsa.h",
"repo/include/mbedtls/ecjpake.h",
"repo/include/mbedtls/ecp.h",
"repo/include/mbedtls/ecp_internal.h",
"repo/include/mbedtls/entropy.h",
"repo/include/mbedtls/entropy_poll.h",
"repo/include/mbedtls/error.h",
"repo/include/mbedtls/gcm.h",
"repo/include/mbedtls/havege.h",
"repo/include/mbedtls/hkdf.h",
"repo/include/mbedtls/hmac_drbg.h",
"repo/include/mbedtls/md.h",
"repo/include/mbedtls/md2.h",
"repo/include/mbedtls/md4.h",
"repo/include/mbedtls/md5.h",
"repo/include/mbedtls/md_internal.h",
"repo/include/mbedtls/memory_buffer_alloc.h",
"repo/include/mbedtls/net.h",
"repo/include/mbedtls/net_sockets.h",
"repo/include/mbedtls/nist_kw.h",
"repo/include/mbedtls/oid.h",
"repo/include/mbedtls/padlock.h",
"repo/include/mbedtls/pem.h",
"repo/include/mbedtls/pk.h",
"repo/include/mbedtls/pk_internal.h",
"repo/include/mbedtls/pkcs11.h",
"repo/include/mbedtls/pkcs12.h",
"repo/include/mbedtls/pkcs5.h",
"repo/include/mbedtls/platform.h",
"repo/include/mbedtls/platform_time.h",
"repo/include/mbedtls/platform_util.h",
"repo/include/mbedtls/poly1305.h",
"repo/include/mbedtls/ripemd160.h",
"repo/include/mbedtls/rsa.h",
"repo/include/mbedtls/rsa_internal.h",
"repo/include/mbedtls/sha1.h",
"repo/include/mbedtls/sha256.h",
"repo/include/mbedtls/sha512.h",
"repo/include/mbedtls/ssl.h",
"repo/include/mbedtls/ssl_cache.h",
"repo/include/mbedtls/ssl_ciphersuites.h",
"repo/include/mbedtls/ssl_cookie.h",
"repo/include/mbedtls/ssl_internal.h",
"repo/include/mbedtls/ssl_ticket.h",
"repo/include/mbedtls/threading.h",
"repo/include/mbedtls/timing.h",
"repo/include/mbedtls/version.h",
"repo/include/mbedtls/x509.h",
"repo/include/mbedtls/x509_crl.h",
"repo/include/mbedtls/x509_crt.h",
"repo/include/mbedtls/x509_csr.h",
"repo/include/mbedtls/xtea.h",
"repo/library/aes.c",
"repo/library/aesni.c",
"repo/library/arc4.c",
"repo/library/asn1parse.c",
"repo/library/asn1write.c",
"repo/library/base64.c",
"repo/library/bignum.c",
"repo/library/blowfish.c",
"repo/library/camellia.c",
"repo/library/ccm.c",
"repo/library/certs.c",
"repo/library/chacha20.c",
"repo/library/chachapoly.c",
"repo/library/cipher.c",
"repo/library/cipher_wrap.c",
"repo/library/ctr_drbg.c",
"repo/library/debug.c",
"repo/library/des.c",
"repo/library/dhm.c",
"repo/library/ecdh.c",
"repo/library/ecdsa.c",
"repo/library/ecp.c",
"repo/library/ecp_curves.c",
"repo/library/entropy.c",
"repo/library/entropy_poll.c",
"repo/library/error.c",
"repo/library/gcm.c",
"repo/library/hkdf.c",
"repo/library/hmac_drbg.c",
"repo/library/md.c",
"repo/library/md5.c",
"repo/library/md_wrap.c",
"repo/library/oid.c",
"repo/library/pem.c",
"repo/library/pk.c",
"repo/library/pk_wrap.c",
"repo/library/pkcs12.c",
"repo/library/pkcs5.c",
"repo/library/pkparse.c",
"repo/library/pkwrite.c",
"repo/library/platform.c",
"repo/library/platform_util.c",
"repo/library/poly1305.c",
"repo/library/ripemd160.c",
"repo/library/rsa.c",
"repo/library/rsa_internal.c",
"repo/library/sha1.c",
"repo/library/sha256.c",
"repo/library/sha512.c",
"repo/library/ssl_cache.c",
"repo/library/ssl_ciphersuites.c",
"repo/library/ssl_cli.c",
"repo/library/ssl_cookie.c",
"repo/library/ssl_srv.c",
"repo/library/ssl_ticket.c",
"repo/library/ssl_tls.c",
"repo/library/timing.c",
"repo/library/version.c",
"repo/library/version_features.c",
"repo/library/x509.c",
"repo/library/x509_create.c",
"repo/library/x509_crl.c",
"repo/library/x509_csr.c",
"repo/library/x509write_crt.c",
"repo/library/x509write_csr.c",
"repo/library/xtea.c",
]
public_deps = mbedtls_deps
public_configs = [ ":mbedtls_config" ]
}