Skip to content

Commit

Permalink
[build] move radio_spinel.cpp to new lib openthread-radio-spinel (o…
Browse files Browse the repository at this point in the history
…penthread#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`.
  • Loading branch information
zhanglongxia authored Nov 2, 2023
1 parent 4a9fb06 commit 5058500
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/lib/spinel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
)
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/posix/cli.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions src/posix/daemon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/posix/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5058500

Please sign in to comment.