summaryrefslogtreecommitdiff
path: root/xmake/rules
diff options
context:
space:
mode:
authorruki <[email protected]>2021-10-28 22:54:58 +0800
committerruki <[email protected]>2021-10-28 22:54:58 +0800
commitee15c74a2d73fc8df4a11efdc2dd4848807ffe27 (patch)
treea830293d3c0ed676b57076d117beea4ad02b11eb /xmake/rules
parent0b3057dce66dc41957de6c588d1fd2664c8de298 (diff)
add custom commands for cmake
Diffstat (limited to 'xmake/rules')
-rw-r--r--xmake/rules/utils/bin2c/xmake.lua8
1 files changed, 7 insertions, 1 deletions
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)