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