kobj.cmake 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # SPDX-License-Identifier: Apache-2.0
  2. function(gen_kobj gen_dir_out)
  3. if (PROJECT_BINARY_DIR)
  4. set(gen_dir ${PROJECT_BINARY_DIR}/include/generated)
  5. else ()
  6. set(gen_dir ${CMAKE_BINARY_DIR}/include/generated)
  7. endif ()
  8. set(KOBJ_TYPES ${gen_dir}/kobj-types-enum.h)
  9. set(KOBJ_OTYPE ${gen_dir}/otype-to-str.h)
  10. set(KOBJ_SIZE ${gen_dir}/otype-to-size.h)
  11. file(MAKE_DIRECTORY ${gen_dir})
  12. add_custom_command(
  13. OUTPUT ${KOBJ_TYPES} ${KOBJ_OTYPE} ${KOBJ_SIZE}
  14. COMMAND
  15. ${PYTHON_EXECUTABLE}
  16. ${ZEPHYR_BASE}/scripts/gen_kobject_list.py
  17. --kobj-types-output ${KOBJ_TYPES}
  18. --kobj-otype-output ${KOBJ_OTYPE}
  19. --kobj-size-output ${KOBJ_SIZE}
  20. ${gen_kobject_list_include_args}
  21. $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
  22. DEPENDS
  23. ${ZEPHYR_BASE}/scripts/gen_kobject_list.py
  24. ${PARSE_SYSCALLS_TARGET}
  25. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  26. )
  27. add_custom_target(${KOBJ_TYPES_H_TARGET} DEPENDS ${KOBJ_TYPES} ${KOBJ_OTYPE})
  28. set(${gen_dir_out} ${gen_dir} PARENT_SCOPE)
  29. endfunction ()