summaryrefslogtreecommitdiff
path: root/xmake/tools/swiftc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/tools/swiftc.lua')
-rw-r--r--xmake/tools/swiftc.lua22
1 files changed, 14 insertions, 8 deletions
diff --git a/xmake/tools/swiftc.lua b/xmake/tools/swiftc.lua
index cb391b0f8..9f7842440 100644
--- a/xmake/tools/swiftc.lua
+++ b/xmake/tools/swiftc.lua
@@ -21,6 +21,7 @@
--
-- imports
+import("core.tool.tool")
import("core.project.config")
-- init it
@@ -76,8 +77,20 @@ end
-- make the compile command
function compcmd(sourcefile, objectfile, flags)
+ -- get ccache
+ local ccache = nil
+ if config.get("ccache") then
+ ccache = tool.shellname("ccache")
+ end
+
-- make it
- return format("%s -c %s -o %s %s", _g.shellname, flags, objectfile, sourcefile)
+ local command = format("%s -c %s -o %s %s", _g.shellname, flags, objectfile, sourcefile)
+ if ccache then
+ command = ccache:append(command, " ")
+ end
+
+ -- ok
+ return command
end
-- complie the source file
@@ -115,13 +128,6 @@ function undefine(macro)
return "-Xcc -U" .. macro
end
--- run command
-function run(...)
-
- -- run it
- os.run(...)
-end
-
-- check the given flags
function check(flags)