From ee15c74a2d73fc8df4a11efdc2dd4848807ffe27 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 28 Oct 2021 22:54:58 +0800 Subject: add custom commands for cmake --- xmake/rules/utils/bin2c/xmake.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'xmake/rules/utils/bin2c/xmake.lua') diff --git a/xmake/rules/utils/bin2c/xmake.lua b/xmake/rules/utils/bin2c/xmake.lua index 5110ea2fd..81e042c41 100644 --- a/xmake/rules/utils/bin2c/xmake.lua +++ b/xmake/rules/utils/bin2c/xmake.lua @@ -20,12 +20,18 @@ rule("utils.bin2c") set_extensions(".bin") + on_load(function (target) + local headerdir = path.join(target:autogendir(), "rules", "c++", "bin2c") + if not os.isdir(headerdir) then + os.mkdir(headerdir) + end + target:add("includedirs", headerdir) + end) before_buildcmd_file(function (target, batchcmds, sourcefile_bin, opt) -- get header file local headerdir = path.join(target:autogendir(), "rules", "c++", "bin2c") local headerfile = path.join(headerdir, path.filename(sourcefile_bin) .. ".h") - target:add("includedirs", headerdir) -- add commands batchcmds:show_progress(opt.progress, "${color.build.object}generating.bin2c %s", sourcefile_bin) -- cgit v1.3.1