summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/project/target.lua10
-rw-r--r--xmake/rules/swift/xmake.lua3
2 files changed, 6 insertions, 7 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 3f9e7b813..6547a4a6c 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -1065,17 +1065,17 @@ end
-- get the target compiler
function _instance:compiler(sourcekind)
- local compilerinst = self:_memcache():get("compiler")
+ if not sourcekind then
+ os.raise("please pass sourcekind to the first argument of target:compiler(), e.g. cc, cxx, as")
+ end
+ local compilerinst = self:_memcache():get("compiler_" .. sourcekind)
if not compilerinst then
- if not sourcekind then
- os.raise("please pass sourcekind to the first argument of target:compiler(), e.g. cc, cxx, as")
- end
local instance, errors = compiler.load(sourcekind, self)
if not instance then
os.raise(errors)
end
compilerinst = instance
- self:_memcache():set("compiler", compilerinst)
+ self:_memcache():set("compiler_" .. sourcekind, compilerinst)
end
return compilerinst
end
diff --git a/xmake/rules/swift/xmake.lua b/xmake/rules/swift/xmake.lua
index 6a96c7b31..46b225db9 100644
--- a/xmake/rules/swift/xmake.lua
+++ b/xmake/rules/swift/xmake.lua
@@ -95,8 +95,7 @@ rule("swift.interop")
end
local mode = target:data("swift.interop")
- -- local sc = target:compiler("sc")
- local sc = import("core.tool.compiler").load("sc")
+ local sc = target:compiler("sc")
assert(sc, "No swift compiler found!")
local outdir = target:data("swift.interop.outdir")
if not os.isdir(outdir) then os.mkdir(outdir) end