summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-08-09 23:32:27 +0800
committerruki <[email protected]>2025-08-09 23:32:40 +0800
commit9dda4775ad3113086a42e611e590b215e35e0404 (patch)
treec2de9137a65097e63455159f68e754625d3e35f5
parent248afd9bd01f8135e813616f6ce81467decd9dc1 (diff)
fix compiler cache #6672
-rw-r--r--xmake/core/tool/compiler.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index b3a84e2a5..2d305dcf9 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -136,6 +136,9 @@ function compiler.load(sourcekind, target)
local plat = compiler_tool:plat() or config.plat() or os.host()
local arch = compiler_tool:arch() or config.arch() or os.arch()
local cachekey = sourcekind .. (program_or_errors or "") .. plat .. arch
+ if target then
+ cachekey = cachekey .. tostring(target)
+ end
-- get it directly from cache dirst
compiler._INSTANCES = compiler._INSTANCES or {}
@@ -322,14 +325,10 @@ end
-- @return flags list
--
function compiler:compflags(opt)
-
- -- init options
opt = opt or {}
-- get target
- local target = opt.target
-
- -- get target kind
+ local target = opt.target or self:target()
local targetkind = opt.targetkind
if not targetkind and target and target:type() == "target" then
targetkind = target:kind()