summaryrefslogtreecommitdiff
path: root/core/src/xmake/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2024-08-22 00:51:11 +0800
committerruki <[email protected]>2024-08-22 00:51:11 +0800
commitf279f505880fc1c7390a67b445c2a934fcb04302 (patch)
treed451ac734f204a42f997a9c89f262c998e5c0b33 /core/src/xmake/xmake.lua
parente1c5ce34cdac1353f8c30a5842b51eb5e3e53d28 (diff)
add bin2c xmake.xmz
Diffstat (limited to 'core/src/xmake/xmake.lua')
-rw-r--r--core/src/xmake/xmake.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua
index af0bfd877..f5f2d9699 100644
--- a/core/src/xmake/xmake.lua
+++ b/core/src/xmake/xmake.lua
@@ -55,3 +55,17 @@ target("xmake")
add_defines("UNICODE", "_UNICODE")
end
+ -- embed all script files
+ add_rules("utils.bin2c", {linewidth = 16, extensions = ".xmz"})
+ on_config(function (target)
+ import("utils.archive.archive")
+ if has_config("embed") then
+ local archivefile = path.join(target:autogendir(), "bin2c", "xmake.xmz")
+ print("archiving %s ..", archivefile)
+ os.tryrm(archivefile)
+ local rootdir = path.normalize(path.join(os.projectdir(), "..", "xmake"))
+ archive(archivefile, rootdir, {recurse = true, curdir = rootdir})
+ target:add("files", archivefile)
+ target:add("defines", "XM_EMBED_ENABLE=1")
+ end
+ end)