archive.cmake 580 B

12345678910111213
  1. find_package(Python3 REQUIRED)
  2. function(target_rodata_sources TgtName Scope)
  3. foreach(rodata ${ARGN})
  4. get_filename_component(CppVar ${rodata} NAME_WLE)
  5. add_custom_command(
  6. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp
  7. COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/rodata2cpp.py ${CppVar} ${rodata} ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp
  8. DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/rodata2cpp.py ${rodata}
  9. )
  10. target_sources(${TgtName} ${Scope} ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp)
  11. endforeach()
  12. endfunction()