summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Poelen <[email protected]>2020-11-10 03:12:12 +0100
committerJonathan Poelen <[email protected]>2020-11-10 03:12:12 +0100
commit23a4ae9f9541b900055fbf033a7f489f5ac0f5df (patch)
tree7ed0e3d62b3e7b257f7d656b89194e78a429eca3
parente4df2baa7a047a8aafc4cd38d50becac53a1eba8 (diff)
ninja generator: support for CLI-specified tools
-rw-r--r--xmake/plugins/project/ninja/build_ninja.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/xmake/plugins/project/ninja/build_ninja.lua b/xmake/plugins/project/ninja/build_ninja.lua
index 29c102451..60d79d0c9 100644
--- a/xmake/plugins/project/ninja/build_ninja.lua
+++ b/xmake/plugins/project/ninja/build_ninja.lua
@@ -26,6 +26,7 @@ import("core.language.language")
import("core.tool.linker")
import("core.tool.compiler")
import("lib.detect.find_tool")
+import("lib.detect.find_toolname")
-- add header
function _add_header(ninjafile)
@@ -107,8 +108,12 @@ function _add_rules_for_compiler(ninjafile)
}
for sourcekind, _ in pairs(language.sourcekinds()) do
local program, toolname = platform.tool(sourcekind)
- if program and toolname then
- local add_rule = add_compiler_rules[toolname]
+ if program then
+ local add_rule = add_compiler_rules[toolname or find_toolname(program)]
+ -- support of unknown compiler (xmake f --cc=gcc@my-cc)
+ if not add_rule and toolname then
+ add_rule = add_compiler_rules[find_toolname(toolname)]
+ end
if add_rule then
add_rule(ninjafile, sourcekind, program)
end
@@ -164,8 +169,12 @@ function _add_rules_for_linker(ninjafile)
}
for _, linkerkind in ipairs(table.unique(linkerkinds)) do
local program, toolname = platform.tool(linkerkind)
- if program and toolname then
- local add_rule = add_linker_rules[toolname]
+ if program then
+ local add_rule = add_linker_rules[toolname or find_toolname(program)]
+ -- support of unknown linker (xmake f --ld=gcc@my-ld)
+ if not add_rule and toolname then
+ add_rule = add_linker_rules[find_toolname(toolname)]
+ end
if add_rule then
add_rule(ninjafile, linkerkind, program)
end