Skip to content

Commit

Permalink
[build] update GN build file for OpenThread (#5358)
Browse files Browse the repository at this point in the history
Add the CLI & configuration to the build file.
  • Loading branch information
mspang authored Aug 12, 2020
1 parent 7dc3b26 commit a24737a
Show file tree
Hide file tree
Showing 10 changed files with 1,441 additions and 197 deletions.
2 changes: 2 additions & 0 deletions .gn
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
buildconfig = "//third_party/build_gn/BUILDCONFIG.gn"

check_system_includes = true
258 changes: 63 additions & 195 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -25,204 +25,72 @@
# POSSIBILITY OF SUCH DAMAGE.
#

static_library("lib-ot-core") {

cflags_cc = [ "-Wno-non-virtual-dtor" ]

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"
]
import("etc/gn/openthread.gni")

# Remove the example as it is not meant for compilation
sources -= [
"src/core/common/extension_example.cpp",
]
config("openthread_config") {
if (openthread_config_file != "") {
defines += [ "OPENTHREAD_CONFIG_FILE=${openthread_config_file}" ]
}

include_dirs = [
include_dirs = openthread_project_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" ]
}
}
Loading

0 comments on commit a24737a

Please sign in to comment.