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_BORDER_AGENT OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE "border agent") 176ot_option(OT_BORDER_AGENT_ID OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE "create and save border agent ID") 177ot_option(OT_BORDER_ROUTER OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE "border router") 178ot_option(OT_BORDER_ROUTING OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE "border routing") 179ot_option(OT_BORDER_ROUTING_DHCP6_PD OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE "dhcpv6 pd support in border routing") 180ot_option(OT_BORDER_ROUTING_COUNTERS OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE "border routing counters") 181ot_option(OT_CHANNEL_MANAGER OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE "channel manager") 182ot_option(OT_CHANNEL_MONITOR OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE "channel monitor") 183ot_option(OT_COAP OPENTHREAD_CONFIG_COAP_API_ENABLE "coap api") 184ot_option(OT_COAP_BLOCK OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE "coap block-wise transfer (RFC7959)") 185ot_option(OT_COAP_OBSERVE OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE "coap observe (RFC7641)") 186ot_option(OT_COAPS OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE "secure coap") 187ot_option(OT_COMMISSIONER OPENTHREAD_CONFIG_COMMISSIONER_ENABLE "commissioner") 188ot_option(OT_CSL_AUTO_SYNC OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE "data polling based on csl") 189ot_option(OT_CSL_DEBUG OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE "csl debug") 190ot_option(OT_CSL_RECEIVER OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE "csl receiver") 191ot_option(OT_DATASET_UPDATER OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE "dataset updater") 192ot_option(OT_DEVICE_PROP_LEADER_WEIGHT OPENTHREAD_CONFIG_MLE_DEVICE_PROPERTY_LEADER_WEIGHT_ENABLE "device prop for leader weight") 193ot_option(OT_DHCP6_CLIENT OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE "DHCP6 client") 194ot_option(OT_DHCP6_SERVER OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE "DHCP6 server") 195ot_option(OT_DIAGNOSTIC OPENTHREAD_CONFIG_DIAG_ENABLE "diagnostic") 196ot_option(OT_DNS_CLIENT OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE "DNS client") 197ot_option(OT_DNS_CLIENT_OVER_TCP OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE "Enable dns query over tcp") 198ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (DSO)") 199ot_option(OT_DNS_UPSTREAM_QUERY OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE "Allow sending DNS queries to upstream") 200ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server") 201ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)") 202ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA") 203ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap") 204ot_option(OT_FIREWALL OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE "firewall") 205ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history tracker") 206ot_option(OT_IP6_FRAGM OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE "ipv6 fragmentation") 207ot_option(OT_JAM_DETECTION OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE "jam detection") 208ot_option(OT_JOINER OPENTHREAD_CONFIG_JOINER_ENABLE "joiner") 209ot_option(OT_LINK_METRICS_INITIATOR OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE "link metrics initiator") 210ot_option(OT_LINK_METRICS_MANAGER OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE "link metrics manager") 211ot_option(OT_LINK_METRICS_SUBJECT OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE "link metrics subject") 212ot_option(OT_LINK_RAW OPENTHREAD_CONFIG_LINK_RAW_ENABLE "link raw service") 213ot_option(OT_LOG_LEVEL_DYNAMIC OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE "dynamic log level control") 214ot_option(OT_MAC_FILTER OPENTHREAD_CONFIG_MAC_FILTER_ENABLE "mac filter") 215ot_option(OT_MESH_DIAG OPENTHREAD_CONFIG_MESH_DIAG_ENABLE "mesh diag") 216ot_option(OT_MESSAGE_USE_HEAP OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE "heap allocator for message buffers") 217ot_option(OT_MLE_LONG_ROUTES OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE "MLE long routes extension (experimental)") 218ot_option(OT_MLR OPENTHREAD_CONFIG_MLR_ENABLE "Multicast Listener Registration (MLR)") 219ot_option(OT_MULTIPLE_INSTANCE OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE "multiple instances") 220ot_option(OT_NAT64_BORDER_ROUTING OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE "border routing NAT64") 221ot_option(OT_NAT64_TRANSLATOR OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE "NAT64 translator support") 222ot_option(OT_NEIGHBOR_DISCOVERY_AGENT OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE "neighbor discovery agent") 223ot_option(OT_NETDATA_PUBLISHER OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE "Network Data publisher") 224ot_option(OT_NETDIAG_CLIENT OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE "Network Diagnostic client") 225ot_option(OT_OPERATIONAL_DATASET_AUTO_INIT OPENTHREAD_CONFIG_OPERATIONAL_DATASET_AUTO_INIT "operational dataset auto init") 226ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS") 227ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI}) 228ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif") 229ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP") 230ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device") 231ot_option(OT_SERVICE OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE "Network Data service") 232ot_option(OT_SETTINGS_RAM OPENTHREAD_SETTINGS_RAM "volatile-only storage of settings") 233ot_option(OT_SLAAC OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE "SLAAC address") 234ot_option(OT_SNTP_CLIENT OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE "SNTP client") 235ot_option(OT_SRP_CLIENT OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE "SRP client") 236ot_option(OT_SRP_SERVER OPENTHREAD_CONFIG_SRP_SERVER_ENABLE "SRP server") 237ot_option(OT_TCP OPENTHREAD_CONFIG_TCP_ENABLE "TCP") 238ot_option(OT_TIME_SYNC OPENTHREAD_CONFIG_TIME_SYNC_ENABLE "time synchronization service") 239ot_option(OT_TREL OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE "TREL radio link for Thread over Infrastructure feature") 240ot_option(OT_TX_BEACON_PAYLOAD OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE "tx beacon payload") 241ot_option(OT_TX_QUEUE_STATS OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE "tx queue statistics") 242ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward") 243ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime") 244 245option(OT_DOC "build OpenThread documentation") 246 247message(STATUS "- - - - - - - - - - - - - - - - ") 248 249# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 250# Get a list of the available platforms and output as a list to the 'arg_platforms' argument 251function(ot_get_platforms arg_platforms) 252 list(APPEND result "NO" "posix" "external") 253 set(platforms_dir "${PROJECT_SOURCE_DIR}/examples/platforms") 254 file(GLOB platforms RELATIVE "${platforms_dir}" "${platforms_dir}/*") 255 foreach(platform IN LISTS platforms) 256 if(IS_DIRECTORY "${platforms_dir}/${platform}") 257 list(APPEND result "${platform}") 258 endif() 259 endforeach() 260 list(REMOVE_ITEM result utils) 261 list(SORT result) 262 set(${arg_platforms} "${result}" PARENT_SCOPE) 263endfunction() 264 265ot_get_platforms(OT_PLATFORM_VALUES) 266set(OT_PLATFORM "NO" CACHE STRING "Target platform chosen by the user at configure time") 267set_property(CACHE OT_PLATFORM PROPERTY STRINGS "${OT_PLATFORM_VALUES}") 268message(STATUS "OT_PLATFORM=\"${OT_PLATFORM}\"") 269list(FIND OT_PLATFORM_VALUES "${OT_PLATFORM}" ot_index) 270if(ot_index EQUAL -1) 271 message(FATAL_ERROR "Invalid value for OT_PLATFORM - valid values are:" "${OT_PLATFORM_VALUES}") 272endif() 273 274# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 275set(OT_THREAD_VERSION_VALUES "1.1" "1.2" "1.3" "1.3.1") 276set(OT_THREAD_VERSION "1.3" CACHE STRING "set Thread version") 277set_property(CACHE OT_THREAD_VERSION PROPERTY STRINGS "${OT_THREAD_VERSION_VALUES}") 278list(FIND OT_THREAD_VERSION_VALUES "${OT_THREAD_VERSION}" ot_index) 279if(ot_index EQUAL -1) 280 message(STATUS "OT_THREAD_VERSION=\"${OT_THREAD_VERSION}\"") 281 message(FATAL_ERROR "Invalid value for OT_THREAD_VERSION - valid values are: " "${OT_THREAD_VERSION_VALUES}") 282endif() 283set(OT_VERSION_SUFFIX_LIST "1_1" "1_2" "1_3" "1_3_1") 284list(GET OT_VERSION_SUFFIX_LIST ${ot_index} OT_VERSION_SUFFIX) 285target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_${OT_VERSION_SUFFIX}") 286message(STATUS "OT_THREAD_VERSION=\"${OT_THREAD_VERSION}\" -> OPENTHREAD_CONFIG_THREAD_VERSION=OT_THREAD_VERSION_${OT_VERSION_SUFFIX}") 287 288# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 289set(OT_LOG_LEVEL_VALUES "NONE" "CRIT" "WARN" "NOTE" "INFO" "DEBG") 290ot_multi_option(OT_LOG_LEVEL OT_LOG_LEVEL_VALUES OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_ "set OpenThread log level") 291 292option(OT_FULL_LOGS "enable full logs") 293if(OT_FULL_LOGS) 294 if(NOT OT_LOG_LEVEL) 295 message(STATUS "OT_FULL_LOGS=ON --> Setting LOG_LEVEL to DEBG") 296 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG") 297 endif() 298 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1") 299endif() 300 301# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 302if(OT_REFERENCE_DEVICE AND NOT OT_PLATFORM STREQUAL "posix") 303 set(OT_DEFAULT_LOG_OUTPUT "APP") 304else() 305 set(OT_DEFAULT_LOG_OUTPUT "") 306endif() 307set(OT_LOG_OUTPUT_VALUES "APP" "DEBUG_UART" "NONE" "PLATFORM_DEFINED") 308ot_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}") 309 310# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 311 312ot_string_option(OT_VENDOR_NAME OPENTHREAD_CONFIG_NET_DIAG_VENDOR_NAME "set the vendor name config") 313ot_string_option(OT_VENDOR_MODEL OPENTHREAD_CONFIG_NET_DIAG_VENDOR_MODEL "set the vendor model config") 314ot_string_option(OT_VENDOR_SW_VERSION OPENTHREAD_CONFIG_NET_DIAG_VENDOR_SW_VERSION "set the vendor sw version config") 315 316set(OT_POWER_SUPPLY_VALUES "BATTERY" "EXTERNAL" "EXTERNAL_STABLE" "EXTERNAL_UNSTABLE") 317ot_multi_option(OT_POWER_SUPPLY OT_POWER_SUPPLY_VALUES OPENTHREAD_CONFIG_DEVICE_POWER_SUPPLY OT_POWER_SUPPLY_ "set the device power supply config") 318 319ot_int_option(OT_MLE_MAX_CHILDREN OPENTHREAD_CONFIG_MLE_MAX_CHILDREN "set maximum number of children") 320ot_int_option(OT_RCP_RESTORATION_MAX_COUNT OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT "set max RCP restoration count") 321 322# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 323 324if(NOT OT_EXTERNAL_MBEDTLS) 325 set(OT_MBEDTLS mbedtls) 326 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=1") 327else() 328 set(OT_MBEDTLS ${OT_EXTERNAL_MBEDTLS}) 329 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS=0") 330endif() 331 332option(OT_BUILTIN_MBEDTLS_MANAGEMENT "enable builtin mbedtls management" ON) 333if(OT_BUILTIN_MBEDTLS_MANAGEMENT) 334 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=1") 335else() 336 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0") 337endif() 338 339if(OT_POSIX_SETTINGS_PATH) 340 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}") 341endif() 342 343#----------------------------------------------------------------------------------------------------------------------- 344# Check removed/replaced options 345 346macro(ot_removed_option name error) 347 # This macro checks for a remove option and emits an error 348 # if the option is set. 349 get_property(is_set CACHE ${name} PROPERTY VALUE SET) 350 if (is_set) 351 message(FATAL_ERROR "Removed option ${name} is set - ${error}") 352 endif() 353endmacro() 354 355ot_removed_option(OT_MTD_NETDIAG "- Use OT_NETDIAG_CLIENT instead - note that server function is always supported") 356ot_removed_option(OT_EXCLUDE_TCPLP_LIB "- Use OT_TCP instead, OT_EXCLUDE_TCPLP_LIB is deprecated") 357