diff options
| author | ruki <[email protected]> | 2023-04-30 21:56:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-04-30 21:56:24 +0800 |
| commit | d04dc34167154efd95f858a9ece38d04b9a2eddd (patch) | |
| tree | ae29a7c54594f7722159d9915e7de20ef92cc046 | |
| parent | 6adbd265b0312826a9915f68d38175ad5f62b8b2 (diff) | |
fix compiler and linker cache
| -rw-r--r-- | xmake/core/tool/compiler.lua | 6 | ||||
| -rw-r--r-- | xmake/core/tool/linker.lua | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua index 8dc7bffd9..c11b2ba1d 100644 --- a/xmake/core/tool/compiler.lua +++ b/xmake/core/tool/compiler.lua @@ -121,7 +121,11 @@ function compiler.load(sourcekind, target) end -- init cache key - local cachekey = sourcekind .. (program_or_errors or "") .. (config.get("arch") or os.arch()) + -- @note we need plat/arch, + -- because it is possible for the compiler to do cross-compilation with the -target parameter + 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 -- get it directly from cache dirst compiler._INSTANCES = compiler._INSTANCES or {} diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index 88b6da6a9..aa7b1bb8c 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -133,7 +133,9 @@ function linker.load(targetkind, sourcekinds, target) local linkerinfo = linkerinfo_or_errors -- init cache key - local cachekey = targetkind .. "_" .. linkerinfo.linkerkind .. (linkerinfo.program or "") .. (config.get("arch") or os.arch()) + local plat = linkertool:plat() or config.plat() or os.host() + local arch = linkertool:arch() or config.arch() or os.arch() + local cachekey = targetkind .. "_" .. linkerinfo.linkerkind .. (linkerinfo.program or "") .. plat .. arch -- get it directly from cache dirst builder._INSTANCES = builder._INSTANCES or {} |
