summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-15 13:56:54 +0800
committerruki <[email protected]>2022-05-15 13:56:54 +0800
commit58e7061326dca02c2e818aba33e8950f2297b709 (patch)
tree1e33a096d74473ab585727d2e9e19609e15c98ed
parent7cc01191aa786e67e3e35ffd552a6fbfff962182 (diff)
dispatch tool in server
-rw-r--r--xmake/modules/private/service/distcc_build/server_session.lua23
1 files changed, 22 insertions, 1 deletions
diff --git a/xmake/modules/private/service/distcc_build/server_session.lua b/xmake/modules/private/service/distcc_build/server_session.lua
index f45d9acf0..884f47c3b 100644
--- a/xmake/modules/private/service/distcc_build/server_session.lua
+++ b/xmake/modules/private/service/distcc_build/server_session.lua
@@ -100,7 +100,8 @@ function server_session:compile(respmsg)
function ()
local flags = body.flags
local toolname = body.toolname
- os.vrunv(toolname, table.join(flags, "-o", objectfile, sourcefile))
+ local compile = assert(self["_" .. toolname .. "_compile"], "%s: compiler(%s) is not supported!", self, toolname)
+ compile(self, toolname, flags, sourcefile, objectfile, body)
return os.isfile(objectfile)
end,
catch
@@ -172,6 +173,26 @@ function server_session:statusfile()
return path.join(self:workdir(), "status.txt")
end
+-- do compile job for gcc
+function server_session:_gcc_compile(toolname, flags, sourcefile, objectfile, opt)
+ os.vrunv(toolname, table.join(flags, "-o", objectfile, sourcefile))
+end
+
+-- do compile job for g++
+function server_session:_gxx_compile(toolname, flags, sourcefile, objectfile, opt)
+ return self:_gcc_compile(toolname, flags, sourcefile, objectfile, opt)
+end
+
+-- do compile job for clang
+function server_session:_clang_compile(toolname, flags, sourcefile, objectfile, opt)
+ return self:_gcc_compile(toolname, flags, sourcefile, objectfile, opt)
+end
+
+-- do compile job for clang++
+function server_session:_clangxx_compile(toolname, flags, sourcefile, objectfile, opt)
+ return self:_gcc_compile(toolname, flags, sourcefile, objectfile, opt)
+end
+
function server_session:__tostring()
return string.format("<session %s>", self:id())
end