diff options
| author | ruki <[email protected]> | 2016-07-12 16:39:30 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-12 16:39:30 +0800 |
| commit | 2a95f6e1394c42f166ac4184ab2cf4d77b4ffa7a (patch) | |
| tree | c65cc09f95249a2491352a10313a0d7f9f74060f | |
| parent | 18894a316af66cb5fc2556e7e2a119a93e37458d (diff) | |
fix and optimizate to compile issues for cl.exe
| -rw-r--r-- | xmake/core/sandbox/modules/os.lua | 2 | ||||
| -rwxr-xr-x | xmake/tools/cl.lua | 21 | ||||
| -rwxr-xr-x | xmake/tools/gcc.lua | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua index ab61d0866..03ffe7af0 100644 --- a/xmake/core/sandbox/modules/os.lua +++ b/xmake/core/sandbox/modules/os.lua @@ -242,7 +242,7 @@ function sandbox_os.iorun(cmd, ...) -- run it local ok, outdata, errdata = os.iorun(cmd) if not ok then - os.raise(errdata) + os.raise((outdata or "") .. (errdata or "")) end -- ok diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua index 660c47ed8..0ec391e36 100755 --- a/xmake/tools/cl.lua +++ b/xmake/tools/cl.lua @@ -126,7 +126,26 @@ function compile(sourcefile, objectfile, incdepfile, flags) end -- compile it - local outdata = os.iorun(compcmd(sourcefile, objectfile, flags)) + local outdata = try + { + function () + return os.iorun(compcmd(sourcefile, objectfile, flags)) + end, + + catch + { + function (errors) + + -- filter includes notes + if errors then + errors = errors:gsub("Note: including file:%s*.-\r*\n", "") + end + os.raise(errors) + end + } + } + + -- parse include dependencies if incdepfile and outdata then -- translate it diff --git a/xmake/tools/gcc.lua b/xmake/tools/gcc.lua index 556e7ae40..02eb1abe5 100755 --- a/xmake/tools/gcc.lua +++ b/xmake/tools/gcc.lua @@ -158,7 +158,7 @@ function compile(sourcefile, objectfile, incdepfile, flags) local tmpfile = os.tmpfile() -- generate it - os.run(compcmd(sourcefile, tmpfile, (flags or "") .. " -MM")) + os.run("%s -c -MM %s -o %s %s", _g.shellname, flags or "", tmpfile, sourcefile) -- translate it local results = {} |
