From 48d424f2621c1eac563d642ef05c5b34c8d12d2c Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 28 May 2020 23:00:52 +0800 Subject: fix target:tool --- tests/projects/asm/yasm/src/main.c | 0 tests/projects/asm/yasm/xmake.lua | 2 +- xmake/core/project/target.lua | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/projects/asm/yasm/src/main.c diff --git a/tests/projects/asm/yasm/src/main.c b/tests/projects/asm/yasm/src/main.c new file mode 100644 index 000000000..e69de29bb diff --git a/tests/projects/asm/yasm/xmake.lua b/tests/projects/asm/yasm/xmake.lua index f728b2ca1..213944890 100644 --- a/tests/projects/asm/yasm/xmake.lua +++ b/tests/projects/asm/yasm/xmake.lua @@ -1,3 +1,3 @@ target("test") set_kind("binary") - add_files("src/*.S") + add_files("src/*.S", "src/*.c") diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 2054e4ed6..e5d29f36d 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1689,6 +1689,12 @@ function _instance:tool(toolkind) end end + -- attempt to get program from config first + if not program then + program = config.get(toolkind) + toolname = config.get("__toolname_" .. toolkind) + end + -- get program from target/toolchains if not program then local toolchains = self:toolchains() @@ -1699,6 +1705,16 @@ function _instance:tool(toolkind) end end end + + -- contain toolname? parse it, e.g. 'gcc@xxxx.exe' + if program and type(program) == "string" then + local pos = program:find('@', 1, true) + if pos then + toolname = program:sub(1, pos - 1) + program = program:sub(pos + 1) + end + end + if program then toolinfo[1] = program toolinfo[2] = toolname -- cgit v1.3.1