summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-02-26 00:51:01 +0800
committerruki <[email protected]>2022-02-26 00:51:01 +0800
commit8432a23fd3d50e4b59c2e89f2a1b780a9942f8b5 (patch)
tree96dc86ac4d702a6158525ff1e6155585a662f3c1
parent9d77af7a00a833e0d42c0815877c6dc0ad5c4498 (diff)
add toolchains to buildhash for cross
-rw-r--r--xmake/core/package/package.lua19
1 files changed, 17 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 7226dedba..24fe66ea2 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -1111,6 +1111,12 @@ function _instance:buildhash()
str = str .. "_" .. table.concat(hashs, "_")
end
end
+ local toolchains = self:config("toolchains")
+ if opt.toolchains ~= false and toolchains then
+ toolchains = table.copy(table.wrap(toolchains))
+ table.sort(toolchains)
+ str = str .. "_" .. table.concat(toolchains, "_")
+ end
return hash.uuid4(str):gsub('-', ''):lower()
end
local function _get_installdir(...)
@@ -1127,7 +1133,7 @@ function _instance:buildhash()
if self:config("pic") then
local configs = table.copy(self:configs())
configs.pic = nil
- buildhash = _get_buildhash(configs, {sourcehash = false})
+ buildhash = _get_buildhash(configs, {sourcehash = false, toolchains = false})
if not os.isdir(_get_installdir(buildhash)) then
buildhash = nil
end
@@ -1136,7 +1142,16 @@ function _instance:buildhash()
-- we need to be compatible with the hash value string for the previous xmake version
-- without sourcehash (< 2.5.2)
if not buildhash then
- buildhash = _get_buildhash(self:configs(), {sourcehash = false})
+ buildhash = _get_buildhash(self:configs(), {sourcehash = false, toolchains = false})
+ if not os.isdir(_get_installdir(buildhash)) then
+ buildhash = nil
+ end
+ end
+
+ -- we need to be compatible with the previous xmake version
+ -- without toolchains (< 2.6.4)
+ if not buildhash then
+ buildhash = _get_buildhash(self:configs(), {toolchains = false})
if not os.isdir(_get_installdir(buildhash)) then
buildhash = nil
end