summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-02-10 23:25:17 +0800
committerruki <[email protected]>2021-02-10 23:25:17 +0800
commitc4632c178d2776e538459f5e49a93db88aa3f252 (patch)
treec6073dd0d39024f2470c32513f470005185a201b /xmake/core/package/package.lua
parent21132a0efb088b4a5e9399282d6328ff6c5e0056 (diff)
rename package os to package targetos
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 128839c0d..583ea3d0f 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -128,12 +128,12 @@ function _instance:arch()
end
-- get the target os
-function _instance:os()
+function _instance:targetos()
local requireinfo = self:requireinfo()
- if requireinfo and requireinfo.os then
- return requireinfo.os
+ if requireinfo and requireinfo.targetos then
+ return requireinfo.targetos
end
- return platform.os()
+ return config.get("target_os") or platform.os()
end
-- get the build mode
@@ -167,8 +167,8 @@ function _instance:is_arch(...)
end
-- the current platform is belong to the given target os?
-function _instance:is_os(...)
- local os = self:os()
+function _instance:is_targetos(...)
+ local os = self:targetos()
for _, v in ipairs(table.join(...)) do
if v and os == v then
return true
@@ -1417,7 +1417,7 @@ end
function package._target_arch()
local arch = package._ARCH
if arch == nil then
- if not arch then
+ if not arch and os.isfile(os.projectfile()) then
local project = require("project/project")
local target_root_arch = project.get("target.arch")
if target_root_arch then