summaryrefslogtreecommitdiff
path: root/xmake/modules/core/tools/gcc.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-07-27 23:10:52 +0800
committerruki <[email protected]>2017-07-27 23:10:52 +0800
commitba4a55e6c9bc347f3a15dda56cef136d350e09df (patch)
tree6133e1e8878fe5f81204ddf128deed2509cb0d98 /xmake/modules/core/tools/gcc.lua
parent6f2c9ecd0d7ea9f2fbfab79b6960eb1274ca816a (diff)
fix pch path
Diffstat (limited to 'xmake/modules/core/tools/gcc.lua')
-rw-r--r--xmake/modules/core/tools/gcc.lua33
1 files changed, 1 insertions, 32 deletions
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