cmake: extensions: introduce zephyr_syscall_include_directories

Add a new CMake helper to add new include directories to be parsed by
the syscall machinery. This helper complements the existing
zephyr_syscall_header, which works at a header-level.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2024-04-05 12:21:31 +02:00 committed by Carles Cufí
parent ca4e5d9c98
commit 80a6a20628
2 changed files with 31 additions and 0 deletions

View file

@ -694,6 +694,13 @@ if(CONFIG_ZTEST)
endif()
get_property(
syscalls_include_list
TARGET syscalls_interface
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
)
list(APPEND SYSCALL_INCLUDE_DIRS ${syscalls_include_list})
foreach(d ${SYSCALL_INCLUDE_DIRS})
list(APPEND parse_syscalls_include_args
--include ${d}

View file

@ -1619,6 +1619,30 @@ function(zephyr_build_string outvar)
set(${outvar} ${${outvar}} PARENT_SCOPE)
endfunction()
# Function to add one or more directories to the include list passed to the syscall generator.
function(zephyr_syscall_include_directories)
foreach(one_dir ${ARGV})
if(EXISTS ${one_dir})
set(include_dir ${one_dir})
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${one_dir})
set(include_dir ${CMAKE_CURRENT_SOURCE_DIR}/${one_dir})
else()
message(FATAL_ERROR "Syscall include directory not found: ${one_dir}")
endif()
target_include_directories(
syscalls_interface INTERFACE
${include_dir}
)
add_dependencies(
syscalls_interface
${include_dir}
)
unset(include_dir)
endforeach()
endfunction()
# Function to add header file(s) to the list to be passed to syscall generator.
function(zephyr_syscall_header)
foreach(one_file ${ARGV})