summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-13 00:40:25 +0800
committerruki <[email protected]>2021-03-13 00:40:25 +0800
commit498b8dd1ef03447b90fac0d10abcf3c8ca4ab611 (patch)
tree19b75f1b25107be235d9cfe3035d7de1c4be356a
parent364eec542b0b115f5631eb462de02af399ad0041 (diff)
improve package and fix trybuild
-rw-r--r--xmake/actions/config/main.lua6
-rw-r--r--xmake/core/package/package.lua13
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?