2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-04-06 04:59:33 +08:00
|
|
|
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)
|
2018-05-17 01:11:17 +08:00
|
|
|
set(KOBJ_SIZE ${gen_dir}/otype-to-size.h)
|
2018-04-06 04:59:33 +08:00
|
|
|
|
|
|
|
file(MAKE_DIRECTORY ${gen_dir})
|
|
|
|
|
|
|
|
add_custom_command(
|
2021-02-10 05:27:59 +08:00
|
|
|
OUTPUT ${KOBJ_TYPES} ${KOBJ_OTYPE} ${KOBJ_SIZE}
|
2018-04-06 04:59:33 +08:00
|
|
|
COMMAND
|
|
|
|
${PYTHON_EXECUTABLE}
|
2022-07-11 22:53:29 +08:00
|
|
|
${ZEPHYR_BASE}/scripts/build/gen_kobject_list.py
|
2018-04-06 04:59:33 +08:00
|
|
|
--kobj-types-output ${KOBJ_TYPES}
|
|
|
|
--kobj-otype-output ${KOBJ_OTYPE}
|
2018-05-17 01:11:17 +08:00
|
|
|
--kobj-size-output ${KOBJ_SIZE}
|
2020-03-01 06:51:42 +08:00
|
|
|
${gen_kobject_list_include_args}
|
2018-04-06 04:59:33 +08:00
|
|
|
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
|
2020-03-01 06:51:42 +08:00
|
|
|
DEPENDS
|
2022-07-11 22:53:29 +08:00
|
|
|
${ZEPHYR_BASE}/scripts/build/gen_kobject_list.py
|
2020-03-17 03:48:00 +08:00
|
|
|
${PARSE_SYSCALLS_TARGET}
|
2018-04-06 04:59:33 +08:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
)
|
2019-01-14 23:39:33 +08:00
|
|
|
add_custom_target(${KOBJ_TYPES_H_TARGET} DEPENDS ${KOBJ_TYPES} ${KOBJ_OTYPE})
|
2018-04-06 04:59:33 +08:00
|
|
|
|
|
|
|
set(${gen_dir_out} ${gen_dir} PARENT_SCOPE)
|
|
|
|
|
|
|
|
endfunction ()
|