summaryrefslogtreecommitdiff
path: root/xmake/core/language/language.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-02-27 20:09:26 +0800
committerruki <[email protected]>2017-02-27 20:09:26 +0800
commit1a93fd94a1f1f24e4dc0307796438772c88eb436 (patch)
tree041c823ebfb4667c44a59852e866813c6d0083fb /xmake/core/language/language.lua
parent65f49bd7b23dbbb2516b93518906f451cd35a7c0 (diff)
fix load language error
Diffstat (limited to 'xmake/core/language/language.lua')
-rw-r--r--xmake/core/language/language.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/xmake/core/language/language.lua b/xmake/core/language/language.lua
index 97c7d555f..1b2eff42c 100644
--- a/xmake/core/language/language.lua
+++ b/xmake/core/language/language.lua
@@ -153,6 +153,17 @@ function _instance:targetflags()
return self._INFO.targetflags
end
+-- get the mixing kinds for linker
+--
+-- .e.g
+-- {"cc", "cxx"}
+--
+function _instance:mixingkinds()
+
+ -- get it
+ return self._INFO.mixingkinds
+end
+
-- get the name flags
function _instance:nameflags()
@@ -231,6 +242,7 @@ function language._interpreter()
{
-- language.set_xxx
"language.set_menu"
+ , "language.set_mixingkinds"
}
, script =
{
@@ -570,7 +582,7 @@ function language.linkerinfos_of(targetkind, sourcekinds)
-- make linker infos
linkerinfos = {}
for name, instance in pairs(languages) do
- for sourcekind, _ in pairs(instance:sourcekinds()) do
+ for _, mixingkind in ipairs(table.wrap(instance:mixingkinds())) do
local targetflags = instance:targetflags()
for _targetkind, linkerkind in pairs(instance:targetkinds()) do
@@ -585,8 +597,8 @@ function language.linkerinfos_of(targetkind, sourcekinds)
if linkerflag then
linkerinfo.linkerflag = linkerflag
end
- linkerinfo.sourcekinds = linkerinfo.sourcekinds or {}
- linkerinfo.sourcekinds[sourcekind] = 1
+ linkerinfo.mixingkinds = linkerinfo.mixingkinds or {}
+ linkerinfo.mixingkinds[mixingkind] = 1
linkerinfo.sourcecount = (linkerinfo.sourcecount or 0) + 1
end
end
@@ -603,7 +615,7 @@ function language.linkerinfos_of(targetkind, sourcekinds)
-- match all source kinds?
local count = 0
for _, sourcekind in ipairs(sourcekinds) do
- count = count + (linkerinfo.sourcekinds[sourcekind] or 0)
+ count = count + (linkerinfo.mixingkinds[sourcekind] or 0)
end
if count == #sourcekinds then
table.insert(results, linkerinfo)