summaryrefslogtreecommitdiff
path: root/xmake/tools/cl.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-07-11 20:47:43 +0800
committerruki <[email protected]>2016-07-11 20:47:43 +0800
commit4edc7a64043a5c5c2116260e00837b3f0e746c17 (patch)
treef1c1eeebd2c2e32cd6bfc705ff3c1abec0714294 /xmake/tools/cl.lua
parent269f06dee29dd8abb0f09a9aa8be5386445ae812 (diff)
optimizate to generate includes
Diffstat (limited to 'xmake/tools/cl.lua')
-rwxr-xr-xxmake/tools/cl.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua
index 675bf08a3..660c47ed8 100755
--- a/xmake/tools/cl.lua
+++ b/xmake/tools/cl.lua
@@ -131,22 +131,28 @@ function compile(sourcefile, objectfile, incdepfile, flags)
-- translate it
local results = {}
+ local uniques = {}
for includefile in string.gmatch(outdata, "including file:%s*(.-)\r*\n") do
- -- check
- assert(os.isfile(includefile), "invalid include file: %s for %s", includefile, incdepfile)
+ -- slower, only for debuging
+-- assert(os.isfile(includefile), "invalid include file: %s for %s", includefile, incdepfile)
-- get the relative
includefile = path.relative(includefile, project.directory())
-- save it if belong to the project
if not path.is_absolute(includefile) then
- table.insert(results, includefile)
+
+ -- insert it and filter repeat
+ if not uniques[includefile] then
+ table.insert(results, includefile)
+ uniques[includefile] = true
+ end
end
end
-- update it
- io.save(incdepfile, table.unique(results))
+ io.save(incdepfile, results)
end
end