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) 43 44set(OT_NCP_VENDOR_HOOK_SOURCE "" CACHE STRING "set vendor hook source file for NCP") 45if(OT_NCP_VENDOR_HOOK_SOURCE) 46 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_ENABLE_NCP_VENDOR_HOOK=1") 47 list(APPEND COMMON_SOURCES ${OT_NCP_VENDOR_HOOK_SOURCE_DIR}${OT_NCP_VENDOR_HOOK_SOURCE}) 48endif() 49 50set(COMMON_NCP_SOURCES 51 ${COMMON_SOURCES} 52 ncp_base_ftd.cpp 53 ncp_base_mtd.cpp 54) 55option(OT_NCP_SPI "enable NCP SPI support") 56if(OT_NCP_SPI) 57 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_SPI_ENABLE=1") 58else() 59 target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1") 60endif() 61 62if(OT_FTD) 63 include(ftd.cmake) 64endif() 65 66if(OT_MTD) 67 include(mtd.cmake) 68endif() 69 70if(OT_RCP) 71 include(radio.cmake) 72 if(OT_MULTIPAN_RCP) 73 target_compile_options(ot-config-radio 74 INTERFACE 75 "-DOPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1" 76 "-DOPENTHREAD_CONFIG_LOG_PREPEND_UPTIME=0" # Not supporting multiple instances 77 "-DOPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE=1" 78 "-DOPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE=1" 79 ) 80 endif() 81endif() 82 83set_property(SOURCE ncp_base_mtd.cpp 84 APPEND PROPERTY COMPILE_DEFINITIONS "PACKAGE_VERSION=\"${OT_PACKAGE_VERSION}\"" 85) 86