summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-06-20 23:17:10 +0800
committerruki <[email protected]>2022-06-20 23:17:10 +0800
commitcf2f731372623014772378fa95126e8b04806463 (patch)
tree8800f3edae583701494581bba99013b5599dd31c
parent01eeb3325c51d18f79b61303fb4d17af011b7dd0 (diff)
improve cachekey
-rw-r--r--xmake/modules/core/tools/gcc.lua3
-rw-r--r--xmake/modules/private/cache/build_cache.lua3
2 files changed, 2 insertions, 4 deletions
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index 93674a702..eb1f396dc 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -528,8 +528,7 @@ function _preprocess(program, argv, opt)
local cppinfo = try {function ()
local outdata, errdata = os.iorunv(program, cppflags, opt)
return {outdata = outdata, errdata = errdata,
- sourcefile = sourcefile, objectfile = objectfile, cppfile = cppfile, cppflags = flags,
- directives_only = directives_only}
+ sourcefile = sourcefile, objectfile = objectfile, cppfile = cppfile, cppflags = flags}
end}
if not cppinfo then
if is_gcc then
diff --git a/xmake/modules/private/cache/build_cache.lua b/xmake/modules/private/cache/build_cache.lua
index 882f50f9a..0d5dd02d4 100644
--- a/xmake/modules/private/cache/build_cache.lua
+++ b/xmake/modules/private/cache/build_cache.lua
@@ -68,10 +68,9 @@ end
function cachekey(program, cppinfo, envs)
local cppfile = cppinfo.cppfile
local cppflags = cppinfo.cppflags
- local directives_only = cppinfo.directives_only
local items = {program}
for _, cppflag in ipairs(cppflags) do
- if not directives_only and (cppflag:startswith("-D") or cppflag:startswith("/D")) then
+ if cppflag:startswith("-D") or cppflag:startswith("/D") then
-- ignore `-Dxx` to improve the cache hit rate, as some source files may not use the defined macros.
-- @see https://github.com/xmake-io/xmake/issues/2425
else