diff options
| author | ruki <[email protected]> | 2016-07-11 16:32:27 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-07-11 16:32:27 +0800 |
| commit | da29995e83aea1f0b95dbfe00f434012c994d731 (patch) | |
| tree | 824afdabd0debcab0248a0edb4b2c045ffd70725 | |
| parent | 1557fd3df7e620069925ccfafb5f196a0ff60253 (diff) | |
optimizate to check includes for windows
| -rwxr-xr-x | xmake/actions/build/kinds/object.lua | 16 | ||||
| -rwxr-xr-x | xmake/tools/cl.lua | 16 |
2 files changed, 21 insertions, 11 deletions
diff --git a/xmake/actions/build/kinds/object.lua b/xmake/actions/build/kinds/object.lua index e38a92b6c..f3ca7b0a4 100755 --- a/xmake/actions/build/kinds/object.lua +++ b/xmake/actions/build/kinds/object.lua @@ -91,10 +91,10 @@ function _build(target, g, index) end table.insert(depfiles, sourcefile) - -- get config header - local configheader = target:get("config_h") + -- the config header + local configheader = target:get("config_h") if configheader then - configheader = path.absolute(configheader) + configheader = path.translate(configheader) end -- check the dependent files are modified? @@ -110,26 +110,26 @@ function _build(target, g, index) end -- source and header files have been modified? - if os.mtime(depfile) > os.mtime(objectfile) then + if depfile_mtime > os.mtime(objectfile) then -- ignore the config header, because it always changed with build version. -- and other config content will not be changed when building each time(without reconfig or rebuild) -- - if path.absolute(depfile) ~= configheader then + if depfile ~= configheader then modified = true break end end end - -- trace - print("[%02d%%]: %s%s.$(mode) %s", percent, ifelse(config.get("ccache"), "ccache ", ""), ifelse(modified, "compiling", "passing"), sourcefile) - -- we need not rebuild it if the files are not modified if not modified then return end + -- trace + print("[%02d%%]: %scompiling.$(mode) %s", percent, ifelse(config.get("ccache"), "ccache ", ""), sourcefile) + -- trace verbose info if option.get("verbose") then print(compiler.compcmd(sourcefile, objectfile, target)) diff --git a/xmake/tools/cl.lua b/xmake/tools/cl.lua index dc1c3331b..675bf08a3 100755 --- a/xmake/tools/cl.lua +++ b/xmake/tools/cl.lua @@ -131,12 +131,22 @@ function compile(sourcefile, objectfile, incdepfile, flags) -- translate it local results = {} - for includefile in string.gmatch(outdata, "including file:%s*(.-%.hp*)") do - table.insert(results, includefile) + 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) + + -- 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) + end end -- update it - io.save(incdepfile, results) + io.save(incdepfile, table.unique(results)) end end |
