Make project Cmake ready

This commit is contained in:
2021-03-23 22:15:11 +01:00
parent 289f49204d
commit 4c3574c2e2
7 changed files with 68 additions and 317 deletions

View File

@@ -4,6 +4,7 @@
# bin2carray <output file> <input file>
import os
import os.path
import sys
if len(sys.argv) < 3:
@@ -18,7 +19,7 @@ with open(source_file, "rb") as src:
data = src.read()
with open(dest_file, "w") as dest:
header_guard = "__" + dest_file.replace('.', '_').replace('-', '_') + "_H__"
header_guard = "__" + os.path.basename(dest_file).replace('.', '_').replace('-', '_') + "_H__"
dest.write("#ifndef %s\n" % (header_guard))
dest.write("#define %s\n" % (header_guard))
dest.write("static const char binary_blob[%d] = {\n" % (len(data)))