From 498b8dd1ef03447b90fac0d10abcf3c8ca4ab611 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 13 Mar 2021 00:40:25 +0800 Subject: improve package and fix trybuild --- xmake/actions/config/main.lua | 6 +++--- xmake/core/package/package.lua | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 4a8cfc2ed..d17b93c15 100644 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -344,10 +344,10 @@ force to build in current directory via run `xmake -P .`]], os.projectdir()) if recheck then _check_target_toolchains() end - end - -- config targets - _config_targets(targetname) + -- config targets + _config_targets(targetname) + end -- dump config if option.get("verbose") and not opt.disable_dump then diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index e83232554..30949661b 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -380,6 +380,16 @@ function _instance:debug() return self:is_debug() end +-- is cross-compilation? +function _instance:is_cross() + if not self:is_plat(os.host()) and not self:is_plat(os.subhost()) then + return true + end + if not self:is_arch(os.arch()) and not self:is_arch(os.subarch()) then + return true + end +end + -- get the filelock of the whole package directory function _instance:filelock() local filelock = self._FILELOCK @@ -1138,6 +1148,9 @@ function _instance:fetch(opt) -- we need ignore `{system = true/false}` argument if be 3rd package -- @see https://github.com/xmake-io/xmake/issues/726 system = nil + elseif self:is_cross() then + -- we need disable system package for cross-compilation + system = false end -- use sysincludedirs/-isystem instead of -I? -- cgit v1.3.1