mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-27 05:35:22 +00:00
Adding a new kernel object type or driver subsystem requires changes in various different places. This patch makes it easier to create those devices by generating as much as possible in compile time. No behavior change. Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
28 lines
789 B
CMake
28 lines
789 B
CMake
function(gen_kobj gen_dir_out)
|
|
if (PROJECT_BINARY_DIR)
|
|
set(gen_dir ${PROJECT_BINARY_DIR}/include/generated)
|
|
else ()
|
|
set(gen_dir ${CMAKE_BINARY_DIR}/include/generated)
|
|
endif ()
|
|
|
|
set(KOBJ_TYPES ${gen_dir}/kobj-types-enum.h)
|
|
set(KOBJ_OTYPE ${gen_dir}/otype-to-str.h)
|
|
|
|
file(MAKE_DIRECTORY ${gen_dir})
|
|
|
|
add_custom_command(
|
|
OUTPUT ${KOBJ_TYPES} ${KOBJ_OTYPE}
|
|
COMMAND
|
|
${PYTHON_EXECUTABLE}
|
|
$ENV{ZEPHYR_BASE}/scripts/gen_kobject_list.py
|
|
--kobj-types-output ${KOBJ_TYPES}
|
|
--kobj-otype-output ${KOBJ_OTYPE}
|
|
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
)
|
|
add_custom_target(kobj_types_h_target DEPENDS ${KOBJ_TYPES} ${KOBJ_OTYPE})
|
|
|
|
set(${gen_dir_out} ${gen_dir} PARENT_SCOPE)
|
|
|
|
endfunction ()
|