11 lines
547 B
CMake
11 lines
547 B
CMake
|
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()
|