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
29option(OT_APP_CLI "enable CLI app" ON)
30option(OT_APP_NCP "enable NCP app" ON)
31option(OT_APP_RCP "enable RCP app" ON)
32
33option(OT_FTD "enable FTD" ON)
34option(OT_MTD "enable MTD" ON)
35option(OT_RCP "enable RCP" ON)
36
37option(OT_LINKER_MAP "generate .map files for example apps" ON)
38
39message(STATUS OT_APP_CLI=${OT_APP_CLI})
40message(STATUS OT_APP_NCP=${OT_APP_NCP})
41message(STATUS OT_APP_RCP=${OT_APP_RCP})
42message(STATUS OT_FTD=${OT_FTD})
43message(STATUS OT_MTD=${OT_MTD})
44message(STATUS OT_RCP=${OT_RCP})
45
46set(OT_CONFIG_VALUES
47    ""
48    "ON"
49    "OFF"
50)
51
52macro(ot_option name ot_config description)
53    # Declare an (ON/OFF/unspecified) OT cmake config with `name`
54    # mapping to OPENTHREAD_CONFIG `ot_config`. Parameter
55    # `description` provides the help string for this OT cmake
56    # config. There is an optional last parameter which if provided
57    # determines the default value for the cmake config. If not
58    # provided empty string is used which will be treated as "not
59    # specified". In this case, the variable `name` would still be
60    # false but the related OPENTHREAD_CONFIG is not added in
61    # `ot-config`.
62
63    if (${ARGC} GREATER 3)
64        set(${name} ${ARGN} CACHE STRING "enable ${description}")
65    else()
66        set(${name} "" CACHE STRING "enable ${description}")
67    endif()
68
69    set_property(CACHE ${name} PROPERTY STRINGS ${OT_CONFIG_VALUES})
70
71    string(COMPARE EQUAL "${${name}}" "" is_empty)
72    if (is_empty)
73        message(STATUS "${name}=\"\"")
74    elseif (${name})
75        message(STATUS "${name}=ON --> ${ot_config}=1")
76        target_compile_definitions(ot-config INTERFACE "${ot_config}=1")
77    else()
78        message(STATUS "${name}=OFF --> ${ot_config}=0")
79        target_compile_definitions(ot-config INTERFACE "${ot_config}=0")
80    endif()
81endmacro()
82
83macro(ot_string_option name ot_config description)
84    # Declare a string OT cmake config with `name` mapping to
85    # OPENTHREAD_CONFIG `ot_config`. Parameter `description` provides
86    # the help string for this OT cmake config. There is an optional
87    # last parameter which if provided determines the default value
88    # for the cmake config. If not provided empty string is used
89    # which will be treated as "not specified".
90
91    if (${ARGC} GREATER 3)
92        set(${name} ${ARGN} CACHE STRING "${description}")
93    else()
94        set(${name} "" CACHE STRING "${description}")
95    endif()
96
97    set_property(CACHE ${name} PROPERTY STRINGS "")
98
99    string(COMPARE EQUAL "${${name}}" "" is_empty)
100    if (is_empty)
101        message(STATUS "${name}=\"\"")
102    else()
103        message(STATUS "${name}=\"${${name}}\" --> ${ot_config}=\"${${name}}\"")
104        target_compile_definitions(ot-config INTERFACE "${ot_config}=\"${${name}}\"")
105    endif()
106endmacro()
107
108macro(ot_int_option name ot_config description)
109    # Declares a integer-value OT cmake config with `name` mapping to
110    # OPENTHREAD_CONFIG `ot_config`. There is an optional last
111    # parameter which if provided determines the default value for
112    # the cmake config. If not provided empty string is used which
113    # will be treated as "not specified".
114
115    if (${ARGC} GREATER 3)
116        set(${name} ${ARGN} CACHE STRING "${description}")
117    else()
118        set(${name} "" CACHE STRING "${description}")
119    endif()
120
121    set_property(CACHE ${name} PROPERTY STRINGS "")
122
123    string(COMPARE EQUAL "${${name}}" "" is_empty)
124    if (is_empty)
125        message(STATUS "${name}=\"\"")
126    elseif("${${name}}" MATCHES "^[0-9]+$")
127        message(STATUS "${name}=\"${${name}}\" --> ${ot_config}=${${name}}")
128        target_compile_definitions(ot-config INTERFACE "${ot_config}=${${name}}")
129    else()
130        message(FATAL_ERROR "${name}=\"${${name}}\" - invalid value, must be integer")
131    endif()
132endmacro()
133
134macro(ot_multi_option name values ot_config ot_value_prefix description)
135    # Declares a multi-value OT cmake config with `name` with valid
136    # values from `values` list mapping to OPENTHREAD_CONFIG
137    # `ot_config`. The `ot_value_prefix` is the prefix string to
138    # construct the OPENTHREAD_CONFIG value. There is an optional
139    # last parameter which if provided determines the default value
140    # for the cmake config. If not provided empty string is used
141    # which will be treated as "not specified".
142
143    if (${ARGC} GREATER 5)
144        set(${name} ${ARGN} CACHE STRING "${description}")
145    else()
146        set(${name} "" CACHE STRING "${description}")
147    endif()
148
149    set_property(CACHE ${name} PROPERTY STRINGS "${${values}}")
150
151    string(COMPARE EQUAL "${${name}}" "" is_empty)
152    if (is_empty)
153        message(STATUS "${name}=\"\"")
154    else()
155        list(FIND ${values} "${${name}}" ot_index)
156        if(ot_index EQUAL -1)
157            message(FATAL_ERROR "${name}=\"${${name}}\" - unknown value, valid values " "${${values}}")
158        else()
159            message(STATUS "${name}=\"${${name}}\" --> ${ot_config}=${ot_value_prefix}${${name}}")
160            target_compile_definitions(ot-config INTERFACE "${ot_config}=${ot_value_prefix}${${name}}")
161        endif()
162    endif()
163endmacro()
164
165message(STATUS "- - - - - - - - - - - - - - - - ")
166message(STATUS "OpenThread ON/OFF/Unspecified Configs")
167
168ot_option(OT_15_4 OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE "802.15.4 radio link")
169ot_option(OT_ANDROID_NDK OPENTHREAD_CONFIG_ANDROID_NDK_ENABLE "enable android NDK")
170ot_option(OT_ANYCAST_LOCATOR OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE "anycast locator")
171ot_option(OT_ASSERT OPENTHREAD_CONFIG_ASSERT_ENABLE "assert function OT_ASSERT()")
172ot_option(OT_BACKBONE_ROUTER OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE "backbone router functionality")
173ot_option(OT_BACKBONE_ROUTER_DUA_NDPROXYING OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE "BBR DUA ND Proxy")
174ot_option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE "BBR MR")
175ot_option(OT_BLE_TCAT OPENTHREAD_CONFIG_BLE_TCAT_ENABLE "Ble based thread commissioning")
176ot_option(OT_BORDER_AGENT OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE "border agent")
177ot_option(OT_BORDER_AGENT_ID OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE "create and save border agent ID")
178ot_option(OT_BORDER_ROUTER OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE "border router")
179ot_option(OT_BORDER_ROUTING OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE "border routing")
180ot_option(OT_BORDER_ROUTING_DHCP6_PD OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE "dhcpv6 pd support in border routing")
181ot_option(OT_BORDER_ROUTING_COUNTERS OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE "border routing counters")
182ot_option(OT_CHANNEL_MANAGER OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE "channel manager")
183ot_option(OT_CHANNEL_MONITOR OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE "channel monitor")
184ot_option(OT_COAP OPENTHREAD_CONFIG_COAP_API_ENABLE "coap api")
185ot_option(OT_COAP_BLOCK OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE "coap block-wise transfer (RFC7959)")
186ot_option(OT_COAP_OBSERVE OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE "coap observe (RFC7641)")
187ot_option(OT_COAPS OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE "secure coap")
188ot_option(OT_COMMISSIONER OPENTHREAD_CONFIG_COMMISSIONER_ENABLE "commissioner")
189ot_option(OT_CSL_AUTO_SYNC OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE "data polling based on csl")
190ot_option(OT_CSL_DEBUG OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE "csl debug")
191ot_option(OT_CSL_RECEIVER OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE "csl receiver")
192ot_option(OT_CSL_RECEIVER_LOCAL_TIME_SYNC OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_LOCAL_TIME_SYNC "use local time for csl elapsed sync time")
193ot_option(OT_DATASET_UPDATER OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE "dataset updater")
194ot_option(OT_DEVICE_PROP_LEADER_WEIGHT OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE "device prop for leader weight")
195ot_option(OT_DHCP6_CLIENT OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE "DHCP6 client")
196ot_option(OT_DHCP6_SERVER OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE "DHCP6 server")
197ot_option(OT_DIAGNOSTIC OPENTHREAD_CONFIG_DIAG_ENABLE "diagnostic")
198ot_option(OT_DNS_CLIENT OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE "DNS client")
199ot_option(OT_DNS_CLIENT_OVER_TCP OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE  "Enable dns query over tcp")
200ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (DSO)")
201ot_option(OT_DNS_UPSTREAM_QUERY OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE "Allow sending DNS queries to upstream")
202ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server")
203ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)")
204ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA")
205ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap")
206ot_option(OT_FIREWALL OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE "firewall")
207ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history tracker")
208ot_option(OT_IP6_FRAGM OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE "ipv6 fragmentation")
209ot_option(OT_JAM_DETECTION OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE "jam detection")
210ot_option(OT_JOINER OPENTHREAD_CONFIG_JOINER_ENABLE "joiner")
211ot_option(OT_LINK_METRICS_INITIATOR OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE "link metrics initiator")
212ot_option(OT_LINK_METRICS_MANAGER  OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE "link metrics manager")
213ot_option(OT_LINK_METRICS_SUBJECT OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE "link metrics subject")
214ot_option(OT_LINK_RAW OPENTHREAD_CONFIG_LINK_RAW_ENABLE "link raw service")
215ot_option(OT_LOG_LEVEL_DYNAMIC OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE "dynamic log level control")
216ot_option(OT_MAC_FILTER OPENTHREAD_CONFIG_MAC_FILTER_ENABLE "mac filter")
217ot_option(OT_MESH_DIAG OPENTHREAD_CONFIG_MESH_DIAG_ENABLE "mesh diag")
218ot_option(OT_MESSAGE_USE_HEAP OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE "heap allocator for message buffers")
219ot_option(OT_MLE_LONG_ROUTES OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE "MLE long routes extension (experimental)")
220ot_option(OT_MLR OPENTHREAD_CONFIG_MLR_ENABLE "Multicast Listener Registration (MLR)")
221ot_option(OT_MULTIPLE_INSTANCE OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE "multiple instances")
222ot_option(OT_NAT64_BORDER_ROUTING OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE "border routing NAT64")
223ot_option(OT_NAT64_TRANSLATOR OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE "NAT64 translator support")
224ot_option(OT_NEIGHBOR_DISCOVERY_AGENT OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE "neighbor discovery agent")
225ot_option(OT_NETDATA_PUBLISHER OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE "Network Data publisher")
226ot_option(OT_NETDIAG_CLIENT OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE "Network Diagnostic client")
227ot_option(OT_OPERATIONAL_DATASET_AUTO_INIT OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT "operational dataset auto init")
228ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS")
229ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI})
230ot_option(OT_PLATFORM_BOOTLOADER_MODE OPENTHREAD_CONFIG_PLATFORM_BOOTLOADER_MODE_ENABLE "platform bootloader mode")
231ot_option(OT_PLATFORM_KEY_REF OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE "platform key reference secure storage")
232ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
233ot_option(OT_PLATFORM_POWER_CALIBRATION OPENTHREAD_CONFIG_PLATFORM_POWER_CALIBRATION_ENABLE "power calibration")
234ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP")
235ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device")
236ot_option(OT_SERVICE OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE "Network Data service")
237ot_option(OT_SETTINGS_RAM OPENTHREAD_SETTINGS_RAM "volatile-only storage of settings")
238ot_option(OT_SLAAC OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE "SLAAC address")
239ot_option(OT_SNTP_CLIENT OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE "SNTP client")
240ot_option(OT_SRP_CLIENT OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE "SRP client")
241ot_option(OT_SRP_SERVER OPENTHREAD_CONFIG_SRP_SERVER_ENABLE "SRP server")
242ot_option(OT_TCP OPENTHREAD_CONFIG_TCP_ENABLE "TCP")
243ot_option(OT_TIME_SYNC OPENTHREAD_CONFIG_TIME_SYNC_ENABLE "time synchronization service")
244ot_option(OT_TREL OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE "TREL radio link for Thread over Infrastructure feature")
245ot_option(OT_TX_BEACON_PAYLOAD OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE "tx beacon payload")
246ot_option(OT_TX_QUEUE_STATS OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE "tx queue statistics")
247ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward")
248ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime")
249
250option(OT_DOC "build OpenThread documentation")
251option(OT_MULTIPAN_RCP "Multi-PAN RCP" OFF)
252message(STATUS "- - - - - - - - - - - - - - - - ")
253
254# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
255# Get a list of the available platforms and output as a list to the 'arg_platforms' argument
256function(ot_get_platforms arg_platforms)
257    list(APPEND result "NO" "posix" "external")
258    set(platforms_dir "${PROJECT_SOURCE_DIR}/examples/platforms")
259    file(GLOB platforms RELATIVE "${platforms_dir}" "${platforms_dir}/*")
260    foreach(platform IN LISTS platforms)
261        if(IS_DIRECTORY "${platforms_dir}/${platform}")
262            list(APPEND result "${platform}")
263        endif()
264    endforeach()
265    list(REMOVE_ITEM result utils)
266    list(SORT result)
267    set(${arg_platforms} "${result}" PARENT_SCOPE)
268endfunction()
269
270ot_get_platforms(OT_PLATFORM_VALUES)
271set(OT_PLATFORM "NO" CACHE STRING "Target platform chosen by the user at configure time")
272set_property(CACHE OT_PLATFORM PROPERTY STRINGS "${OT_PLATFORM_VALUES}")
273message(STATUS "OT_PLATFORM=\"${OT_PLATFORM}\"")
274list(FIND OT_PLATFORM_VALUES "${OT_PLATFORM}" ot_index)
275if(ot_index EQUAL -1)
276    message(FATAL_ERROR "Invalid value for OT_PLATFORM - valid values are:" "${OT_PLATFORM_VALUES}")
277endif()
278
279# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
280set(OT_THREAD_VERSION_VALUES "1.1" "1.2" "1.3" "1.3.1")
281set(OT_THREAD_VERSION "1.3" CACHE STRING "set Thread version")
282set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "${OT_THREAD_VERSION_VALUES}")
283list(FIND OT_THREAD_VERSION_VALUES "${OT_THREAD_VERSION}" ot_index)
284if(ot_index EQUAL -1)
285    message(STATUS "OT_THREAD_VERSION=\"${OT_THREAD_VERSION}\"")
286    message(FATAL_ERROR "Invalid value for OT_THREAD_VERSION - valid values are: " "${OT_THREAD_VERSION_VALUES}")
287endif()
288set(OT_VERSION_SUFFIX_LIST "1_1" "1_2" "1_3" "1_3_1")
289list(GET OT_VERSION_SUFFIX_LIST ${ot_index} OT_VERSION_SUFFIX)
290target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_${OT_VERSION_SUFFIX}")
291message(STATUS "OT_THREAD_VERSION=\"${OT_THREAD_VERSION}\" -> OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_${OT_VERSION_SUFFIX}")
292
293# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
294set(OT_LOG_LEVEL_VALUES "NONE" "CRIT" "WARN" "NOTE" "INFO" "DEBG")
295ot_multi_option(OT_LOG_LEVEL OT_LOG_LEVEL_VALUES OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_ "set OpenThread log level")
296
297option(OT_FULL_LOGS "enable full logs")
298if(OT_FULL_LOGS)
299    if(NOT OT_LOG_LEVEL)
300        message(STATUS "OT_FULL_LOGS=ON --> Setting LOG_LEVEL to DEBG")
301        target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
302    endif()
303    target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
304endif()
305
306# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
307if(OT_REFERENCE_DEVICE AND NOT OT_PLATFORM STREQUAL "posix")
308    set(OT_DEFAULT_LOG_OUTPUT "APP")
309else()
310    set(OT_DEFAULT_LOG_OUTPUT "")
311endif()
312set(OT_LOG_OUTPUT_VALUES "APP" "DEBUG_UART" "NONE" "PLATFORM_DEFINED")
313ot_multi_option(OT_LOG_OUTPUT OT_LOG_OUTPUT_VALUES OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_ "Set the log output" "${OT_DEFAULT_LOG_OUTPUT}")
314
315# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
316
317ot_string_option(OT_VENDOR_NAME OPENTHREAD_CONFIG_NET_DIAG_VENDOR_NAME "set the vendor name config")
318ot_string_option(OT_VENDOR_MODEL OPENTHREAD_CONFIG_NET_DIAG_VENDOR_MODEL "set the vendor model config")
319ot_string_option(OT_VENDOR_SW_VERSION OPENTHREAD_CONFIG_NET_DIAG_VENDOR_SW_VERSION "set the vendor sw version config")
320
321set(OT_POWER_SUPPLY_VALUES "BATTERY" "EXTERNAL" "EXTERNAL_STABLE" "EXTERNAL_UNSTABLE")
322ot_multi_option(OT_POWER_SUPPLY OT_POWER_SUPPLY_VALUES OPENTHREAD_CONFIG_DEVICE_POWER_SUPPLY OT_POWER_SUPPLY_ "set the device power supply config")
323
324ot_int_option(OT_MLE_MAX_CHILDREN OPENTHREAD_CONFIG_MLE_MAX_CHILDREN "set maximum number of children")
325ot_int_option(OT_RCP_RESTORATION_MAX_COUNT OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT "set max RCP restoration count")
326ot_int_option(OT_RCP_TX_WAIT_TIME_SECS OPENTHREAD_SPINEL_CONFIG_RCP_TX_WAIT_TIME_SECS "set RCP TX wait TIME in seconds")
327
328# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
329
330if(NOT OT_EXTERNAL_MBEDTLS)
331    set(OT_MBEDTLS mbedtls)
332    target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1")
333else()
334    set(OT_MBEDTLS ${OT_EXTERNAL_MBEDTLS})
335    target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0")
336endif()
337
338option(OT_BUILTIN_MBEDTLS_MANAGEMENT "enable builtin mbedtls management" ON)
339if(OT_BUILTIN_MBEDTLS_MANAGEMENT)
340    target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=1")
341else()
342    target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0")
343endif()
344
345if(OT_POSIX_SETTINGS_PATH)
346    target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}")
347endif()
348
349#-----------------------------------------------------------------------------------------------------------------------
350# Check removed/replaced options
351
352macro(ot_removed_option name error)
353    # This macro checks for a remove option and emits an error
354    # if the option is set.
355    get_property(is_set CACHE ${name} PROPERTY VALUE SET)
356    if (is_set)
357        message(FATAL_ERROR "Removed option ${name} is set - ${error}")
358    endif()
359endmacro()
360
361ot_removed_option(OT_MTD_NETDIAG "- Use OT_NETDIAG_CLIENT instead - note that server function is always supported")
362ot_removed_option(OT_EXCLUDE_TCPLP_LIB "- Use OT_TCP instead, OT_EXCLUDE_TCPLP_LIB is deprecated")
363ot_removed_option(OT_POSIX_CONFIG_RCP_BUS "- Use OT_POSIX_RCP_HDLC_BUS, OT_POSIX_RCP_SPI_BUS or OT_POSIX_RCP_VENDOR_BUS instead, OT_POSIX_CONFIG_RCP_BUS is deprecated")
364