PlayerLink/cmake/create_resources.cmake

11 lines
547 B
CMake
Raw Normal View History

2024-11-02 17:17:12 +01:00
function(create_resources dir output)
file(WRITE ${output} "")
file(GLOB bins ${dir}/*)
foreach(bin ${bins})
string(REGEX MATCH "([^/]+)$" filename ${bin})
string(REGEX REPLACE "\\.| |-" "_" filename ${filename})
file(READ ${bin} filedata HEX)
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata})
file(APPEND ${output} "inline const unsigned char ${filename}[] = {${filedata}};\ninline const unsigned ${filename}_size = sizeof(${filename});\n")
endforeach()
endfunction()