[build] move radio_spinel.cpp to new lib openthread-radio-spinel (#9530)

The lib `openthread-spinel-ncp` is used by the NCP build, it doesn't
need the file `radio_spinel.cpp`. This commit changes the CMake file
to make only the lib `openthread-spinel-rcp` include the file
`radio_spinel.cpp`.
This commit is contained in:
Zhanglong Xia
2023-11-02 09:11:26 -07:00
committed by GitHub
parent 4a9fb0609e
commit 5058500e5d
4 changed files with 15 additions and 11 deletions
+12 -11
View File
@@ -26,27 +26,22 @@
# POSSIBILITY OF SUCH DAMAGE.
#
add_library(openthread-radio-spinel)
add_library(openthread-spinel-ncp)
add_library(openthread-spinel-rcp)
target_compile_definitions(openthread-spinel-ncp PRIVATE
OPENTHREAD_FTD=1
PUBLIC OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1
)
if (OT_NCP_SPI)
target_compile_definitions(openthread-spinel-ncp PRIVATE OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=0)
target_compile_definitions(openthread-spinel-rcp PRIVATE OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=0)
else()
target_compile_definitions(openthread-spinel-ncp PRIVATE OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1)
target_compile_definitions(openthread-spinel-rcp PRIVATE OPENTHREAD_CONFIG_NCP_HDLC_ENABLE=1)
endif()
target_compile_definitions(openthread-spinel-rcp PRIVATE
OPENTHREAD_RADIO=1
PUBLIC OPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=0
)
target_compile_options(openthread-radio-spinel PRIVATE
${OT_CFLAGS}
)
target_compile_options(openthread-spinel-ncp PRIVATE
${OT_CFLAGS}
)
@@ -61,19 +56,25 @@ set(COMMON_INCLUDES
)
set(COMMON_SOURCES
radio_spinel.cpp
spinel.c
spinel_buffer.cpp
spinel_decoder.cpp
spinel_encoder.cpp
)
target_include_directories(openthread-radio-spinel PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-spinel-ncp PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_include_directories(openthread-spinel-rcp PUBLIC ${OT_PUBLIC_INCLUDES} PRIVATE ${COMMON_INCLUDES})
target_sources(openthread-radio-spinel PRIVATE radio_spinel.cpp)
target_sources(openthread-spinel-ncp PRIVATE ${COMMON_SOURCES})
target_sources(openthread-spinel-rcp PRIVATE ${COMMON_SOURCES})
target_link_libraries(openthread-radio-spinel
PRIVATE
ot-config
)
target_link_libraries(openthread-spinel-ncp
PRIVATE
ot-config-ftd
+1
View File
@@ -50,6 +50,7 @@ target_link_libraries(ot-cli PRIVATE
openthread-posix
openthread-cli-ftd
openthread-hdlc
openthread-radio-spinel
openthread-spinel-rcp
${OT_MBEDTLS}
${READLINE_LINK_LIBRARIES}
+1
View File
@@ -42,6 +42,7 @@ target_link_libraries(ot-daemon PRIVATE
openthread-ftd
openthread-posix
openthread-hdlc
openthread-radio-spinel
openthread-spinel-rcp
${OT_MBEDTLS}
ot-posix-config
+1
View File
@@ -154,6 +154,7 @@ target_link_libraries(openthread-posix
openthread-cli-ftd
openthread-ftd
openthread-hdlc
openthread-radio-spinel
openthread-spinel-rcp
openthread-url
ot-config-ftd