mirror of https://github.com/thesofproject/sof.git
lmdk: Build module common functions
Added building a static library containing common functions for modules provided by sof. Native loadable modules are statically linked to it. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
This commit is contained in:
parent
f3e0959472
commit
4d4421a046
|
@ -9,6 +9,11 @@ endif()
|
|||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/config.cmake)
|
||||
|
||||
# Build common module functions from sof to a static library
|
||||
add_library(sof STATIC)
|
||||
target_include_directories(sof PRIVATE "${SOF_BASE}/src/include")
|
||||
add_subdirectory("${SOF_BASE}/src/module" module_api)
|
||||
|
||||
foreach(MODULE ${MODULES_LIST})
|
||||
add_executable(${MODULE})
|
||||
add_subdirectory(${LMDK_BASE}/modules/${MODULE} ${MODULE}_module)
|
||||
|
@ -36,6 +41,9 @@ foreach(MODULE ${MODULES_LIST})
|
|||
-P ${CMAKE_CURRENT_LIST_DIR}/ldscripts.cmake
|
||||
)
|
||||
|
||||
# Link module with sof common module functions
|
||||
target_link_libraries(${MODULE} sof)
|
||||
|
||||
target_link_options(${MODULE} PRIVATE
|
||||
"-nostartfiles"
|
||||
"-Wl,--no-undefined" "-Wl,--unresolved-symbols=report-all" "-Wl,--error-unresolved-symbols"
|
||||
|
|
|
@ -16,3 +16,22 @@ cmake_path(ABSOLUTE_PATH SOF_BASE NORMALIZE)
|
|||
|
||||
set(RIMAGE_INCLUDE_DIR ${SOF_BASE}/tools/rimage/src/include)
|
||||
cmake_path(ABSOLUTE_PATH RIMAGE_INCLUDE_DIR NORMALIZE)
|
||||
|
||||
# Adds sources to target like target_sources, but assumes that
|
||||
# paths are relative to subdirectory.
|
||||
# Works like:
|
||||
# Cmake >= 3.13:
|
||||
# target_sources(<target> PRIVATE <sources>)
|
||||
# Cmake < 3.13:
|
||||
# target_sources(<target> PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/<sources>)
|
||||
function(add_local_sources target)
|
||||
foreach(arg ${ARGN})
|
||||
if(IS_ABSOLUTE ${arg})
|
||||
set(path ${arg})
|
||||
else()
|
||||
set(path ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
||||
endif()
|
||||
|
||||
target_sources(${target} PRIVATE ${path})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
|
Loading…
Reference in New Issue