mirror of https://github.com/thesofproject/sof.git
cmake: install public headers for host
Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
This commit is contained in:
parent
378d572193
commit
ecb73cad2d
|
@ -48,11 +48,17 @@ include(scripts/cmake/git-hooks.cmake)
|
|||
# most of other options are set on per-arch and per-target basis
|
||||
set(CMAKE_ASM_FLAGS -DASSEMBLY)
|
||||
|
||||
# interface library that is used only as container for sof public header files
|
||||
# that may be exported / installed
|
||||
add_library(sof_public_headers INTERFACE)
|
||||
|
||||
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/include)
|
||||
|
||||
# interface library that is used only as container for sof binary options
|
||||
# other targets can use it to build with the same options
|
||||
add_library(sof_options INTERFACE)
|
||||
|
||||
target_include_directories(sof_options INTERFACE ${PROJECT_SOURCE_DIR}/src/include)
|
||||
target_link_libraries(sof_options INTERFACE sof_public_headers)
|
||||
|
||||
# get compiler name and version
|
||||
execute_process(
|
||||
|
@ -104,8 +110,8 @@ endif()
|
|||
|
||||
include(scripts/cmake/kconfig.cmake)
|
||||
|
||||
add_dependencies(sof_options genconfig check_version_h)
|
||||
target_include_directories(sof_options INTERFACE ${GENERATED_DIRECTORY}/include)
|
||||
add_dependencies(sof_public_headers genconfig check_version_h)
|
||||
target_include_directories(sof_public_headers INTERFACE ${GENERATED_DIRECTORY}/include)
|
||||
|
||||
if(BUILD_HOST)
|
||||
add_library(sof SHARED "")
|
||||
|
@ -113,6 +119,22 @@ if(BUILD_HOST)
|
|||
install(TARGETS sof DESTINATION lib)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
get_target_property(incdirs sof_public_headers INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
# we append slash at the end to make CMake copy contents of directories
|
||||
# instead of directories
|
||||
set(incdirs_for_install "")
|
||||
|
||||
foreach(d ${incdirs})
|
||||
list(APPEND incdirs_for_install "${d}/")
|
||||
endforeach()
|
||||
|
||||
install(DIRECTORY ${incdirs_for_install}
|
||||
DESTINATION include
|
||||
PATTERN "*.h"
|
||||
)
|
||||
|
||||
# rest of this file is not needed for host build
|
||||
return()
|
||||
endif()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# includes
|
||||
target_include_directories(sof_options INTERFACE ${PROJECT_SOURCE_DIR}/src/arch/host/include)
|
||||
target_include_directories(sof_options INTERFACE ${PROJECT_SOURCE_DIR}/src/platform/library/include)
|
||||
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/arch/host/include)
|
||||
target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/platform/library/include)
|
||||
|
||||
# C & ASM flags
|
||||
target_compile_options(sof_options INTERFACE -g -O3 -Wall -Werror -Wl,-EL -Wmissing-prototypes -Wimplicit-fallthrough=3)
|
||||
|
|
|
@ -114,6 +114,13 @@ function(sof_add_ld_script binary_name script_name)
|
|||
list(APPEND glob_predicates "${d}/*.h")
|
||||
endforeach()
|
||||
|
||||
get_target_property(incdirs sof_public_headers INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
foreach(d ${incdirs})
|
||||
list(APPEND iflags "-I${d}")
|
||||
list(APPEND glob_predicates "${d}/*.h")
|
||||
endforeach()
|
||||
|
||||
file(GLOB lds_headers ${glob_predicates})
|
||||
|
||||
add_custom_command(OUTPUT ${lds_out}
|
||||
|
|
Loading…
Reference in New Issue