summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-05-12 13:11:59 +0800
committerruki <[email protected]>2019-05-12 13:11:59 +0800
commitd53e0952713f01933d04eb729a9ddfef0783052c (patch)
tree0aca8670d7849001e0e306bd9f9fdefefe84722f
parent80ec33c28e6f8d0f38b41f5030df9249953e300a (diff)
add plat and arch args for add_deps
-rw-r--r--xmake/actions/require/impl/package.lua2
-rw-r--r--xmake/core/package/package.lua24
2 files changed, 26 insertions, 0 deletions
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua
index 39889efcc..e8e5850b6 100644
--- a/xmake/actions/require/impl/package.lua
+++ b/xmake/actions/require/impl/package.lua
@@ -126,6 +126,8 @@ function _parse_require(require_str, requires_extra, parentinfo)
originstr = require_str,
reponame = reponame,
version = version,
+ plat = require_extra.plat, -- require package in the given platform
+ arch = require_extra.arch, -- require package in the given architecture
alias = require_extra.alias, -- set package alias name
group = require_extra.group, -- only uses the first package in same group
system = require_extra.system, -- default: true, we can set it to disable system package manually
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 78b012a71..b9147b7c5 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -92,6 +92,10 @@ function _instance:plat()
if self:kind() == "binary" then
return os.host()
end
+ local requireinfo = self:requireinfo()
+ if requireinfo and requireinfo.plat then
+ return requireinfo.plat
+ end
return config.get("plat") or os.host()
end
@@ -101,6 +105,10 @@ function _instance:arch()
if self:kind() == "binary" then
return os.arch()
end
+ local requireinfo = self:requireinfo()
+ if requireinfo and requireinfo.arch then
+ return requireinfo.arch
+ end
return config.get("arch") or os.arch()
end
@@ -890,6 +898,10 @@ end
-- @return true or false
--
function _instance:has_cfuncs(funcs, opt)
+ if self:plat() ~= config.get("plat") then
+ -- TODO
+ return true
+ end
opt = opt or {}
opt.configs = table.join(self:fetchdeps(), opt.configs)
return sandbox_module.import("lib.detect.has_cfuncs", {anonymous = true})(funcs, opt)
@@ -903,6 +915,10 @@ end
-- @return true or false
--
function _instance:has_cxxfuncs(funcs, opt)
+ if self:plat() ~= config.get("plat") then
+ -- TODO
+ return true
+ end
opt = opt or {}
opt.configs = table.join(self:fetchdeps(), opt.configs)
return sandbox_module.import("lib.detect.has_cxxfuncs", {anonymous = true})(funcs, opt)
@@ -916,6 +932,10 @@ end
-- @return true or false
--
function _instance:check_csnippets(snippets, opt)
+ if self:plat() ~= config.get("plat") then
+ -- TODO
+ return true
+ end
opt = opt or {}
opt.configs = table.join(self:fetchdeps(), opt.configs)
return sandbox_module.import("lib.detect.check_csnippets", {anonymous = true})(snippets, opt)
@@ -929,6 +949,10 @@ end
-- @return true or false
--
function _instance:check_cxxsnippets(snippets, opt)
+ if self:plat() ~= config.get("plat") then
+ -- TODO
+ return true
+ end
opt = opt or {}
opt.configs = table.join(self:fetchdeps(), opt.configs)
return sandbox_module.import("lib.detect.check_cxxsnippets", {anonymous = true})(snippets, opt)