summaryrefslogtreecommitdiff
path: root/xmake/core/tool/compiler.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-21 12:55:10 +0800
committerruki <[email protected]>2021-03-21 12:55:10 +0800
commitefa052bcecd4203dfce0fda26a297f3ce45ed47d (patch)
tree6c647dba446e5dcbc1a1bba06991813215c1ac1b /xmake/core/tool/compiler.lua
parent03b2656fb77fb3339e43bf8871398b0e2f052a80 (diff)
improve linker and compiler for package
Diffstat (limited to 'xmake/core/tool/compiler.lua')
-rw-r--r--xmake/core/tool/compiler.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index b896d04b6..0e64de8c3 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -46,7 +46,7 @@ function compiler:_add_flags_from_toolchains(flags, targetkind, target)
-- add flags for platform with the given target kind, e.g. binary.gcc.cxflags or binary.cxflags
if targetkind then
local toolname = self:name()
- if target and target:type() == "target" then
+ if target and target.toolconfig then
for _, flagkind in ipairs(self:_flagkinds()) do
local toolflags = target:toolconfig(targetkind .. '.' .. toolname .. '.' .. flagkind)
table.join2(flags, toolflags or target:toolconfig(targetkind .. '.' .. flagkind))
@@ -79,7 +79,7 @@ function compiler._load_tool(sourcekind, target)
-- get program from target
local program, toolname, toolchain_info
- if target and target:type() == "target" then
+ if target and target.tool then
program, toolname, toolchain_info = target:tool(sourcekind)
end
@@ -138,7 +138,7 @@ function compiler.load(sourcekind, target)
-- add toolchains flags to the compiler tool, e.g. gcc.cxflags or cxflags
local toolname = compiler_tool:name()
- if target and target:type() == "target" then
+ if target and target.toolconfig then
for _, flagkind in ipairs(instance:_flagkinds()) do
compiler_tool:add(flagkind, target:toolconfig(toolname .. '.' .. flagkind) or target:toolconfig(flagkind))
end
@@ -296,7 +296,7 @@ function compiler:compflags(opt)
-- get target kind
local targetkind = opt.targetkind
- if not targetkind and target and target.targetkind then
+ if not targetkind and target and target:type() == "target" then
targetkind = target:kind()
end