aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/archive.cmake
blob: f822498daebd229881debd6960122635ed6be713 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
find_package(Python3 REQUIRED)

function(target_rodata_sources TgtName Scope)
  foreach(rodata ${ARGN})
    get_filename_component(CppVar ${rodata} NAME_WLE)
    add_custom_command(
        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp
        COMMAND Python3::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/rodata2cpp.py ${CppVar} ${rodata} ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp
        DEPENDS ${CMAKE_SOURCE_DIR}/build/scripts/rodata2cpp.py ${rodata}
    )
    target_sources(${TgtName} ${Scope} ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp)
  endforeach()
endfunction()