diff options
| author | ruki <[email protected]> | 2026-03-22 21:58:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-03-22 21:58:01 +0800 |
| commit | 484b73ea9ab074569edd8708f49868dbf61d0b03 (patch) | |
| tree | fec3ea025e838a1a49e9fdcffaca2f73b8248169 /xmake/rules/xmake_cli/xmake.lua | |
| parent | 5b8089e2ed3a647eb1c87adcd226f3a817a440eb (diff) | |
use bin2obj in xmake.cli
Diffstat (limited to 'xmake/rules/xmake_cli/xmake.lua')
| -rw-r--r-- | xmake/rules/xmake_cli/xmake.lua | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/xmake/rules/xmake_cli/xmake.lua b/xmake/rules/xmake_cli/xmake.lua index a15e0f858..8106cfda1 100644 --- a/xmake/rules/xmake_cli/xmake.lua +++ b/xmake/rules/xmake_cli/xmake.lua @@ -24,16 +24,12 @@ rule("xmake.cli") on_load(function (target) target:set("kind", "binary") assert(target:pkg("libxmake"), 'please add_packages("libxmake") to target(%s) first!', target:name()) - - local headerdir = path.join(target:autogendir(), "rules", "xmake.cli", "include") - if not os.isdir(headerdir) then - os.mkdir(headerdir) - end - target:add("includedirs", headerdir) end) before_buildcmd_files(function (target, batchcmds, sourcebatch, opt) import("private.core.base.match_copyfiles") + import("rules.utils.bin2obj.utils", {alias = "bin2obj_utils", rootdir = os.programdir()}) + local sourcefiles = sourcebatch.sourcefiles local archivefile = path.join(target:autogendir(), "rules", "xmake.cli", "luafiles.xmz") local dependfile = archivefile .. ".d" @@ -51,11 +47,8 @@ rule("xmake.cli") end batchcmds:vrunv(os.programfile(), argv, {envs = {XMAKE_SKIP_HISTORY = "y"}}) - local headerdir = path.join(target:autogendir(), "rules", "xmake.cli", "include") - local headerfile = path.join(headerdir, "luafiles.xmz.h") - target:add("includedirs", headerdir) - argv = {"--nozeroend", "-i", path(archivefile), "-o", path(headerfile)} - batchcmds:vlua("cli.binutils.bin2c", argv) + -- convert archive to object file via bin2obj + bin2obj_utils.generate_objectfile(target, batchcmds, archivefile) batchcmds:add_depfiles(sourcefiles) batchcmds:set_depmtime(os.mtime(dependfile)) |
