[cmake] add build options for FTD, MTD, and RCP (#5622)

This commit is contained in:
Jonathan Hui
2020-10-11 11:08:43 -07:00
parent 4cbe122352
commit 115e04f435
18 changed files with 676 additions and 271 deletions
+4
View File
@@ -30,6 +30,10 @@ option(OT_APP_CLI "enable CLI app" ON)
option(OT_APP_NCP "enable NCP app" ON)
option(OT_APP_RCP "enable RCP app" ON)
option(OT_FTD "enable FTD" ON)
option(OT_MTD "enable MTD" ON)
option(OT_RCP "enable RCP" ON)
option(OT_ASSERT "enable assert function OT_ASSERT()" ON)
if(OT_ASSERT)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_ASSERT_ENABLE=1")
+6 -30
View File
@@ -26,40 +26,16 @@
# POSSIBILITY OF SUCH DAMAGE.
#
add_executable(ot-cli-ftd
main.c
)
add_executable(ot-cli-mtd
main.c
)
set(COMMON_INCLUDES
${OT_PUBLIC_INCLUDES}
${PROJECT_SOURCE_DIR}/examples/platforms
${PROJECT_SOURCE_DIR}/src/core
)
target_include_directories(ot-cli-ftd PRIVATE ${COMMON_INCLUDES})
target_include_directories(ot-cli-mtd PRIVATE ${COMMON_INCLUDES})
if(OT_FTD)
include(ftd.cmake)
endif()
target_link_libraries(ot-cli-ftd PRIVATE
openthread-cli-ftd
${OT_PLATFORM_LIB}
openthread-ftd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
target_link_libraries(ot-cli-mtd PRIVATE
openthread-cli-mtd
${OT_PLATFORM_LIB}
openthread-mtd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
install(TARGETS ot-cli-ftd ot-cli-mtd
DESTINATION bin)
if(OT_MTD)
include(mtd.cmake)
endif()
+45
View File
@@ -0,0 +1,45 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_executable(ot-cli-ftd
main.c
)
target_include_directories(ot-cli-ftd PRIVATE ${COMMON_INCLUDES})
target_link_libraries(ot-cli-ftd PRIVATE
openthread-cli-ftd
${OT_PLATFORM_LIB}
openthread-ftd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
install(TARGETS ot-cli-ftd
DESTINATION bin)
+45
View File
@@ -0,0 +1,45 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_executable(ot-cli-mtd
main.c
)
target_include_directories(ot-cli-mtd PRIVATE ${COMMON_INCLUDES})
target_link_libraries(ot-cli-mtd PRIVATE
openthread-cli-mtd
${OT_PLATFORM_LIB}
openthread-mtd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
install(TARGETS ot-cli-mtd
DESTINATION bin)
+11 -2
View File
@@ -33,9 +33,18 @@ set(COMMON_INCLUDES
)
if(OT_APP_NCP)
include(ncp.cmake)
if(OT_FTD)
include(ftd.cmake)
endif()
if(OT_MTD)
include(mtd.cmake)
endif()
endif()
if(OT_APP_RCP)
include(rcp.cmake)
if(OT_RCP)
include(rcp.cmake)
else()
message(FATAL_ERROR "OT_RCP is not enabled")
endif()
endif()
@@ -30,12 +30,7 @@ add_executable(ot-ncp-ftd
main.c
)
add_executable(ot-ncp-mtd
main.c
)
target_include_directories(ot-ncp-ftd PRIVATE ${COMMON_INCLUDES})
target_include_directories(ot-ncp-mtd PRIVATE ${COMMON_INCLUDES})
target_link_libraries(ot-ncp-ftd PRIVATE
openthread-ncp-ftd
@@ -46,13 +41,4 @@ target_link_libraries(ot-ncp-ftd PRIVATE
ot-config
)
target_link_libraries(ot-ncp-mtd PRIVATE
openthread-ncp-mtd
${OT_PLATFORM_LIB}
openthread-mtd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
install(TARGETS ot-ncp-ftd ot-ncp-mtd DESTINATION bin)
install(TARGETS ot-ncp-ftd DESTINATION bin)
+44
View File
@@ -0,0 +1,44 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_executable(ot-ncp-mtd
main.c
)
target_include_directories(ot-ncp-mtd PRIVATE ${COMMON_INCLUDES})
target_link_libraries(ot-ncp-mtd PRIVATE
openthread-ncp-mtd
${OT_PLATFORM_LIB}
openthread-mtd
${OT_PLATFORM_LIB}
mbedcrypto
ot-config
)
install(TARGETS ot-ncp-mtd DESTINATION bin)
+6 -52
View File
@@ -26,9 +26,6 @@
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-cli-ftd)
add_library(openthread-cli-mtd)
set(OT_CLI_TRANSPORT "UART" CACHE STRING "set the CLI transport")
set(OT_CLI_TRANSPORT_VALUES
"UART"
@@ -36,35 +33,6 @@ set(OT_CLI_TRANSPORT_VALUES
)
set_property(CACHE OT_CLI_TRANSPORT PROPERTY STRINGS ${OT_CLI_TRANSPORT_VALUES})
set_target_properties(
openthread-cli-ftd openthread-cli-mtd
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-cli-ftd
PRIVATE
OPENTHREAD_FTD=1
PUBLIC
"OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_${OT_CLI_TRANSPORT}"
)
target_compile_definitions(openthread-cli-mtd
PRIVATE
OPENTHREAD_MTD=1
PUBLIC
"OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_${OT_CLI_TRANSPORT}"
)
target_compile_options(openthread-cli-ftd PRIVATE
${OT_CFLAGS}
)
target_compile_options(openthread-cli-mtd PRIVATE
${OT_CFLAGS}
)
set(COMMON_INCLUDES
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/core
@@ -83,24 +51,10 @@ set(COMMON_SOURCES
cli_udp.cpp
)
target_include_directories(openthread-cli-ftd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-cli-mtd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
if(OT_FTD)
include(ftd.cmake)
endif()
target_sources(openthread-cli-ftd PRIVATE ${COMMON_SOURCES})
target_sources(openthread-cli-mtd PRIVATE ${COMMON_SOURCES})
target_link_libraries(openthread-cli-ftd
PUBLIC
openthread-ftd
PRIVATE
${OT_MBEDTLS}
ot-config
)
target_link_libraries(openthread-cli-mtd
PUBLIC
openthread-mtd
PRIVATE
${OT_MBEDTLS}
ot-config
)
if(OT_MTD)
include(mtd.cmake)
endif()
+59
View File
@@ -0,0 +1,59 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-cli-ftd)
set_target_properties(
openthread-cli-ftd
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-cli-ftd
PRIVATE
OPENTHREAD_FTD=1
PUBLIC
"OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_${OT_CLI_TRANSPORT}"
)
target_compile_options(openthread-cli-ftd PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-cli-ftd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-cli-ftd PRIVATE ${COMMON_SOURCES})
target_link_libraries(openthread-cli-ftd
PUBLIC
openthread-ftd
PRIVATE
${OT_MBEDTLS}
ot-config
)
+59
View File
@@ -0,0 +1,59 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-cli-mtd)
set_target_properties(
openthread-cli-mtd
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-cli-mtd
PRIVATE
OPENTHREAD_MTD=1
PUBLIC
"OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_${OT_CLI_TRANSPORT}"
)
target_compile_options(openthread-cli-mtd PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-cli-mtd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-cli-mtd PRIVATE ${COMMON_SOURCES})
target_link_libraries(openthread-cli-mtd
PUBLIC
openthread-mtd
PRIVATE
${OT_MBEDTLS}
ot-config
)
+8 -88
View File
@@ -26,41 +26,6 @@
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-ftd)
add_library(openthread-mtd)
add_library(openthread-radio)
set_target_properties(
openthread-ftd openthread-mtd openthread-radio
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-ftd PRIVATE
OPENTHREAD_FTD=1
)
target_compile_definitions(openthread-mtd PRIVATE
OPENTHREAD_MTD=1
)
target_compile_definitions(openthread-radio PRIVATE
OPENTHREAD_RADIO=1
)
target_compile_options(openthread-ftd PRIVATE
${OT_CFLAGS}
)
target_compile_options(openthread-mtd PRIVATE
${OT_CFLAGS}
)
target_compile_options(openthread-radio PRIVATE
${OT_CFLAGS}
)
set(COMMON_INCLUDES
${PROJECT_SOURCE_DIR}/src/core
)
@@ -222,65 +187,20 @@ set(COMMON_SOURCES
utils/slaac_address.cpp
)
target_include_directories(openthread-ftd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-mtd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-radio PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
set(OT_VENDOR_EXTENSION "" CACHE STRING "specify a C++ source file built as part of OpenThread core library")
if(OT_VENDOR_EXTENSION)
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_ENABLE_VENDOR_EXTENSION=1")
list(APPEND COMMON_SOURCES ${OT_VENDOR_EXTENSION})
endif()
target_sources(openthread-ftd PRIVATE ${COMMON_SOURCES})
target_sources(openthread-mtd PRIVATE ${COMMON_SOURCES})
target_sources(openthread-radio PRIVATE
api/diags_api.cpp
api/instance_api.cpp
api/link_raw_api.cpp
api/logging_api.cpp
api/random_noncrypto_api.cpp
api/tasklet_api.cpp
common/instance.cpp
common/logging.cpp
common/random_manager.cpp
common/string.cpp
common/tasklet.cpp
common/timer.cpp
crypto/aes_ccm.cpp
crypto/aes_ecb.cpp
diags/factory_diags.cpp
mac/link_raw.cpp
mac/mac_frame.cpp
mac/mac_types.cpp
mac/sub_mac.cpp
mac/sub_mac_callbacks.cpp
radio/radio.cpp
radio/radio_callbacks.cpp
radio/radio_platform.cpp
thread/link_quality.cpp
utils/lookup_table.cpp
utils/parse_cmdline.cpp
)
if(OT_VENDOR_EXTENSION)
target_sources(openthread-radio PRIVATE ${OT_VENDOR_EXTENSION})
if(OT_FTD)
include(ftd.cmake)
endif()
target_link_libraries(openthread-ftd
PRIVATE
${OT_MBEDTLS}
ot-config
)
if(OT_MTD)
include(mtd.cmake)
endif()
target_link_libraries(openthread-mtd
PRIVATE
${OT_MBEDTLS}
ot-config
)
target_link_libraries(openthread-radio
PRIVATE
${OT_MBEDTLS}
ot-config
)
if(OT_RCP)
include(radio.cmake)
endif()
+54
View File
@@ -0,0 +1,54 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-ftd)
set_target_properties(
openthread-ftd
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-ftd PRIVATE
OPENTHREAD_FTD=1
)
target_compile_options(openthread-ftd PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-ftd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-ftd PRIVATE ${COMMON_SOURCES})
target_link_libraries(openthread-ftd
PRIVATE
${OT_MBEDTLS}
ot-config
)
+54
View File
@@ -0,0 +1,54 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-mtd)
set_target_properties(
openthread-mtd
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-mtd PRIVATE
OPENTHREAD_MTD=1
)
target_compile_options(openthread-mtd PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-mtd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-mtd PRIVATE ${COMMON_SOURCES})
target_link_libraries(openthread-mtd
PRIVATE
${OT_MBEDTLS}
ot-config
)
+85
View File
@@ -0,0 +1,85 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-radio)
set_target_properties(
openthread-radio
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-radio PRIVATE
OPENTHREAD_RADIO=1
)
target_compile_options(openthread-radio PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-radio PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-radio PRIVATE
api/diags_api.cpp
api/instance_api.cpp
api/link_raw_api.cpp
api/logging_api.cpp
api/random_noncrypto_api.cpp
api/tasklet_api.cpp
common/instance.cpp
common/logging.cpp
common/random_manager.cpp
common/string.cpp
common/tasklet.cpp
common/timer.cpp
crypto/aes_ccm.cpp
crypto/aes_ecb.cpp
diags/factory_diags.cpp
mac/link_raw.cpp
mac/mac_frame.cpp
mac/mac_types.cpp
mac/sub_mac.cpp
mac/sub_mac_callbacks.cpp
radio/radio.cpp
radio/radio_callbacks.cpp
radio/radio_platform.cpp
thread/link_quality.cpp
utils/lookup_table.cpp
utils/parse_cmdline.cpp
)
if(OT_VENDOR_EXTENSION)
target_sources(openthread-radio PRIVATE ${OT_VENDOR_EXTENSION})
endif()
target_link_libraries(openthread-radio
PRIVATE
${OT_MBEDTLS}
ot-config
)
+9 -84
View File
@@ -26,45 +26,6 @@
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-ncp-ftd)
add_library(openthread-ncp-mtd)
add_library(openthread-rcp)
# We depend on C++11 to validate that NCP handlers are sorted.
set_target_properties(
openthread-ncp-ftd openthread-ncp-mtd openthread-rcp
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-ncp-ftd PRIVATE
OPENTHREAD_FTD=1
OPENTHREAD_CONFIG_NCP_UART_ENABLE=1
)
target_compile_definitions(openthread-ncp-mtd PRIVATE
OPENTHREAD_MTD=1
OPENTHREAD_CONFIG_NCP_UART_ENABLE=1
)
target_compile_definitions(openthread-rcp PRIVATE
OPENTHREAD_RADIO=1
OPENTHREAD_CONFIG_NCP_UART_ENABLE=1
)
target_compile_options(openthread-ncp-ftd PRIVATE
${OT_CFLAGS}
)
target_compile_options(openthread-ncp-mtd PRIVATE
${OT_CFLAGS}
)
target_compile_options(openthread-rcp PRIVATE
${OT_CFLAGS}
)
set(COMMON_INCLUDES
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/src/core
@@ -87,50 +48,14 @@ if(OT_NCP_VENDOR_HOOK_SOURCE)
list(APPEND COMMON_SOURCES ${OT_NCP_VENDOR_HOOK_SOURCE_DIR}${OT_NCP_VENDOR_HOOK_SOURCE})
endif()
target_include_directories(openthread-ncp-ftd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-ncp-mtd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-rcp PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
if(OT_FTD)
include(ftd.cmake)
endif()
target_sources(openthread-ncp-ftd PRIVATE ${COMMON_SOURCES})
target_sources(openthread-ncp-mtd PRIVATE ${COMMON_SOURCES})
target_include_directories(openthread-ncp-ftd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(openthread-ncp-mtd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(OT_MTD)
include(mtd.cmake)
endif()
target_sources(openthread-rcp PRIVATE
changed_props_set.cpp
ncp_base.cpp
ncp_base_dispatcher.cpp
ncp_base_radio.cpp
ncp_spi.cpp
ncp_uart.cpp
)
target_link_libraries(openthread-ncp-ftd
PUBLIC
openthread-ftd
PRIVATE
${OT_PLATFORM_LIB}
${OT_MBEDTLS}
openthread-hdlc
openthread-spinel-ncp
ot-config
)
target_link_libraries(openthread-ncp-mtd
PUBLIC
openthread-mtd
PRIVATE
${OT_MBEDTLS}
openthread-hdlc
openthread-spinel-ncp
ot-config
)
target_link_libraries(openthread-rcp
PUBLIC
openthread-radio
PRIVATE
openthread-hdlc
openthread-spinel-rcp
ot-config
)
if(OT_RCP)
include(radio.cmake)
endif()
+61
View File
@@ -0,0 +1,61 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-ncp-ftd)
set_target_properties(
openthread-ncp-ftd
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-ncp-ftd PRIVATE
OPENTHREAD_FTD=1
OPENTHREAD_CONFIG_NCP_UART_ENABLE=1
)
target_compile_options(openthread-ncp-ftd PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-ncp-ftd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-ncp-ftd PRIVATE ${COMMON_SOURCES})
target_include_directories(openthread-ncp-ftd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(openthread-ncp-ftd
PUBLIC
openthread-ftd
PRIVATE
${OT_PLATFORM_LIB}
${OT_MBEDTLS}
openthread-hdlc
openthread-spinel-ncp
ot-config
)
+60
View File
@@ -0,0 +1,60 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-ncp-mtd)
set_target_properties(
openthread-ncp-mtd
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-ncp-mtd PRIVATE
OPENTHREAD_MTD=1
OPENTHREAD_CONFIG_NCP_UART_ENABLE=1
)
target_compile_options(openthread-ncp-mtd PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-ncp-mtd PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-ncp-mtd PRIVATE ${COMMON_SOURCES})
target_include_directories(openthread-ncp-mtd PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(openthread-ncp-mtd
PUBLIC
openthread-mtd
PRIVATE
${OT_MBEDTLS}
openthread-hdlc
openthread-spinel-ncp
ot-config
)
+65
View File
@@ -0,0 +1,65 @@
#
# Copyright (c) 2020, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-rcp)
set_target_properties(
openthread-rcp
PROPERTIES
C_STANDARD 99
CXX_STANDARD 11
)
target_compile_definitions(openthread-rcp PRIVATE
OPENTHREAD_RADIO=1
OPENTHREAD_CONFIG_NCP_UART_ENABLE=1
)
target_compile_options(openthread-rcp PRIVATE
${OT_CFLAGS}
)
target_include_directories(openthread-rcp PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-rcp PRIVATE
changed_props_set.cpp
ncp_base.cpp
ncp_base_dispatcher.cpp
ncp_base_radio.cpp
ncp_spi.cpp
ncp_uart.cpp
)
target_link_libraries(openthread-rcp
PUBLIC
openthread-radio
PRIVATE
openthread-hdlc
openthread-spinel-rcp
ot-config
)