diff options
| -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 {} |
