cmake: fix nrf91 modem static library build

This commit is contained in:
raiden00pl 2023-07-13 16:29:03 +02:00 committed by Xiang Xiao
parent 548f4b652c
commit 97309dd22d
2 changed files with 55 additions and 45 deletions

View File

@ -89,7 +89,7 @@ endif()
if(CONFIG_NRF91_MODEM)
set(NRFXLIB_VER "2.3.0")
set(NRFXLIB_VER "2.4.0")
set(NRFXLIB_URL "https://github.com/nrfconnect/sdk-nrfxlib/archive")
if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/sdk-nrfxlib)
@ -120,16 +120,14 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/sdk-nrfxlib)
endif()
endif()
set(NRFXLIB_DIR "${NUTTX_CHIP_ABS_DIR}/sdk-nrfxlib")
target_include_directories(arch PRIVATE ${NRFXLIB_DIR}/nrf_modem/include)
list(APPEND SRCS nrf53_modem.c nrf53_modem_os.c nrf53_nrfx_ipc.c)
list(APPEND SRCS nrf91_modem.c nrf91_modem_os.c nrf91_nrfx_ipc.c)
if(CONFIG_NRF91_MODEM_AT)
list(APPEND SRCS nrf91_modem_at.c)
endif()
set(NRFXLIB_DIR "${NUTTX_CHIP_ABS_DIR}/sdk-nrfxlib")
if(CONFIG_ARCH_FPU)
set(NRFXLIB_LIB_VARIANT hard-float)
else ()
@ -142,9 +140,12 @@ else()
set(MODEM_LIB_VARIANT libmodem_log.a)
endif()
target_link_libraries(arch
${NRFXLIB_DIR}/nrf_modem/lib/cortex-m33+nodsp/${NRFXLIB_LIB_VARIANT}/${MODEM_LIB_VARIANT})
nuttx_library_import(modem
${NRFXLIB_DIR}/nrf_modem/lib/cortex-m33/${NRFXLIB_LIB_VARIANT}/${MODEM_LIB_VARIANT})
target_include_directories(arch PRIVATE ${NRFXLIB_DIR}/nrf_modem/include)
target_link_libraries(arch PRIVATE modem)
target_link_libraries(modem INTERFACE arch c)
endif()
target_sources(arch PRIVATE ${SRCS})

View File

@ -175,3 +175,12 @@ function(nuttx_add_library target)
nuttx_add_library_internal(${target})
endfunction()
# Import static library
#
function(nuttx_library_import library_name library_path)
add_library(${library_name} STATIC IMPORTED GLOBAL)
set_target_properties(${library_name}
PROPERTIES IMPORTED_LOCATION
${library_path})
endfunction()