diff options
| author | ruki <[email protected]> | 2022-05-15 15:57:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-05-15 15:57:28 +0800 |
| commit | 7cf0541b3f2e47592401cf3222ff0f4e3b8cba0f (patch) | |
| tree | cd2c976d2cca25467ac6c85310f52126b92dddf8 | |
| parent | 394c7d2c16caa670b46849b63b78e47fb1a428ea (diff) | |
fix cl for distcc
| -rw-r--r-- | xmake/modules/private/service/distcc_build/client_session.lua | 16 | ||||
| -rw-r--r-- | xmake/modules/private/service/distcc_build/server_session.lua | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/xmake/modules/private/service/distcc_build/client_session.lua b/xmake/modules/private/service/distcc_build/client_session.lua index 46269e807..ee92d32ec 100644 --- a/xmake/modules/private/service/distcc_build/client_session.lua +++ b/xmake/modules/private/service/distcc_build/client_session.lua @@ -158,8 +158,10 @@ function client_session:_cl_iorunv(program, argv, opt) local flags = {} local cppflags = {} local skipped = 0 + local objectfile for _, flag in ipairs(argv) do - if flag == "-Fo" then + if flag:startswith("-Fo") or flag:startswith("/Fo") then + objectfile = flag:sub(4) break end @@ -168,11 +170,10 @@ function client_session:_cl_iorunv(program, argv, opt) -- get compiler flags if flag == "-showIncludes" or flag == "/showIncludes" or - flag == "-sourceDependencies" or flag == "/sourceDependencies" or flag:startswith("-I") or flag:startswith("/I") or flag:startswith("-external:") or flag:startswith("/external:") then skipped = 1 - elseif flag == "-I" then + elseif flag == "-I" or flag == "-sourceDependencies" or flag == "/sourceDependencies" then skipped = 2 end if skipped > 0 then @@ -181,24 +182,23 @@ function client_session:_cl_iorunv(program, argv, opt) table.insert(flags, flag) end end - local objectfile = argv[#argv - 1] local sourcefile = argv[#argv] assert(objectfile and sourcefile, "%s: iorunv(%s): invalid arguments!", self, program) -- do preprocess - local cppfile = objectfile:gsub("%.obj$", ".p") + local cppfile = objectfile:gsub("%.obj$", ".i") local cppfiledir = path.directory(cppfile) if not os.isdir(cppfiledir) then os.mkdir(cppfiledir) end table.insert(cppflags, "-P") - table.insert(cppflags, "-Fo") - table.insert(cppflags, cppfile) + table.insert(cppflags, "-Fi" .. cppfile) table.insert(cppflags, sourcefile) - os.runv(program, cppflags, opt) + local outdata, errdata = os.iorunv(program, cppflags, opt) -- do compile self:_compile(sourcefile, cppfile, objectfile, flags, opt) + return outdata, errdata end -- do compile diff --git a/xmake/modules/private/service/distcc_build/server_session.lua b/xmake/modules/private/service/distcc_build/server_session.lua index 3b05d9ceb..afe8883ca 100644 --- a/xmake/modules/private/service/distcc_build/server_session.lua +++ b/xmake/modules/private/service/distcc_build/server_session.lua @@ -230,7 +230,7 @@ end function server_session:_cl_compile(toolname, flags, sourcefile, objectfile, opt) local program, toolname_real, runenvs = self:_tool(opt.toolchain, opt) assert(toolname_real == toolname, "toolname is not matched, %s != %s", toolname, toolname_real) - vstool.runv(program, table.join(flags, "-Fo", objectfile, sourcefile), {envs = runenvs}) + vstool.runv(program, table.join(flags, "-Fo" .. objectfile, sourcefile), {envs = runenvs}) end function server_session:__tostring() |
