diff options
| author | ruki <[email protected]> | 2024-02-19 22:55:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-02-19 22:55:45 +0800 |
| commit | f4a9a9e3fa36f3f0cf1e655c58bf3fa4d546348b (patch) | |
| tree | 0b42eb09db96cdc6cea528fafecc4e1b274d6d0e /xmake/plugins/project/utils/target_cmds.lua | |
| parent | 7e126bdbcc883f59c43ccc94eb80f2607d612ef0 (diff) | |
improve target_buildcmd
Diffstat (limited to 'xmake/plugins/project/utils/target_cmds.lua')
| -rw-r--r-- | xmake/plugins/project/utils/target_cmds.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/xmake/plugins/project/utils/target_cmds.lua b/xmake/plugins/project/utils/target_cmds.lua index 4c7f4f008..92d1bee47 100644 --- a/xmake/plugins/project/utils/target_cmds.lua +++ b/xmake/plugins/project/utils/target_cmds.lua @@ -39,7 +39,9 @@ function _sourcebatch_is_built(sourcebatch) end -- get target buildcmd commands -function get_target_buildcmd(target, cmds, suffix) +function get_target_buildcmd(target, cmds, opt) + opt = opt or {} + local suffix = opt.suffix for _, ruleinst in ipairs(target:orderules()) do local scriptname = "buildcmd" .. (suffix and ("_" .. suffix) or "") local script = ruleinst:script(scriptname) @@ -54,13 +56,15 @@ function get_target_buildcmd(target, cmds, suffix) end -- get target buildcmd_files commands -function get_target_buildcmd_files(target, cmds, sourcebatch, suffix) +function get_target_buildcmd_files(target, cmds, sourcebatch, opt) + opt = opt or {} -- get rule local rulename = assert(sourcebatch.rulename, "unknown rule for sourcebatch!") local ruleinst = assert(target:rule(rulename) or project.rule(rulename) or rule.rule(rulename), "unknown rule: %s", rulename) -- generate commands for xx_buildcmd_files + local suffix = opt.suffix local scriptname = "buildcmd_files" .. (suffix and ("_" .. suffix) or "") local script = ruleinst:script(scriptname) if script then @@ -89,14 +93,14 @@ function get_target_buildcmd_files(target, cmds, sourcebatch, suffix) end -- get target buildcmd commands of source group -function get_target_buildcmd_sourcegroups(target, cmds, sourcegroups, suffix) +function get_target_buildcmd_sourcegroups(target, cmds, sourcegroups, opt) for idx, group in irpairs(sourcegroups) do for _, item in pairs(group) do -- buildcmd scripts are always in rule, so we need to ignore target item (item.target). local sourcebatch = item.sourcebatch if item.rule then if not _sourcebatch_is_built(sourcebatch) then - get_target_buildcmd_files(target, cmds, sourcebatch, suffix) + get_target_buildcmd_files(target, cmds, sourcebatch, opt) end end end |
