From 906fa7a6d77e20190ebe943361e53c595237e52e Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 22 Aug 2024 00:49:04 +0800 Subject: archive xmake.xmz --- core/src/demo/xmake.lua | 12 ++++++++++++ core/xmake.lua | 7 +++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/src/demo/xmake.lua b/core/src/demo/xmake.lua index f519dd88a..f0900402d 100644 --- a/core/src/demo/xmake.lua +++ b/core/src/demo/xmake.lua @@ -88,3 +88,15 @@ target("demo") end 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}) + end + end) diff --git a/core/xmake.lua b/core/xmake.lua index 28bf4f22b..45fd9b2c1 100644 --- a/core/xmake.lua +++ b/core/xmake.lua @@ -55,8 +55,11 @@ if has_config("cosmocc") then set_policy("build.ccache", false) end --- the cosmocc option -option("cosmocc", {default = false, category = "option", description = "Use cosmocc toolchain to build once and run anywhere."}) +-- use cosmocc toolchain +option("cosmocc", {default = false, description = "Use cosmocc toolchain to build once and run anywhere."}) + +-- embed all script files +option("embed", {default = false, description = "Embed all script files."}) -- the runtime option option("runtime") -- cgit v1.3.1