1# 2# Copyright (c) 2021, 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 29include(CMakeDependentOption) 30find_package(PkgConfig) 31 32option(OTBR_DOC "Build documentation" OFF) 33 34option(OTBR_BORDER_AGENT "Enable Border Agent" ON) 35if (OTBR_BORDER_AGENT) 36 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_BORDER_AGENT=1) 37endif() 38 39option(OTBR_BACKBONE_ROUTER "Enable Backbone Router" OFF) 40if (OTBR_BACKBONE_ROUTER) 41 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_BACKBONE_ROUTER=1) 42endif() 43 44option(OTBR_BORDER_ROUTING "Enable Border Routing Manager" OFF) 45if (OTBR_BORDER_ROUTING) 46 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_BORDER_ROUTING=1) 47endif() 48 49option(OTBR_BORDER_ROUTING_COUNTERS "Enable Border Routing Counters" ON) 50if (OTBR_BORDER_ROUTING_COUNTERS) 51 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_BORDER_ROUTING_COUNTERS=1) 52endif() 53 54option(OTBR_DBUS "Enable DBus support" OFF) 55if(OTBR_DBUS) 56 pkg_check_modules(DBUS REQUIRED dbus-1) 57 pkg_get_variable(OTBR_DBUS_SYSTEM_BUS_SERVICES_DIR dbus-1 system_bus_services_dir) 58 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DBUS_SERVER=1) 59endif() 60 61option(OTBR_FEATURE_FLAGS "Enable feature flags support" OFF) 62if (OTBR_FEATURE_FLAGS) 63 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_FEATURE_FLAGS=1) 64endif() 65 66option(OTBR_TELEMETRY_DATA_API "Enable telemetry data API support" OFF) 67if (OTBR_TELEMETRY_DATA_API) 68 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_TELEMETRY_DATA_API=1) 69endif() 70 71option(OTBR_DUA_ROUTING "Enable Backbone Router DUA Routing" OFF) 72if (OTBR_DUA_ROUTING) 73 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DUA_ROUTING=1) 74endif() 75 76option(OTBR_OPENWRT "Enable OpenWrt support" OFF) 77if(OTBR_OPENWRT) 78 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_OPENWRT=1) 79endif() 80 81option(OTBR_REST "Enable Rest Server" OFF) 82if(OTBR_REST) 83 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_REST_SERVER=1) 84endif() 85 86option(OTBR_SRP_ADVERTISING_PROXY "Enable Advertising Proxy" OFF) 87if (OTBR_SRP_ADVERTISING_PROXY) 88 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_SRP_ADVERTISING_PROXY=1) 89endif() 90 91cmake_dependent_option(OTBR_SRP_SERVER_AUTO_ENABLE "Enable SRP server auto enable mode" ON "OTBR_SRP_ADVERTISING_PROXY;OTBR_BORDER_ROUTING" OFF) 92if (OTBR_SRP_SERVER_AUTO_ENABLE) 93 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_SRP_SERVER_AUTO_ENABLE_MODE=1) 94endif() 95 96option(OTBR_DNSSD_DISCOVERY_PROXY "Enable DNS-SD Discovery Proxy support" OFF) 97if (OTBR_DNSSD_DISCOVERY_PROXY) 98 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DNSSD_DISCOVERY_PROXY=1) 99endif() 100 101option(OTBR_UNSECURE_JOIN "Enable unsecure joining" OFF) 102if(OTBR_UNSECURE_JOIN) 103 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_UNSECURE_JOIN=1) 104endif() 105 106option(OTBR_TREL "Enable TREL link support." OFF) 107if(OTBR_TREL) 108 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_TREL=1) 109endif() 110 111option(OTBR_EPSKC "Enable ephemeral PSKc" ON) 112if (OTBR_EPSKC) 113 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_EPSKC=1) 114else() 115 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_EPSKC=0) 116endif() 117 118option(OTBR_WEB "Enable Web GUI" OFF) 119 120option(OTBR_NOTIFY_UPSTART "Notify upstart when ready." ON) 121if(OTBR_NOTIFY_UPSTART) 122 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_NOTIFY_UPSTART=1) 123endif() 124 125option(OTBR_NAT64 "Enable NAT64 support" OFF) 126if(OTBR_NAT64) 127 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_NAT64=1) 128else() 129 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_NAT64=0) 130endif() 131 132option(OTBR_VENDOR_INFRA_LINK_SELECT "Enable Vendor-specific infrastructure link selection rules" OFF) 133if(OTBR_VENDOR_INFRA_LINK_SELECT) 134 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_VENDOR_INFRA_LINK_SELECT=1) 135else() 136 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_VENDOR_INFRA_LINK_SELECT=0) 137endif() 138 139option(OTBR_DNS_UPSTREAM_QUERY "Allow sending DNS queries to upstream" OFF) 140if (OTBR_DNS_UPSTREAM_QUERY) 141 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DNS_UPSTREAM_QUERY=1) 142endif() 143 144option(OTBR_PUBLISH_MESHCOP_BA_ID "Publish the MeshCoP mDNS 'id' TXT entry, enable this feature only when 'id' is not set via dbus API" ON) 145if (OTBR_PUBLISH_MESHCOP_BA_ID) 146 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_PUBLISH_MESHCOP_BA_ID=1) 147endif() 148 149option(OTBR_DHCP6_PD "Prefix delegation support" OFF) 150if (OTBR_DHCP6_PD) 151 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DHCP6_PD=1) 152else() 153 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_DHCP6_PD=0) 154endif() 155 156option(OTBR_VENDOR_SERVER "Enable vendor server" OFF) 157if (OTBR_VENDOR_SERVER) 158 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_VENDOR_SERVER=1) 159endif() 160 161option(OTBR_LINK_METRICS_TELEMETRY "Enable Link Metrics Telemetry Upload" OFF) 162if (OTBR_LINK_METRICS_TELEMETRY) 163 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_LINK_METRICS_TELEMETRY=1) 164else() 165 target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_LINK_METRICS_TELEMETRY=0) 166endif() 167