Initial release

This commit is contained in:
civ
2026-08-16 18:24:52 +07:00
commit 876886a39a
13244 changed files with 2353959 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
# CMake equivalent of `xxd -i ${INPUT} ${OUTPUT}`
# Converts any binary file into a C array. Pure CMake, no external tools.
# Works on Linux, macOS, and Windows (no xxd, no bash required).
# Usage: cmake -DINPUT=path/to/file -DOUTPUT=path/to/file.hpp -P xxd.cmake
file(READ "${INPUT}" hex_data HEX)
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," hex_sequence "${hex_data}")
string(LENGTH ${hex_data} hex_len)
math(EXPR len "${hex_len} / 2")
get_filename_component(filename "${INPUT}" NAME)
string(REGEX REPLACE "\\.|-" "_" name "${filename}")
file(WRITE "${OUTPUT}" "unsigned char ${name}[] = {${hex_sequence}};\nunsigned int ${name}_len = ${len};\n")