1#  Copyright (c) 2020, The OpenThread Authors.
2#  All rights reserved.
3#
4#  Redistribution and use in source and binary forms, with or without
5#  modification, are permitted provided that the following conditions are met:
6#  1. Redistributions of source code must retain the above copyright
7#     notice, this list of conditions and the following disclaimer.
8#  2. Redistributions in binary form must reproduce the above copyright
9#     notice, this list of conditions and the following disclaimer in the
10#     documentation and/or other materials provided with the distribution.
11#  3. Neither the name of the copyright holder nor the
12#     names of its contributors may be used to endorse or promote products
13#     derived from this software without specific prior written permission.
14#
15#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25#  POSSIBILITY OF SUCH DAMAGE.
26#
27
28import("../../etc/gn/openthread.gni")
29
30visibility = [ "../../*" ]
31
32if (openthread_enable_core_config_args) {
33  config("core_config_args") {
34    defines = []
35
36    if (openthread_config_thread_version == "1.1") {
37      defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_1" ]
38    } else if (openthread_config_thread_version == "1.2") {
39      defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_2" ]
40    } else if (openthread_config_thread_version == "1.3") {
41      defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3" ]
42    } else if (openthread_config_thread_version == "1.3.1") {
43      defines += [ "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_1_3_1" ]
44    } else if (openthread_config_thread_version != "") {
45      assert(false,
46             "Unrecognized Thread version: ${openthread_config_thread_version}")
47    }
48
49    if (openthread_config_log_output == "none") {
50      defines +=
51          [ "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_NONE" ]
52    } else if (openthread_config_log_output == "debug_uart") {
53      defines += [
54        "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART",
55      ]
56    } else if (openthread_config_log_output == "app") {
57      defines +=
58          [ "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_APP" ]
59    } else if (openthread_config_log_output == "platform_defined") {
60      defines += [ "OPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_PLATFORM_DEFINED" ]
61    } else if (openthread_config_log_output != "") {
62      assert(false, "Unrecognized log output: ${openthread_config_log_output}")
63    }
64
65    if (!openthread_config_assert_enable) {
66      defines += [ "OPENTHREAD_CONFIG_ASSERT_ENABLE=0" ]
67    }
68
69    if (openthread_config_anycast_locator_enable) {
70      defines += [ "OPENTHREAD_CONFIG_ANYCAST_LOCATOR_ENABLE=1" ]
71    }
72
73    if (openthread_config_backbone_router_enable) {
74      defines += [ "OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1" ]
75    }
76
77    if (openthread_config_ble_tcat_enable) {
78      defines += [ "OPENTHREAD_CONFIG_BLE_TCAT_ENABLE=1" ]
79    }
80
81    if (openthread_config_border_agent_enable) {
82      defines += [ "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1" ]
83    }
84
85    if (openthread_config_border_router_enable) {
86      defines += [ "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1" ]
87    }
88
89    if (openthread_config_border_routing_enable) {
90      defines += [ "OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1" ]
91    }
92
93    if (openthread_external_mbedtls != "") {
94      defines += [ "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0" ]
95    } else if (!openthread_config_enable_builtin_mbedtls_management) {
96      defines += [ "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0" ]
97    }
98
99    if (openthread_config_channel_manager_enable) {
100      defines += [ "OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1" ]
101    }
102
103    if (openthread_config_channel_monitor_enable) {
104      defines += [ "OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1" ]
105    }
106
107    if (openthread_config_coap_api_enable) {
108      defines += [ "OPENTHREAD_CONFIG_COAP_API_ENABLE=1" ]
109    }
110
111    if (openthread_config_coap_secure_api_enable) {
112      defines += [ "OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1" ]
113    }
114
115    if (openthread_config_coap_observe_api_enable) {
116      defines += [ "OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1" ]
117    }
118
119    if (openthread_config_commissioner_enable) {
120      defines += [ "OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1" ]
121    }
122
123    if (openthread_config_mac_csl_receiver_enable) {
124      defines += [ "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1" ]
125    }
126
127    if (openthread_config_dhcp6_client_enable) {
128      defines += [ "OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1" ]
129    }
130
131    if (openthread_config_dhcp6_server_enable) {
132      defines += [ "OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1" ]
133    }
134
135    if (openthread_config_diag_enable) {
136      defines += [ "OPENTHREAD_CONFIG_DIAG_ENABLE=1" ]
137    }
138
139    if (openthread_config_dns_client_enable) {
140      defines += [ "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1" ]
141    }
142
143    if (openthread_config_dnssd_server_enable) {
144      defines += [ "OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1" ]
145    }
146
147    if (openthread_config_ecdsa_enable) {
148      defines += [ "OPENTHREAD_CONFIG_ECDSA_ENABLE=1" ]
149    }
150
151    if (openthread_config_dua_enable) {
152      defines += [ "OPENTHREAD_CONFIG_DUA_ENABLE=1" ]
153    }
154
155    if (openthread_config_mlr_enable) {
156      defines += [ "OPENTHREAD_CONFIG_MLR_ENABLE=1" ]
157    }
158
159    if (openthread_config_heap_external_enable) {
160      defines += [ "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1" ]
161    }
162
163    if (openthread_config_ip6_fragmentation_enable) {
164      defines += [ "OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1" ]
165    }
166
167    if (openthread_config_jam_detection_enable) {
168      defines += [ "OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1" ]
169    }
170
171    if (openthread_config_joiner_enable) {
172      defines += [ "OPENTHREAD_CONFIG_JOINER_ENABLE=1" ]
173    }
174
175    if (openthread_config_link_metrics_initiator_enable) {
176      defines += [ "DOPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1" ]
177    }
178
179    if (openthread_config_link_metrics_subject_enable) {
180      defines += [ "DOPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1" ]
181    }
182
183    if (openthread_config_link_raw_enable) {
184      defines += [ "OPENTHREAD_CONFIG_LINK_RAW_ENABLE=1" ]
185    }
186
187    if (openthread_config_log_level_dynamic_enable) {
188      defines += [ "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1" ]
189    }
190
191    if (openthread_config_mac_filter_enable) {
192      defines += [ "OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1" ]
193    }
194
195    if (openthread_config_message_use_heap) {
196      defines += [ "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1" ]
197    }
198
199    if (openthread_config_mle_long_routes_enable) {
200      defines += [ "OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1" ]
201    }
202
203    if (openthread_config_multiple_instance_enable) {
204      defines += [ "OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1" ]
205    }
206
207    if (openthread_config_tmf_netdiag_client_enable) {
208      defines += [ "OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE=1" ]
209    }
210
211    if (openthread_config_platform_netif_enable) {
212      defines += [ "OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1" ]
213    }
214
215
216    if (openthread_config_platform_udp_enable) {
217      defines += [ "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1" ]
218    }
219
220    if (openthread_config_reference_device_enable) {
221      defines += [ "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1" ]
222    }
223
224    if (openthread_config_tmf_netdata_service_enable) {
225      defines += [ "OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1" ]
226    }
227
228    if (openthread_settings_ram) {
229      defines += [ "OPENTHREAD_SETTINGS_RAM=1" ]
230    }
231
232    if (openthread_config_ip6_slaac_enable) {
233      defines += [ "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1" ]
234    }
235
236    if (openthread_config_sntp_client_enable) {
237      defines += [ "OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1" ]
238    }
239
240    if (openthread_config_srp_client_enable) {
241      defines += [ "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1" ]
242    }
243
244    if (openthread_config_srp_server_enable) {
245      defines += [ "OPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1" ]
246    }
247
248    if (openthread_config_ping_sender) {
249      defines += [ "OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1" ]
250    }
251
252    if (openthread_config_time_sync_enable) {
253      defines += [ "OPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1" ]
254    }
255
256    if (openthread_config_udp_forward_enable) {
257      defines += [ "OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1" ]
258    }
259
260    if (openthread_config_full_logs) {
261      defines += [ "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG" ]
262      defines += [ "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1" ]
263    }
264
265    if (openthread_config_otns_enable) {
266      defines += [ "OPENTHREAD_CONFIG_OTNS_ENABLE=1" ]
267    }
268
269    if (openthread_config_coexistence_enable) {
270      defines += [ "OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE=1" ]
271    }
272  }
273}
274
275config("core_config") {
276  defines = []
277  configs = []
278
279  if (openthread_project_core_config_file != "") {
280    defines += [ "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${openthread_project_core_config_file}\"" ]
281  }
282
283  if (openthread_core_config_platform_check_file != "") {
284    defines += [ "OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"${openthread_core_config_platform_check_file}\"" ]
285  }
286
287  if (openthread_package_name != "") {
288    defines += [ "PACKAGE_NAME=\"${openthread_package_name}\"" ]
289  }
290
291  if (openthread_package_version != "") {
292    defines += [ "PACKAGE_VERSION=\"${openthread_package_version}\"" ]
293  }
294
295  if (openthread_enable_core_config_args) {
296    configs += [ ":core_config_args" ]
297  }
298
299  include_dirs = [
300    "..",
301    ".",
302  ]
303}
304
305openthread_core_files = [
306  "api/backbone_router_api.cpp",
307  "api/backbone_router_ftd_api.cpp",
308  "api/ble_secure_api.cpp",
309  "api/border_agent_api.cpp",
310  "api/border_router_api.cpp",
311  "api/border_routing_api.cpp",
312  "api/channel_manager_api.cpp",
313  "api/channel_monitor_api.cpp",
314  "api/child_supervision_api.cpp",
315  "api/coap_api.cpp",
316  "api/coap_secure_api.cpp",
317  "api/commissioner_api.cpp",
318  "api/crypto_api.cpp",
319  "api/dataset_api.cpp",
320  "api/dataset_ftd_api.cpp",
321  "api/dataset_updater_api.cpp",
322  "api/diags_api.cpp",
323  "api/dns_api.cpp",
324  "api/dns_server_api.cpp",
325  "api/error_api.cpp",
326  "api/heap_api.cpp",
327  "api/history_tracker_api.cpp",
328  "api/icmp6_api.cpp",
329  "api/instance_api.cpp",
330  "api/ip6_api.cpp",
331  "api/jam_detection_api.cpp",
332  "api/joiner_api.cpp",
333  "api/link_api.cpp",
334  "api/link_metrics_api.cpp",
335  "api/link_raw_api.cpp",
336  "api/logging_api.cpp",
337  "api/mesh_diag_api.cpp",
338  "api/message_api.cpp",
339  "api/multi_radio_api.cpp",
340  "api/nat64_api.cpp",
341  "api/netdata_api.cpp",
342  "api/netdata_publisher_api.cpp",
343  "api/netdiag_api.cpp",
344  "api/network_time_api.cpp",
345  "api/ping_sender_api.cpp",
346  "api/radio_stats_api.cpp",
347  "api/random_crypto_api.cpp",
348  "api/random_noncrypto_api.cpp",
349  "api/server_api.cpp",
350  "api/sntp_api.cpp",
351  "api/srp_client_api.cpp",
352  "api/srp_client_buffers_api.cpp",
353  "api/srp_server_api.cpp",
354  "api/tasklet_api.cpp",
355  "api/tcp_api.cpp",
356  "api/tcp_ext_api.cpp",
357  "api/thread_api.cpp",
358  "api/thread_ftd_api.cpp",
359  "api/trel_api.cpp",
360  "api/udp_api.cpp",
361  "backbone_router/backbone_tmf.cpp",
362  "backbone_router/backbone_tmf.hpp",
363  "backbone_router/bbr_leader.cpp",
364  "backbone_router/bbr_leader.hpp",
365  "backbone_router/bbr_local.cpp",
366  "backbone_router/bbr_local.hpp",
367  "backbone_router/bbr_manager.cpp",
368  "backbone_router/bbr_manager.hpp",
369  "backbone_router/multicast_listeners_table.cpp",
370  "backbone_router/multicast_listeners_table.hpp",
371  "backbone_router/ndproxy_table.cpp",
372  "backbone_router/ndproxy_table.hpp",
373  "border_router/infra_if.cpp",
374  "border_router/infra_if.hpp",
375  "border_router/routing_manager.cpp",
376  "border_router/routing_manager.hpp",
377  "coap/coap.cpp",
378  "coap/coap.hpp",
379  "coap/coap_message.cpp",
380  "coap/coap_message.hpp",
381  "coap/coap_secure.cpp",
382  "coap/coap_secure.hpp",
383  "common/appender.cpp",
384  "common/appender.hpp",
385  "common/arg_macros.hpp",
386  "common/array.hpp",
387  "common/as_core_type.hpp",
388  "common/binary_search.cpp",
389  "common/binary_search.hpp",
390  "common/bit_vector.hpp",
391  "common/callback.hpp",
392  "common/clearable.hpp",
393  "common/code_utils.hpp",
394  "common/const_cast.hpp",
395  "common/crc16.cpp",
396  "common/crc16.hpp",
397  "common/data.cpp",
398  "common/data.hpp",
399  "common/debug.hpp",
400  "common/encoding.hpp",
401  "common/equatable.hpp",
402  "common/error.cpp",
403  "common/error.hpp",
404  "common/frame_builder.cpp",
405  "common/frame_builder.hpp",
406  "common/frame_data.cpp",
407  "common/frame_data.hpp",
408  "common/heap.cpp",
409  "common/heap.hpp",
410  "common/heap_allocatable.hpp",
411  "common/heap_array.hpp",
412  "common/heap_data.cpp",
413  "common/heap_data.hpp",
414  "common/heap_string.cpp",
415  "common/heap_string.hpp",
416  "common/iterator_utils.hpp",
417  "common/linked_list.hpp",
418  "common/locator.hpp",
419  "common/locator_getters.hpp",
420  "common/log.cpp",
421  "common/log.hpp",
422  "common/logging.hpp",
423  "common/message.cpp",
424  "common/message.hpp",
425  "common/new.hpp",
426  "common/non_copyable.hpp",
427  "common/notifier.cpp",
428  "common/notifier.hpp",
429  "common/num_utils.hpp",
430  "common/numeric_limits.hpp",
431  "common/owned_ptr.hpp",
432  "common/owning_list.hpp",
433  "common/pool.hpp",
434  "common/preference.cpp",
435  "common/preference.hpp",
436  "common/ptr_wrapper.hpp",
437  "common/random.cpp",
438  "common/random.hpp",
439  "common/retain_ptr.hpp",
440  "common/serial_number.hpp",
441  "common/settings.cpp",
442  "common/settings.hpp",
443  "common/settings_driver.hpp",
444  "common/string.cpp",
445  "common/string.hpp",
446  "common/tasklet.cpp",
447  "common/tasklet.hpp",
448  "common/time.hpp",
449  "common/time_ticker.cpp",
450  "common/time_ticker.hpp",
451  "common/timer.cpp",
452  "common/timer.hpp",
453  "common/tlvs.cpp",
454  "common/tlvs.hpp",
455  "common/trickle_timer.cpp",
456  "common/trickle_timer.hpp",
457  "common/type_traits.hpp",
458  "common/uptime.cpp",
459  "common/uptime.hpp",
460  "crypto/aes_ccm.cpp",
461  "crypto/aes_ccm.hpp",
462  "crypto/aes_ecb.cpp",
463  "crypto/aes_ecb.hpp",
464  "crypto/context_size.hpp",
465  "crypto/crypto_platform.cpp",
466  "crypto/ecdsa.hpp",
467  "crypto/hkdf_sha256.cpp",
468  "crypto/hkdf_sha256.hpp",
469  "crypto/hmac_sha256.cpp",
470  "crypto/hmac_sha256.hpp",
471  "crypto/mbedtls.cpp",
472  "crypto/mbedtls.hpp",
473  "crypto/sha256.cpp",
474  "crypto/sha256.hpp",
475  "crypto/storage.cpp",
476  "crypto/storage.hpp",
477  "diags/factory_diags.cpp",
478  "diags/factory_diags.hpp",
479  "instance/extension.hpp",
480  "instance/instance.cpp",
481  "instance/instance.hpp",
482  "mac/channel_mask.cpp",
483  "mac/channel_mask.hpp",
484  "mac/data_poll_handler.cpp",
485  "mac/data_poll_handler.hpp",
486  "mac/data_poll_sender.cpp",
487  "mac/data_poll_sender.hpp",
488  "mac/link_raw.cpp",
489  "mac/link_raw.hpp",
490  "mac/mac.cpp",
491  "mac/mac.hpp",
492  "mac/mac_filter.cpp",
493  "mac/mac_filter.hpp",
494  "mac/mac_frame.cpp",
495  "mac/mac_frame.hpp",
496  "mac/mac_links.cpp",
497  "mac/mac_links.hpp",
498  "mac/mac_types.cpp",
499  "mac/mac_types.hpp",
500  "mac/sub_mac.cpp",
501  "mac/sub_mac.hpp",
502  "mac/sub_mac_callbacks.cpp",
503  "meshcop/announce_begin_client.cpp",
504  "meshcop/announce_begin_client.hpp",
505  "meshcop/border_agent.cpp",
506  "meshcop/border_agent.hpp",
507  "meshcop/commissioner.cpp",
508  "meshcop/commissioner.hpp",
509  "meshcop/dataset.cpp",
510  "meshcop/dataset.hpp",
511  "meshcop/dataset_local.cpp",
512  "meshcop/dataset_local.hpp",
513  "meshcop/dataset_manager.cpp",
514  "meshcop/dataset_manager.hpp",
515  "meshcop/dataset_manager_ftd.cpp",
516  "meshcop/dataset_updater.cpp",
517  "meshcop/dataset_updater.hpp",
518  "meshcop/energy_scan_client.cpp",
519  "meshcop/energy_scan_client.hpp",
520  "meshcop/extended_panid.cpp",
521  "meshcop/extended_panid.hpp",
522  "meshcop/joiner.cpp",
523  "meshcop/joiner.hpp",
524  "meshcop/joiner_router.cpp",
525  "meshcop/joiner_router.hpp",
526  "meshcop/meshcop.cpp",
527  "meshcop/meshcop.hpp",
528  "meshcop/meshcop_leader.cpp",
529  "meshcop/meshcop_leader.hpp",
530  "meshcop/meshcop_tlvs.cpp",
531  "meshcop/meshcop_tlvs.hpp",
532  "meshcop/network_name.cpp",
533  "meshcop/network_name.hpp",
534  "meshcop/panid_query_client.cpp",
535  "meshcop/panid_query_client.hpp",
536  "meshcop/secure_transport.cpp",
537  "meshcop/secure_transport.hpp",
538  "meshcop/tcat_agent.cpp",
539  "meshcop/tcat_agent.hpp",
540  "meshcop/timestamp.cpp",
541  "meshcop/timestamp.hpp",
542  "net/checksum.cpp",
543  "net/checksum.hpp",
544  "net/dhcp6.hpp",
545  "net/dhcp6_client.cpp",
546  "net/dhcp6_client.hpp",
547  "net/dhcp6_server.cpp",
548  "net/dhcp6_server.hpp",
549  "net/dns_client.cpp",
550  "net/dns_client.hpp",
551  "net/dns_dso.cpp",
552  "net/dns_dso.hpp",
553  "net/dns_platform.cpp",
554  "net/dns_types.cpp",
555  "net/dns_types.hpp",
556  "net/dnssd_server.cpp",
557  "net/dnssd_server.hpp",
558  "net/icmp6.cpp",
559  "net/icmp6.hpp",
560  "net/ip4_types.cpp",
561  "net/ip4_types.hpp",
562  "net/ip6.cpp",
563  "net/ip6.hpp",
564  "net/ip6_address.cpp",
565  "net/ip6_address.hpp",
566  "net/ip6_filter.cpp",
567  "net/ip6_filter.hpp",
568  "net/ip6_headers.cpp",
569  "net/ip6_headers.hpp",
570  "net/ip6_mpl.cpp",
571  "net/ip6_mpl.hpp",
572  "net/ip6_types.hpp",
573  "net/nat64_translator.cpp",
574  "net/nat64_translator.hpp",
575  "net/nd6.cpp",
576  "net/nd6.hpp",
577  "net/nd_agent.cpp",
578  "net/nd_agent.hpp",
579  "net/netif.cpp",
580  "net/netif.hpp",
581  "net/sntp_client.cpp",
582  "net/sntp_client.hpp",
583  "net/socket.cpp",
584  "net/socket.hpp",
585  "net/srp_client.cpp",
586  "net/srp_client.hpp",
587  "net/srp_server.cpp",
588  "net/srp_server.hpp",
589  "net/tcp6.cpp",
590  "net/tcp6.hpp",
591  "net/tcp6_ext.cpp",
592  "net/tcp6_ext.hpp",
593  "net/udp6.cpp",
594  "net/udp6.hpp",
595  "radio/ble_secure.cpp",
596  "radio/ble_secure.hpp",
597  "radio/max_power_table.hpp",
598  "radio/radio.cpp",
599  "radio/radio.hpp",
600  "radio/radio_callbacks.cpp",
601  "radio/radio_platform.cpp",
602  "radio/trel_interface.cpp",
603  "radio/trel_interface.hpp",
604  "radio/trel_link.cpp",
605  "radio/trel_link.hpp",
606  "radio/trel_packet.cpp",
607  "radio/trel_packet.hpp",
608  "thread/address_resolver.cpp",
609  "thread/address_resolver.hpp",
610  "thread/announce_begin_server.cpp",
611  "thread/announce_begin_server.hpp",
612  "thread/announce_sender.cpp",
613  "thread/announce_sender.hpp",
614  "thread/anycast_locator.cpp",
615  "thread/anycast_locator.hpp",
616  "thread/child.cpp",
617  "thread/child.hpp",
618  "thread/child_mask.hpp",
619  "thread/child_supervision.cpp",
620  "thread/child_supervision.hpp",
621  "thread/child_table.cpp",
622  "thread/child_table.hpp",
623  "thread/csl_tx_scheduler.cpp",
624  "thread/csl_tx_scheduler.hpp",
625  "thread/discover_scanner.cpp",
626  "thread/discover_scanner.hpp",
627  "thread/dua_manager.cpp",
628  "thread/dua_manager.hpp",
629  "thread/energy_scan_server.cpp",
630  "thread/energy_scan_server.hpp",
631  "thread/indirect_sender.cpp",
632  "thread/indirect_sender.hpp",
633  "thread/indirect_sender_frame_context.hpp",
634  "thread/key_manager.cpp",
635  "thread/key_manager.hpp",
636  "thread/link_metrics.cpp",
637  "thread/link_metrics.hpp",
638  "thread/link_metrics_tlvs.hpp",
639  "thread/link_metrics_types.cpp",
640  "thread/link_metrics_types.hpp",
641  "thread/link_quality.cpp",
642  "thread/link_quality.hpp",
643  "thread/lowpan.cpp",
644  "thread/lowpan.hpp",
645  "thread/mesh_forwarder.cpp",
646  "thread/mesh_forwarder.hpp",
647  "thread/mesh_forwarder_ftd.cpp",
648  "thread/mesh_forwarder_mtd.cpp",
649  "thread/mle.cpp",
650  "thread/mle.hpp",
651  "thread/mle_router.cpp",
652  "thread/mle_router.hpp",
653  "thread/mle_tlvs.cpp",
654  "thread/mle_tlvs.hpp",
655  "thread/mle_types.cpp",
656  "thread/mle_types.hpp",
657  "thread/mlr_manager.cpp",
658  "thread/mlr_manager.hpp",
659  "thread/mlr_types.hpp",
660  "thread/neighbor.cpp",
661  "thread/neighbor.hpp",
662  "thread/neighbor_table.cpp",
663  "thread/neighbor_table.hpp",
664  "thread/network_data.cpp",
665  "thread/network_data.hpp",
666  "thread/network_data_leader.cpp",
667  "thread/network_data_leader.hpp",
668  "thread/network_data_leader_ftd.cpp",
669  "thread/network_data_local.cpp",
670  "thread/network_data_local.hpp",
671  "thread/network_data_notifier.cpp",
672  "thread/network_data_notifier.hpp",
673  "thread/network_data_publisher.cpp",
674  "thread/network_data_publisher.hpp",
675  "thread/network_data_service.cpp",
676  "thread/network_data_service.hpp",
677  "thread/network_data_tlvs.cpp",
678  "thread/network_data_tlvs.hpp",
679  "thread/network_data_types.cpp",
680  "thread/network_data_types.hpp",
681  "thread/network_diagnostic.cpp",
682  "thread/network_diagnostic.hpp",
683  "thread/network_diagnostic_tlvs.cpp",
684  "thread/network_diagnostic_tlvs.hpp",
685  "thread/panid_query_server.cpp",
686  "thread/panid_query_server.hpp",
687  "thread/radio_selector.cpp",
688  "thread/radio_selector.hpp",
689  "thread/router.cpp",
690  "thread/router.hpp",
691  "thread/router_table.cpp",
692  "thread/router_table.hpp",
693  "thread/src_match_controller.cpp",
694  "thread/src_match_controller.hpp",
695  "thread/thread_netif.cpp",
696  "thread/thread_netif.hpp",
697  "thread/thread_tlvs.hpp",
698  "thread/time_sync_service.cpp",
699  "thread/time_sync_service.hpp",
700  "thread/tmf.cpp",
701  "thread/tmf.hpp",
702  "thread/uri_paths.cpp",
703  "thread/uri_paths.hpp",
704  "thread/version.hpp",
705  "utils/channel_manager.cpp",
706  "utils/channel_manager.hpp",
707  "utils/channel_monitor.cpp",
708  "utils/channel_monitor.hpp",
709  "utils/flash.cpp",
710  "utils/flash.hpp",
711  "utils/heap.cpp",
712  "utils/heap.hpp",
713  "utils/history_tracker.cpp",
714  "utils/history_tracker.hpp",
715  "utils/jam_detector.cpp",
716  "utils/jam_detector.hpp",
717  "utils/link_metrics_manager.cpp",
718  "utils/link_metrics_manager.hpp",
719  "utils/mesh_diag.cpp",
720  "utils/mesh_diag.hpp",
721  "utils/otns.cpp",
722  "utils/otns.hpp",
723  "utils/parse_cmdline.cpp",
724  "utils/parse_cmdline.hpp",
725  "utils/ping_sender.cpp",
726  "utils/ping_sender.hpp",
727  "utils/power_calibration.cpp",
728  "utils/power_calibration.hpp",
729  "utils/slaac_address.cpp",
730  "utils/slaac_address.hpp",
731  "utils/srp_client_buffers.cpp",
732  "utils/srp_client_buffers.hpp",
733]
734
735openthread_radio_sources = [
736  "api/diags_api.cpp",
737  "api/error_api.cpp",
738  "api/instance_api.cpp",
739  "api/link_raw_api.cpp",
740  "api/logging_api.cpp",
741  "api/random_noncrypto_api.cpp",
742  "api/tasklet_api.cpp",
743  "common/binary_search.cpp",
744  "common/binary_search.hpp",
745  "common/error.hpp",
746  "common/frame_builder.cpp",
747  "common/frame_builder.hpp",
748  "common/log.cpp",
749  "common/random.cpp",
750  "common/string.cpp",
751  "common/tasklet.cpp",
752  "common/timer.cpp",
753  "common/uptime.cpp",
754  "crypto/aes_ccm.cpp",
755  "crypto/aes_ecb.cpp",
756  "crypto/crypto_platform.cpp",
757  "crypto/storage.cpp",
758  "diags/factory_diags.cpp",
759  "instance/instance.cpp",
760  "mac/link_raw.cpp",
761  "mac/mac_frame.cpp",
762  "mac/mac_types.cpp",
763  "mac/sub_mac.cpp",
764  "mac/sub_mac_callbacks.cpp",
765  "radio/radio.cpp",
766  "radio/radio_callbacks.cpp",
767  "radio/radio_platform.cpp",
768  "thread/link_quality.cpp",
769  "utils/parse_cmdline.cpp",
770  "utils/power_calibration.cpp",
771]
772
773header_pattern = [
774  "*.h",
775  "*.hpp",
776]
777
778openthread_core_headers = filter_include(openthread_core_files, header_pattern)
779openthread_core_sources = filter_exclude(openthread_core_files, header_pattern)
780
781source_set("libopenthread_core_config") {
782  public = [
783    "config/announce_sender.h",
784    "config/backbone_router.h",
785    "config/border_agent.h",
786    "config/border_router.h",
787    "config/border_routing.h",
788    "config/channel_manager.h",
789    "config/channel_monitor.h",
790    "config/child_supervision.h",
791    "config/coap.h",
792    "config/commissioner.h",
793    "config/crypto.h",
794    "config/dataset_updater.h",
795    "config/dhcp6_client.h",
796    "config/dhcp6_server.h",
797    "config/diag.h",
798    "config/dns_client.h",
799    "config/dns_dso.h",
800    "config/dnssd_server.h",
801    "config/history_tracker.h",
802    "config/ip6.h",
803    "config/joiner.h",
804    "config/link_metrics_manager.h",
805    "config/link_quality.h",
806    "config/link_raw.h",
807    "config/logging.h",
808    "config/mac.h",
809    "config/mesh_diag.h",
810    "config/mesh_forwarder.h",
811    "config/misc.h",
812    "config/mle.h",
813    "config/nat64.h",
814    "config/netdata_publisher.h",
815    "config/network_diagnostic.h",
816    "config/openthread-core-config-check.h",
817    "config/parent_search.h",
818    "config/ping_sender.h",
819    "config/platform.h",
820    "config/power_calibration.h",
821    "config/radio_link.h",
822    "config/secure_transport.h",
823    "config/sntp_client.h",
824    "config/srp_client.h",
825    "config/srp_server.h",
826    "config/time_sync.h",
827    "config/tmf.h",
828    "config/trel.h",
829    "openthread-core-config.h",
830  ]
831  public_configs = [
832    ":core_config",
833    "../..:openthread_config",
834  ]
835  public_deps = [ "../../include/openthread:openthread_config" ]
836  public_deps += openthread_core_config_deps
837}
838
839source_set("libopenthread_core_headers") {
840  public = openthread_core_headers
841  public_deps = [
842    ":libopenthread_core_config",
843    "../../include/openthread",
844  ]
845  visibility += [ "*" ]
846}
847
848group("libopenthread_platform") {
849  public_deps = []
850  if (openthread_external_platform != "") {
851    public_deps += [ openthread_external_platform ]
852  }
853  public_deps += [
854    ":libopenthread_core_headers",
855    "${mbedtls_target}",
856  ]
857}
858
859static_library("libopenthread-ftd") {
860  sources = openthread_core_sources
861  public_deps = [ ":libopenthread_platform" ]
862  public_configs = [ "../..:openthread_ftd_config" ]
863}
864
865static_library("libopenthread-mtd") {
866  sources = openthread_core_sources
867  public_deps = [ ":libopenthread_platform" ]
868  public_configs = [ "../..:openthread_mtd_config" ]
869}
870
871static_library("libopenthread-radio") {
872  sources = openthread_radio_sources
873  public_deps = [ ":libopenthread_platform" ]
874  public_configs = [ "../..:openthread_radio_config" ]
875}
876