mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 16:47:47 +00:00
[cmake] enhance OT CMake config options (allow on/off/unspecified) (#7979)
This commit enhances OT CMake config options allowing them to use 3
values of "on", "off", and unspecified (empty string).
With this change is an `OT_{FEATURE}` option is set to "off", it is
explicitly disabled (`-DOPENTHREAD_CONFIG_{FEATURE}=0` is added which
defines the corresponding OT config as zero). This changes the CMake OT
option behavior from before where "off" was treated as unspecified.
If `OT_{FEATURE}` is left unspecified (or set to empty string), then
the related OT config is not defined by CMake build allowing it to be
to be determined by other means, e.g., a project specific config
header or default config specified in `src/core/config` header files).
This commit adds a CMake macro `ot_option()` to help simplify defining
CMake OT config options. This macro also help emit status messages
indicating the value of each OT config.
This commit is contained in:
+115
-347
@@ -34,58 +34,126 @@ option(OT_FTD "enable FTD" ON)
|
||||
option(OT_MTD "enable MTD" ON)
|
||||
option(OT_RCP "enable RCP" ON)
|
||||
|
||||
option(OT_ANYCAST_LOCATOR "enable anycast locator support")
|
||||
if(OT_ANYCAST_LOCATOR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE=1")
|
||||
set(OT_CONFIG_VALUES
|
||||
""
|
||||
"ON"
|
||||
"OFF"
|
||||
)
|
||||
|
||||
macro(ot_option name ot_config description)
|
||||
# Declare an OT cmake config with `name` mapping to OPENTHREAD_CONFIG
|
||||
# `ot_config`. Parameter `description` provides the help string for this
|
||||
# OT cmake config. There is an optional last parameter which if provided
|
||||
# determines the default value for the cmake config. If not provided
|
||||
# empty string is used which will be treated as "not specified". In this
|
||||
# case, the variable `name` would still be false but the related
|
||||
# OPENTHREAD_CONFIG is not added in `ot-config`.
|
||||
|
||||
if (${ARGC} GREATER 3)
|
||||
set(${name} ${ARGN} CACHE STRING "enable ${description}")
|
||||
else()
|
||||
set(${name} "" CACHE STRING "enable ${description}")
|
||||
endif()
|
||||
|
||||
set_property(CACHE ${name} PROPERTY STRINGS ${OT_CONFIG_VALUES})
|
||||
|
||||
string(COMPARE EQUAL "${${name}}" "" is_empty)
|
||||
if (is_empty)
|
||||
message(STATUS "${name}=\"\"")
|
||||
elseif (${name})
|
||||
message(STATUS "${name}=ON --> ${ot_config}=1")
|
||||
target_compile_definitions(ot-config INTERFACE "${ot_config}=1")
|
||||
else()
|
||||
message(STATUS "${name}=OFF --> ${ot_config}=0")
|
||||
target_compile_definitions(ot-config INTERFACE "${ot_config}=0")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
ot_option(OT_ANYCAST_LOCATOR OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE "anycast locator")
|
||||
ot_option(OT_ASSERT OPENTHREAD_CONFIG_ASSERT_ENABLE "assert function OT_ASSERT()")
|
||||
ot_option(OT_BACKBONE_ROUTER OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE "backbone router functionality")
|
||||
ot_option(OT_BACKBONE_ROUTER_DUA_NDPROXYING OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE "BBR DUA ND Proxy")
|
||||
ot_option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE "BBR MR")
|
||||
ot_option(OT_BORDER_AGENT OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE "border agent")
|
||||
ot_option(OT_BORDER_ROUTER OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE "border router")
|
||||
ot_option(OT_BORDER_ROUTING OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE "border routing")
|
||||
ot_option(OT_BORDER_ROUTING_NAT64 OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE "border routing NAT64")
|
||||
ot_option(OT_CHANNEL_MANAGER OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE "channel manager")
|
||||
ot_option(OT_CHANNEL_MONITOR OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE "channel monitor")
|
||||
ot_option(OT_CHILD_SUPERVISION OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE "child supervision")
|
||||
ot_option(OT_COAP OPENTHREAD_CONFIG_COAP_API_ENABLE "coap api")
|
||||
ot_option(OT_COAP_BLOCK OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE "coap block-wise transfer (RFC7959)")
|
||||
ot_option(OT_COAP_OBSERVE OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE "coap observe (RFC7641)")
|
||||
ot_option(OT_COAPS OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE "secure coap")
|
||||
ot_option(OT_COMMISSIONER OPENTHREAD_CONFIG_COMMISSIONER_ENABLE "commissioner")
|
||||
ot_option(OT_CSL_AUTO_SYNC OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE "data polling based on csl")
|
||||
ot_option(OT_CSL_DEBUG OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE "csl debug")
|
||||
ot_option(OT_CSL_RECEIVER OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE "csl receiver")
|
||||
ot_option(OT_DATASET_UPDATER OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE "dataset updater")
|
||||
ot_option(OT_DHCP6_CLIENT OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE "DHCP6 client")
|
||||
ot_option(OT_DHCP6_SERVER OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE "DHCP6 server")
|
||||
ot_option(OT_DIAGNOSTIC OPENTHREAD_CONFIG_DIAG_ENABLE "diagnostic")
|
||||
ot_option(OT_DNS_CLIENT OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE "DNS client")
|
||||
ot_option(OT_DNS_DSO OPENTHREAD_CONFIG_DNS_DSO_ENABLE "DNS Stateful Operations (DSO)")
|
||||
ot_option(OT_DNSSD_SERVER OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE "DNS-SD server")
|
||||
ot_option(OT_DUA OPENTHREAD_CONFIG_DUA_ENABLE "Domain Unicast Address (DUA)")
|
||||
ot_option(OT_ECDSA OPENTHREAD_CONFIG_ECDSA_ENABLE "ECDSA")
|
||||
ot_option(OT_EXTERNAL_HEAP OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE "external heap")
|
||||
ot_option(OT_FIREWALL OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE "firewall")
|
||||
ot_option(OT_HISTORY_TRACKER OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE "history tracker")
|
||||
ot_option(OT_IP6_FRAGM OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE "ipv6 fragmentation")
|
||||
ot_option(OT_JAM_DETECTION OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE "jam detection")
|
||||
ot_option(OT_JOINER OPENTHREAD_CONFIG_JOINER_ENABLE "joiner")
|
||||
ot_option(OT_LEGACY OPENTHREAD_CONFIG_LEGACY_ENABLE "legacy network")
|
||||
ot_option(OT_LINK_METRICS_INITIATOR OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE "link metrics initiator")
|
||||
ot_option(OT_LINK_METRICS_SUBJECT OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE "link metrics subject")
|
||||
ot_option(OT_LINK_RAW OPENTHREAD_CONFIG_LINK_RAW_ENABLE "link raw service")
|
||||
ot_option(OT_LOG_LEVEL_DYNAMIC OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE "dynamic log level control")
|
||||
ot_option(OT_MAC_FILTER OPENTHREAD_CONFIG_MAC_FILTER_ENABLE "mac filter")
|
||||
ot_option(OT_MESSAGE_USE_HEAP OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE "heap allocator for message buffers")
|
||||
ot_option(OT_MLE_LONG_ROUTES OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE "MLE long routes extension (experimental)")
|
||||
ot_option(OT_MLR OPENTHREAD_CONFIG_MLR_ENABLE "Multicast Listener Registration (MLR)")
|
||||
ot_option(OT_MTD_NETDIAG OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE "TMF network diagnostics on MTDs")
|
||||
ot_option(OT_MULTIPLE_INSTANCE OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE "multiple instances")
|
||||
ot_option(OT_NEIGHBOR_DISCOVERY_AGENT OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE "neighbor discovery agent")
|
||||
ot_option(OT_NETDATA_PUBLISHER OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE "Network Data publisher")
|
||||
ot_option(OT_OTNS OPENTHREAD_CONFIG_OTNS_ENABLE "OTNS")
|
||||
ot_option(OT_PING_SENDER OPENTHREAD_CONFIG_PING_SENDER_ENABLE "ping sender" ${OT_APP_CLI})
|
||||
ot_option(OT_PLATFORM_NETIF OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE "platform netif")
|
||||
ot_option(OT_PLATFORM_UDP OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE "platform UDP")
|
||||
ot_option(OT_REFERENCE_DEVICE OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE "test harness reference device")
|
||||
ot_option(OT_SERVICE OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE "Network Data service")
|
||||
ot_option(OT_SETTINGS_RAM OPENTHREAD_SETTINGS_RAM "volatile-only storage of settings")
|
||||
ot_option(OT_SLAAC OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE "SLAAC address")
|
||||
ot_option(OT_SNTP_CLIENT OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE "SNTP client")
|
||||
ot_option(OT_SRP_CLIENT OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE "SRP client")
|
||||
ot_option(OT_SRP_SERVER OPENTHREAD_CONFIG_SRP_SERVER_ENABLE "SRP server")
|
||||
ot_option(OT_TIME_SYNC OPENTHREAD_CONFIG_TIME_SYNC_ENABLE "time synchronization service")
|
||||
ot_option(OT_TREL OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE "TREL radio link for Thread over Infrastructure feature")
|
||||
ot_option(OT_TX_BEACON_PAYLOAD OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE "tx beacon payload")
|
||||
ot_option(OT_UDP_FORWARD OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE "UDP forward")
|
||||
ot_option(OT_UPTIME OPENTHREAD_CONFIG_UPTIME_ENABLE "uptime")
|
||||
|
||||
option(OT_DOC "Build OpenThread documentation")
|
||||
|
||||
option(OT_FULL_LOGS "enable full logs")
|
||||
if(OT_FULL_LOGS)
|
||||
if(NOT OT_LOG_LEVEL)
|
||||
message(STATUS "OT_FULL_LOGS=ON --> Setting LOG_LEVEL to DEBG")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
|
||||
endif()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
|
||||
endif()
|
||||
|
||||
option(OT_ASSERT "enable assert function OT_ASSERT()" ON)
|
||||
if(OT_ASSERT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=1")
|
||||
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
|
||||
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
|
||||
message(STATUS "OT_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=0")
|
||||
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
endif()
|
||||
|
||||
option(OT_BACKBONE_ROUTER "enable backbone router functionality")
|
||||
if(OT_BACKBONE_ROUTER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1")
|
||||
set(OT_BACKBONE_ROUTER_DUA_NDPROXYING ON CACHE BOOL "Enable DUA NDProxying by default")
|
||||
set(OT_BACKBONE_ROUTER_MULTICAST_ROUTING ON CACHE BOOL "Enable Multicast Routing by default")
|
||||
endif()
|
||||
|
||||
option(OT_BACKBONE_ROUTER_DUA_NDPROXYING "enable Backbone Router DUA ND Proxying functionality" OFF)
|
||||
if(OT_BACKBONE_ROUTER_DUA_NDPROXYING)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_DUA_NDPROXYING_ENABLE=0")
|
||||
endif()
|
||||
|
||||
option(OT_BACKBONE_ROUTER_MULTICAST_ROUTING "enable Backbone Router Multicast Routing functionality" OFF)
|
||||
if(OT_BACKBONE_ROUTER_MULTICAST_ROUTING)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE=0")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_AGENT "enable border agent support")
|
||||
if(OT_BORDER_AGENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_ROUTER "enable border router support")
|
||||
if(OT_BORDER_ROUTER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_ROUTING "enable border routing support")
|
||||
if(OT_BORDER_ROUTING)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_BORDER_ROUTING_NAT64 "enable border routing NAT64 support")
|
||||
if(OT_BORDER_ROUTING_NAT64)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE=1")
|
||||
endif()
|
||||
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
|
||||
|
||||
if(NOT OT_EXTERNAL_MBEDTLS)
|
||||
set(OT_MBEDTLS mbedtls)
|
||||
@@ -102,307 +170,7 @@ else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0")
|
||||
endif()
|
||||
|
||||
option(OT_CHANNEL_MANAGER "enable channel manager support")
|
||||
if(OT_CHANNEL_MANAGER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CHANNEL_MONITOR "enable channel monitor support")
|
||||
if(OT_CHANNEL_MONITOR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CHILD_SUPERVISION "enable child supervision support")
|
||||
if(OT_CHILD_SUPERVISION)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAP "enable coap api support")
|
||||
if(OT_COAP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_API_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAPS "enable secure coap api support")
|
||||
if(OT_COAPS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAP_BLOCK "enable coap block-wise transfer (RFC7959) api support")
|
||||
if(OT_COAP_BLOCK)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COAP_OBSERVE "enable coap observe (RFC7641) api support")
|
||||
if(OT_COAP_OBSERVE)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_COMMISSIONER "enable commissioner support")
|
||||
if(OT_COMMISSIONER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CSL_RECEIVER "enable csl receiver")
|
||||
if(OT_CSL_RECEIVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_CSL_AUTO_SYNC "enable data polling based on csl config" ${OT_CSL_RECEIVER})
|
||||
if(OT_CSL_AUTO_SYNC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0")
|
||||
endif()
|
||||
|
||||
option(OT_CSL_DEBUG "enable csl debug")
|
||||
if(OT_CSL_DEBUG)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DATASET_UPDATER "enable dataset updater support")
|
||||
if(OT_DATASET_UPDATER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DHCP6_CLIENT "enable DHCP6 client support")
|
||||
if(OT_DHCP6_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DHCP6_SERVER "enable DHCP6 server support")
|
||||
if(OT_DHCP6_SERVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DIAGNOSTIC "enable diagnostic support")
|
||||
if(OT_DIAGNOSTIC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DIAG_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DNS_CLIENT "enable DNS client support")
|
||||
if(OT_DNS_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DNS_DSO "enable DNS Stateful Operations (DSO) support")
|
||||
if(OT_DNS_DSO)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNS_DSO_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DNSSD_SERVER "enable DNS-SD server support")
|
||||
if(OT_DNSSD_SERVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DOC "Build OpenThread documentation")
|
||||
|
||||
option(OT_ECDSA "enable ECDSA support")
|
||||
if(OT_ECDSA)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ECDSA_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SRP_CLIENT "enable SRP client support")
|
||||
if (OT_SRP_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_DUA "enable Domain Unicast Address feature for Thread 1.2")
|
||||
if(OT_DUA)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_DUA_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MESSAGE_USE_HEAP "enable heap allocator for message buffers")
|
||||
if(OT_MESSAGE_USE_HEAP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MLR "enable Multicast Listener Registration feature for Thread 1.2")
|
||||
if(OT_MLR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLR_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_EXTERNAL_HEAP "enable external heap support")
|
||||
if(OT_EXTERNAL_HEAP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_HISTORY_TRACKER "enable history tracker support")
|
||||
if(OT_HISTORY_TRACKER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_IP6_FRAGM "enable ipv6 fragmentation support")
|
||||
if(OT_IP6_FRAGM)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_JAM_DETECTION "enable jam detection support")
|
||||
if(OT_JAM_DETECTION)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_JOINER "enable joiner support")
|
||||
if(OT_JOINER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_JOINER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LEGACY "enable legacy network support")
|
||||
if(OT_LEGACY)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LEGACY_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LINK_RAW "enable link raw service")
|
||||
if(OT_LINK_RAW)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LINK_RAW_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LINK_METRICS_INITIATOR "enable link metrics initiator")
|
||||
if (OT_LINK_METRICS_INITIATOR)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LINK_METRICS_SUBJECT "enable link metrics subject")
|
||||
if (OT_LINK_METRICS_SUBJECT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_LOG_LEVEL_DYNAMIC "enable dynamic log level control")
|
||||
if(OT_LOG_LEVEL_DYNAMIC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MAC_FILTER "enable mac filter support")
|
||||
if(OT_MAC_FILTER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MLE_LONG_ROUTES "enable MLE long routes extension (experimental, breaks Thread conformance)")
|
||||
if(OT_MLE_LONG_ROUTES)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MTD_NETDIAG "enable TMF network diagnostics on MTDs")
|
||||
if(OT_MTD_NETDIAG)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_MULTIPLE_INSTANCE "enable multiple instances")
|
||||
if(OT_MULTIPLE_INSTANCE)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_NEIGHBOR_DISCOVERY_AGENT "enable neighbor discovery agent support")
|
||||
if(OT_NEIGHBOR_DISCOVERY_AGENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_NETDATA_PUBLISHER "enable Thread Network Data publisher")
|
||||
if(OT_NETDATA_PUBLISHER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_PING_SENDER "enable ping sender support" ${OT_APP_CLI})
|
||||
if(OT_PING_SENDER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PING_SENDER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_PLATFORM_NETIF "enable platform netif support")
|
||||
if(OT_PLATFORM_NETIF)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_NETIF_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_PLATFORM_UDP "enable platform UDP support")
|
||||
if(OT_PLATFORM_UDP)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1")
|
||||
endif()
|
||||
|
||||
if(OT_POSIX_SETTINGS_PATH)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_POSIX_SETTINGS_PATH=${OT_POSIX_SETTINGS_PATH}")
|
||||
endif()
|
||||
|
||||
option(OT_REFERENCE_DEVICE "enable Thread Test Harness reference device support")
|
||||
if(OT_REFERENCE_DEVICE)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SERVICE "enable support for injecting Service entries into the Thread Network Data")
|
||||
if(OT_SERVICE)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SETTINGS_RAM "enable volatile-only storage of settings")
|
||||
if(OT_SETTINGS_RAM)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SETTINGS_RAM=1")
|
||||
endif()
|
||||
|
||||
option(OT_SLAAC "enable support for adding of auto-configured SLAAC addresses by OpenThread")
|
||||
if(OT_SLAAC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SNTP_CLIENT "enable SNTP Client support")
|
||||
if(OT_SNTP_CLIENT)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_SRP_SERVER "enable SRP server")
|
||||
if (OT_SRP_SERVER)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_TIME_SYNC "enable the time synchronization service feature")
|
||||
if(OT_TIME_SYNC)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_TREL "enable TREL radio link for Thread over Infrastructure feature")
|
||||
if (OT_TREL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_TX_BEACON_PAYLOAD "enable Thread beacon payload in outgoing beacons")
|
||||
if (OT_TX_BEACON_PAYLOAD)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_MAC_OUTGOING_BEACON_PAYLOAD_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_UDP_FORWARD "enable UDP forward support")
|
||||
if(OT_UDP_FORWARD)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_UPTIME "enable support for tracking OpenThread instance's uptime")
|
||||
if(OT_UPTIME)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_UPTIME_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_FIREWALL "enable firewall")
|
||||
if (OT_FIREWALL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_POSIX_CONFIG_FIREWALL_ENABLE=1")
|
||||
endif()
|
||||
|
||||
option(OT_FULL_LOGS "enable full logs")
|
||||
if(OT_FULL_LOGS)
|
||||
if(NOT OT_LOG_LEVEL)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG")
|
||||
endif()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1")
|
||||
endif()
|
||||
|
||||
option(OT_OTNS "enable OTNS support")
|
||||
if(OT_OTNS)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_OTNS_ENABLE=1")
|
||||
endif()
|
||||
|
||||
set(OT_RCP_RESTORATION_MAX_COUNT "0" CACHE STRING "set max RCP restoration count")
|
||||
if(OT_RCP_RESTORATION_MAX_COUNT MATCHES "^[0-9]+$")
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid max RCP restoration count: ${OT_RCP_RESTORATION_MAX_COUNT}")
|
||||
endif()
|
||||
|
||||
option(OT_EXCLUDE_TCPLP_LIB "exclude TCPlp library from build")
|
||||
|
||||
# Checks
|
||||
if(OT_PLATFORM_UDP AND OT_UDP_FORWARD)
|
||||
message(FATAL_ERROR "OT_PLATFORM_UDP and OT_UDP_FORWARD are exclusive")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user