diff options
| author | ruki <[email protected]> | 2016-07-11 20:47:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-11 20:47:43 +0800 |
| commit | 4edc7a64043a5c5c2116260e00837b3f0e746c17 (patch) | |
| tree | f1c1eeebd2c2e32cd6bfc705ff3c1abec0714294 /xmake/tools/cl.lua | |
| parent | 269f06dee29dd8abb0f09a9aa8be5386445ae812 (diff) | |
optimizate to generate includes
Diffstat (limited to 'xmake/tools/cl.lua')
| -rwxr-xr-x | xmake/tools/cl.lua | 14 |
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 |
