1#
2#  Copyright (c) 2019, The OpenThread Authors.
3#  All rights reserved.
4#
5#  Redistribution and use in source and binary forms, with or without
6#  modification, are permitted provided that the following conditions are met:
7#  1. Redistributions of source code must retain the above copyright
8#     notice, this list of conditions and the following disclaimer.
9#  2. Redistributions in binary form must reproduce the above copyright
10#     notice, this list of conditions and the following disclaimer in the
11#     documentation and/or other materials provided with the distribution.
12#  3. Neither the name of the copyright holder nor the
13#     names of its contributors may be used to endorse or promote products
14#     derived from this software without specific prior written permission.
15#
16#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26#  POSSIBILITY OF SUCH DAMAGE.
27#
28
29set(COMMON_INCLUDES
30    ${PROJECT_SOURCE_DIR}/src/core
31)
32
33set(COMMON_SOURCES
34    api/backbone_router_api.cpp
35    api/backbone_router_ftd_api.cpp
36    api/ble_secure_api.cpp
37    api/border_agent_api.cpp
38    api/border_router_api.cpp
39    api/border_routing_api.cpp
40    api/channel_manager_api.cpp
41    api/channel_monitor_api.cpp
42    api/child_supervision_api.cpp
43    api/coap_api.cpp
44    api/coap_secure_api.cpp
45    api/commissioner_api.cpp
46    api/crypto_api.cpp
47    api/dataset_api.cpp
48    api/dataset_ftd_api.cpp
49    api/dataset_updater_api.cpp
50    api/diags_api.cpp
51    api/dns_api.cpp
52    api/dns_server_api.cpp
53    api/error_api.cpp
54    api/heap_api.cpp
55    api/history_tracker_api.cpp
56    api/icmp6_api.cpp
57    api/instance_api.cpp
58    api/ip6_api.cpp
59    api/jam_detection_api.cpp
60    api/joiner_api.cpp
61    api/link_api.cpp
62    api/link_metrics_api.cpp
63    api/link_raw_api.cpp
64    api/logging_api.cpp
65    api/mdns_api.cpp
66    api/mesh_diag_api.cpp
67    api/message_api.cpp
68    api/multi_radio_api.cpp
69    api/nat64_api.cpp
70    api/netdata_api.cpp
71    api/netdata_publisher_api.cpp
72    api/netdiag_api.cpp
73    api/network_time_api.cpp
74    api/ping_sender_api.cpp
75    api/radio_stats_api.cpp
76    api/random_crypto_api.cpp
77    api/random_noncrypto_api.cpp
78    api/server_api.cpp
79    api/sntp_api.cpp
80    api/srp_client_api.cpp
81    api/srp_client_buffers_api.cpp
82    api/srp_server_api.cpp
83    api/tasklet_api.cpp
84    api/tcp_api.cpp
85    api/tcp_ext_api.cpp
86    api/thread_api.cpp
87    api/thread_ftd_api.cpp
88    api/trel_api.cpp
89    api/udp_api.cpp
90    api/verhoeff_checksum_api.cpp
91    backbone_router/backbone_tmf.cpp
92    backbone_router/bbr_leader.cpp
93    backbone_router/bbr_local.cpp
94    backbone_router/bbr_manager.cpp
95    backbone_router/multicast_listeners_table.cpp
96    backbone_router/ndproxy_table.cpp
97    border_router/infra_if.cpp
98    border_router/routing_manager.cpp
99    coap/coap.cpp
100    coap/coap_message.cpp
101    coap/coap_secure.cpp
102    common/appender.cpp
103    common/binary_search.cpp
104    common/crc16.cpp
105    common/data.cpp
106    common/error.cpp
107    common/frame_builder.cpp
108    common/frame_data.cpp
109    common/heap.cpp
110    common/heap_data.cpp
111    common/heap_string.cpp
112    common/log.cpp
113    common/message.cpp
114    common/notifier.cpp
115    common/offset_range.cpp
116    common/preference.cpp
117    common/random.cpp
118    common/settings.cpp
119    common/string.cpp
120    common/tasklet.cpp
121    common/time_ticker.cpp
122    common/timer.cpp
123    common/tlvs.cpp
124    common/trickle_timer.cpp
125    common/uptime.cpp
126    crypto/aes_ccm.cpp
127    crypto/aes_ecb.cpp
128    crypto/crypto_platform.cpp
129    crypto/hkdf_sha256.cpp
130    crypto/hmac_sha256.cpp
131    crypto/mbedtls.cpp
132    crypto/sha256.cpp
133    crypto/storage.cpp
134    diags/factory_diags.cpp
135    instance/instance.cpp
136    mac/channel_mask.cpp
137    mac/data_poll_handler.cpp
138    mac/data_poll_sender.cpp
139    mac/link_raw.cpp
140    mac/mac.cpp
141    mac/mac_filter.cpp
142    mac/mac_frame.cpp
143    mac/mac_header_ie.cpp
144    mac/mac_links.cpp
145    mac/mac_types.cpp
146    mac/sub_mac.cpp
147    mac/sub_mac_callbacks.cpp
148    mac/sub_mac_csl_receiver.cpp
149    mac/sub_mac_wed.cpp
150    mac/wakeup_tx_scheduler.cpp
151    meshcop/announce_begin_client.cpp
152    meshcop/border_agent.cpp
153    meshcop/commissioner.cpp
154    meshcop/dataset.cpp
155    meshcop/dataset_manager.cpp
156    meshcop/dataset_manager_ftd.cpp
157    meshcop/dataset_updater.cpp
158    meshcop/energy_scan_client.cpp
159    meshcop/extended_panid.cpp
160    meshcop/joiner.cpp
161    meshcop/joiner_router.cpp
162    meshcop/meshcop.cpp
163    meshcop/meshcop_leader.cpp
164    meshcop/meshcop_tlvs.cpp
165    meshcop/network_name.cpp
166    meshcop/panid_query_client.cpp
167    meshcop/secure_transport.cpp
168    meshcop/tcat_agent.cpp
169    meshcop/timestamp.cpp
170    net/checksum.cpp
171    net/dhcp6_client.cpp
172    net/dhcp6_server.cpp
173    net/dns_client.cpp
174    net/dns_dso.cpp
175    net/dns_platform.cpp
176    net/dns_types.cpp
177    net/dnssd.cpp
178    net/dnssd_server.cpp
179    net/icmp6.cpp
180    net/ip4_types.cpp
181    net/ip6.cpp
182    net/ip6_address.cpp
183    net/ip6_filter.cpp
184    net/ip6_headers.cpp
185    net/ip6_mpl.cpp
186    net/mdns.cpp
187    net/nat64_translator.cpp
188    net/nd6.cpp
189    net/nd_agent.cpp
190    net/netif.cpp
191    net/sntp_client.cpp
192    net/socket.cpp
193    net/srp_advertising_proxy.cpp
194    net/srp_client.cpp
195    net/srp_server.cpp
196    net/tcp6.cpp
197    net/tcp6_ext.cpp
198    net/udp6.cpp
199    radio/ble_secure.cpp
200    radio/radio.cpp
201    radio/radio_callbacks.cpp
202    radio/radio_platform.cpp
203    radio/trel_interface.cpp
204    radio/trel_link.cpp
205    radio/trel_packet.cpp
206    thread/address_resolver.cpp
207    thread/announce_begin_server.cpp
208    thread/announce_sender.cpp
209    thread/anycast_locator.cpp
210    thread/child.cpp
211    thread/child_supervision.cpp
212    thread/child_table.cpp
213    thread/csl_tx_scheduler.cpp
214    thread/discover_scanner.cpp
215    thread/dua_manager.cpp
216    thread/energy_scan_server.cpp
217    thread/indirect_sender.cpp
218    thread/key_manager.cpp
219    thread/link_metrics.cpp
220    thread/link_metrics_types.cpp
221    thread/link_quality.cpp
222    thread/lowpan.cpp
223    thread/mesh_forwarder.cpp
224    thread/mesh_forwarder_ftd.cpp
225    thread/mesh_forwarder_mtd.cpp
226    thread/mle.cpp
227    thread/mle_router.cpp
228    thread/mle_tlvs.cpp
229    thread/mle_types.cpp
230    thread/mlr_manager.cpp
231    thread/neighbor.cpp
232    thread/neighbor_table.cpp
233    thread/network_data.cpp
234    thread/network_data_leader.cpp
235    thread/network_data_leader_ftd.cpp
236    thread/network_data_local.cpp
237    thread/network_data_notifier.cpp
238    thread/network_data_publisher.cpp
239    thread/network_data_service.cpp
240    thread/network_data_tlvs.cpp
241    thread/network_data_types.cpp
242    thread/network_diagnostic.cpp
243    thread/network_diagnostic_tlvs.cpp
244    thread/panid_query_server.cpp
245    thread/radio_selector.cpp
246    thread/router.cpp
247    thread/router_table.cpp
248    thread/src_match_controller.cpp
249    thread/thread_netif.cpp
250    thread/time_sync_service.cpp
251    thread/tmf.cpp
252    thread/uri_paths.cpp
253    utils/channel_manager.cpp
254    utils/channel_monitor.cpp
255    utils/flash.cpp
256    utils/heap.cpp
257    utils/history_tracker.cpp
258    utils/jam_detector.cpp
259    utils/link_metrics_manager.cpp
260    utils/mesh_diag.cpp
261    utils/otns.cpp
262    utils/parse_cmdline.cpp
263    utils/ping_sender.cpp
264    utils/power_calibration.cpp
265    utils/slaac_address.cpp
266    utils/srp_client_buffers.cpp
267    utils/verhoeff_checksum.cpp
268)
269
270set(RADIO_COMMON_SOURCES
271    api/diags_api.cpp
272    api/error_api.cpp
273    api/instance_api.cpp
274    api/link_raw_api.cpp
275    api/logging_api.cpp
276    api/random_noncrypto_api.cpp
277    api/tasklet_api.cpp
278    common/binary_search.cpp
279    common/error.cpp
280    common/frame_builder.cpp
281    common/log.cpp
282    common/random.cpp
283    common/string.cpp
284    common/tasklet.cpp
285    common/timer.cpp
286    common/uptime.cpp
287    crypto/aes_ccm.cpp
288    crypto/aes_ecb.cpp
289    crypto/crypto_platform.cpp
290    crypto/storage.cpp
291    diags/factory_diags.cpp
292    instance/instance.cpp
293    mac/link_raw.cpp
294    mac/mac_frame.cpp
295    mac/mac_header_ie.cpp
296    mac/mac_types.cpp
297    mac/sub_mac.cpp
298    mac/sub_mac_callbacks.cpp
299    mac/sub_mac_csl_receiver.cpp
300    mac/sub_mac_wed.cpp
301    radio/radio.cpp
302    radio/radio_callbacks.cpp
303    radio/radio_platform.cpp
304    thread/link_quality.cpp
305    utils/parse_cmdline.cpp
306    utils/power_calibration.cpp
307)
308
309set(OT_VENDOR_EXTENSION "" CACHE STRING "specify a C++ source file built as part of OpenThread core library")
310if(OT_VENDOR_EXTENSION)
311  target_compile_definitions(ot-config INTERFACE "OPENTHREAD_ENABLE_VENDOR_EXTENSION=1")
312  list(APPEND COMMON_SOURCES ${OT_VENDOR_EXTENSION})
313endif()
314
315if(OT_FTD)
316    include(ftd.cmake)
317endif()
318
319if(OT_MTD)
320    include(mtd.cmake)
321endif()
322
323if(OT_RCP)
324    include(radio.cmake)
325    if (OT_APP_CLI)
326        include(radio_cli.cmake)
327    endif()
328endif()
329
330set_property(SOURCE api/instance_api.cpp
331    APPEND PROPERTY COMPILE_DEFINITIONS "PACKAGE_VERSION=\"${OT_PACKAGE_VERSION}\""
332)
333