diff options
| author | ruki <[email protected]> | 2017-07-27 23:10:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-07-27 23:10:52 +0800 |
| commit | ba4a55e6c9bc347f3a15dda56cef136d350e09df (patch) | |
| tree | 6133e1e8878fe5f81204ddf128deed2509cb0d98 | |
| parent | 6f2c9ecd0d7ea9f2fbfab79b6960eb1274ca816a (diff) | |
fix pch path
| -rw-r--r-- | xmake/languages/c++/api.lua | 2 | ||||
| -rw-r--r-- | xmake/languages/objc++/api.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 33 |
3 files changed, 3 insertions, 34 deletions
diff --git a/xmake/languages/c++/api.lua b/xmake/languages/c++/api.lua index 7d8e7739a..78f89ac6f 100644 --- a/xmake/languages/c++/api.lua +++ b/xmake/languages/c++/api.lua @@ -165,7 +165,6 @@ function apis() { -- target.set_xxx "target.set_config_h_prefix" -- deprecated - , "target.set_precompiled_header" -- target.add_xxx , "target.add_links" , "target.add_cflags" @@ -209,6 +208,7 @@ function apis() "target.set_headerdir" , "target.set_config_h" -- deprecated , "target.set_config_header" + , "target.set_precompiled_header" -- target.add_xxx , "target.add_headers" , "target.add_linkdirs" diff --git a/xmake/languages/objc++/api.lua b/xmake/languages/objc++/api.lua index 2d3cbfb03..63e311c33 100644 --- a/xmake/languages/objc++/api.lua +++ b/xmake/languages/objc++/api.lua @@ -30,7 +30,6 @@ function apis() { -- target.set_xxx "target.set_config_h_prefix" -- deprecated - , "target.set_precompiled_header" -- target.add_xxx , "target.add_links" , "target.add_mflags" @@ -72,6 +71,7 @@ function apis() "target.set_headerdir" , "target.set_config_h" -- deprecated , "target.set_config_header" + , "target.set_precompiled_header" -- target.add_xxx , "target.add_headers" , "target.add_linkdirs" diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 100c19ed7..7b249cd66 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -273,18 +273,11 @@ end -- get include deps function _include_deps(self, sourcefile, flags) - -- get it from the cache first - _g._INCDEPS = _g._INCDEPS or {} - local results = _g._INCDEPS[sourcefile] - if results then - return results - end - -- the temporary file local tmpfile = os.tmpfile() -- generate it - os.runv(self:program(), table.join("-c", "-MM", flags or {}, "-o", tmpfile, sourcefile)) + os.runv(self:program(), table.join("-c", "-E", "-MM", flags or {}, "-o", tmpfile, sourcefile)) -- translate it results = {} @@ -307,13 +300,6 @@ end -- make the complie arguments list for the precompiled header function _compargv1_pch(self, headerfile, objectfile, flags) - -- init cache key - local key = headerfile - - -- make a temporary source file - local sourcefile = os.tmpfile() .. language.extension_of(self:kind()) - io.writefile(sourcefile, format("#include \"%s\"", headerfile)) - -- remove "-include xxx.h" and "-include-pch xxx.pch" local pchflags = {} local include = false @@ -326,23 +312,6 @@ function _compargv1_pch(self, headerfile, objectfile, flags) end end - -- get the header file path and include deps - local incdeps = {} - for _, incdep in ipairs(_include_deps(self, sourcefile, pchflags)) do - if incdep:endswith(headerfile) then - headerfile = incdep - else - table.insert(incdeps, incdep) - end - end - - -- save this include deps to cache - _g._INCDEPS = _g._INCDEPS or {} - _g._INCDEPS[key] = incdeps - - -- remove files - os.tryrm(sourcefile) - -- make complie arguments list return self:program(), table.join("-c", pchflags, "-o", objectfile, headerfile) end |
