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 31 ${PROJECT_SOURCE_DIR}/src/core 32) 33 34set(COMMON_SOURCES 35 changed_props_set.cpp 36 multipan_platform.cpp 37 ncp_base.cpp 38 ncp_base_dispatcher.cpp 39 ncp_base_radio.cpp 40 ncp_spi.cpp 41 ncp_hdlc.cpp 42 platform/infra_if.cpp 43) 44 45set(OT_NCP_VENDOR_HOOK_SOURCE "" CACHE STRING "set vendor hook source file for NCP") 46if(OT_NCP_VENDOR_HOOK_SOURCE) 47 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_ENABLE_NCP_VENDOR_HOOK=1") 48 list(APPEND COMMON_SOURCES ${OT_NCP_VENDOR_HOOK_SOURCE_DIR}${OT_NCP_VENDOR_HOOK_SOURCE}) 49endif() 50 51option(OT_NCP_INFRA_IF "enable NCP Infra If support") 52if (OT_NCP_INFRA_IF) 53 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_INFRA_IF_ENABLE=1") 54else() 55 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_INFRA_IF_ENABLE=0") 56endif() 57 58set(COMMON_NCP_SOURCES 59 ${COMMON_SOURCES} 60 ncp_base_ftd.cpp 61 ncp_base_mtd.cpp 62) 63option(OT_NCP_SPI "enable NCP SPI support") 64if(OT_NCP_SPI) 65 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_SPI_ENABLE=1") 66else() 67 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1") 68endif() 69 70if(OT_FTD) 71 include(ftd.cmake) 72endif() 73 74if(OT_MTD) 75 include(mtd.cmake) 76endif() 77 78if(OT_RCP) 79 include(radio.cmake) 80 if(OT_MULTIPAN_RCP) 81 target_compile_options(ot-config-radio 82 INTERFACE 83 "-DOPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1" 84 "-DOPENTHREAD_CONFIG_LOG_PREPEND_UPTIME=0" # Not supporting multiple instances 85 "-DOPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE=1" 86 "-DOPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE=1" 87 ) 88 endif() 89endif() 90 91set_property(SOURCE ncp_base_mtd.cpp 92 APPEND PROPERTY COMPILE_DEFINITIONS "PACKAGE_VERSION=\"${OT_PACKAGE_VERSION}\"" 93) 94