diff options
| author | ruki <[email protected]> | 2021-11-16 09:48:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-11-16 09:48:53 +0800 |
| commit | 26ccb97f322fd3414001979d2d325522e7378868 (patch) | |
| tree | 06f6e72014871414646b9bebd25794412a9bdd33 /xmake/plugins/project/vstudio/impl/vs201x.lua | |
| parent | 8c67fe903098afed989fb9ba64881fb7267bca49 (diff) | |
add linkcmd for vs generator
Diffstat (limited to 'xmake/plugins/project/vstudio/impl/vs201x.lua')
| -rw-r--r-- | xmake/plugins/project/vstudio/impl/vs201x.lua | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua index d366649da..3c7d62737 100644 --- a/xmake/plugins/project/vstudio/impl/vs201x.lua +++ b/xmake/plugins/project/vstudio/impl/vs201x.lua @@ -86,8 +86,26 @@ function _make_custom_commands_for_target(commands, target, suffix) for _, cmd in ipairs(batchcmds_:cmds()) do local command = _get_command_string(cmd) if command then - commands[suffix] = commands[suffix] or {} - table.insert(commands[suffix], command) + local key = suffix and suffix or "before" + commands[key] = commands[key] or {} + table.insert(commands[key], command) + end + end + end + end + + scriptname = "linkcmd" .. (suffix and ("_" .. suffix) or "") + script = ruleinst:script(scriptname) + if script then + local batchcmds_ = batchcmds.new({target = target}) + script(target, batchcmds_, {}) + if not batchcmds_:empty() then + for _, cmd in ipairs(batchcmds_:cmds()) do + local command = _get_command_string(cmd) + if command then + local key = (suffix and suffix or "before") .. "_link" + commands[key] = commands[key] or {} + table.insert(commands[key], command) end end end @@ -112,8 +130,9 @@ function _make_custom_commands_for_objectrules(commands, target, sourcebatch, su for _, cmd in ipairs(batchcmds_:cmds()) do local command = _get_command_string(cmd) if command then - commands[suffix] = commands[suffix] or {} - table.insert(commands[suffix], command) + local key = suffix and suffix or "before" + commands[key] = commands[key] or {} + table.insert(commands[key], command) end end end @@ -132,8 +151,9 @@ function _make_custom_commands_for_objectrules(commands, target, sourcebatch, su for _, cmd in ipairs(batchcmds_:cmds()) do local command = _get_command_string(cmd) if command then - commands[suffix] = commands[suffix] or {} - table.insert(commands[suffix], command) + local key = suffix and suffix or "before" + commands[key] = commands[key] or {} + table.insert(commands[key], command) end end end @@ -146,6 +166,7 @@ end function _make_custom_commands(target) local commands = {} _make_custom_commands_for_target(commands, target, "before") + _make_custom_commands_for_target(commands, target) for _, sourcebatch in pairs(target:sourcebatches()) do local sourcekind = sourcebatch.sourcekind if sourcekind ~= "cc" and sourcekind ~= "cxx" and sourcekind ~= "as" then |
