summaryrefslogtreecommitdiff
path: root/xmake/tools/cl.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/tools/cl.lua')
-rwxr-xr-xxmake/tools/cl.lua22
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