From d6591287d047d23409d003a4ce68f7c75acb03a8 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 11 Jun 2022 20:02:34 +0800 Subject: improve cl/ccache --- xmake/modules/core/tools/cl.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index fdcce6d45..5969c3844 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -467,15 +467,16 @@ function _preprocess(program, argv, opt) if not os.isdir(cppfiledir) then os.mkdir(cppfiledir) end - table.insert(cppflags, "-P") + table.insert(cppflags, "-E") if linemarkers == false then table.insert(cppflags, "-EP") end - table.insert(cppflags, "-Fi" .. cppfile) table.insert(cppflags, sourcefile) return try{ function() - local outdata, errdata = vstool.iorunv(program, winos.cmdargv(cppflags), opt) - return {outdata = outdata, errdata = errdata, + local outdata, errdata = os.iorunv(program, winos.cmdargv(cppflags), opt) + io.writefile(cppfile, outdata or "") + -- includes information will be output to stderr instead of stdout now + return {outdata = errdata, errdata = errdata, sourcefile = sourcefile, objectfile = objectfile, cppfile = cppfile, cppflags = flags, pdbfile = pdbfile} end} @@ -637,3 +638,4 @@ function compile(self, sourcefile, objectfile, dependinfo, flags, opt) end end end + -- cgit v1.3.1