diff options
| author | ruki <[email protected]> | 2016-07-10 16:07:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-10 16:07:52 +0800 |
| commit | e281ea26c19103dcbc7f951a8592eeb6a1ff63a3 (patch) | |
| tree | b2ef3ea44478ad5d7ec5cf3f1a11e65213fd379b /xmake/tools/cl.lua | |
| parent | fd39adb3d959e605370098a72ec7e92b462fce62 (diff) | |
parse includes from cl.exe
Diffstat (limited to 'xmake/tools/cl.lua')
| -rwxr-xr-x | xmake/tools/cl.lua | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua index 30d30a6f3..faba74124 100755 --- a/xmake/tools/cl.lua +++ b/xmake/tools/cl.lua @@ -112,16 +112,28 @@ function compcmd(sourcefile, objectfile, flags) end -- complie the source file -function compile(sourcefile, objectfile, incdepfile, flags, multitasking) +function compile(sourcefile, objectfile, incdepfile, flags) -- ensure the object directory os.mkdir(path.directory(objectfile)) + -- generate includes file + if incdepfile then + flags = (flags or "") .. " -showIncludes" + end + -- compile it - if multitasking then - os.corun(compcmd(sourcefile, objectfile, flags)) - else - os.run(compcmd(sourcefile, objectfile, flags)) + local outdata = os.iorun(compcmd(sourcefile, objectfile, flags)) + if incdepfile and outdata then + + -- translate it + local results = {} + for includefile in string.gmatch(outdata, "including file:%s*(.-%.[h|hpp])") do + table.insert(results, includefile) + end + + -- update it + io.save(incdepfile, results) end end |
