diff options
| author | ruki <[email protected]> | 2021-02-10 23:25:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-02-10 23:25:17 +0800 |
| commit | c4632c178d2776e538459f5e49a93db88aa3f252 (patch) | |
| tree | c6073dd0d39024f2470c32513f470005185a201b | |
| parent | 21132a0efb088b4a5e9399282d6328ff6c5e0056 (diff) | |
rename package os to package targetos
| -rw-r--r-- | xmake/core/package/package.lua | 14 | ||||
| -rw-r--r-- | xmake/core/platform/platform.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/package/tools/autoconf.lua | 2 |
3 files changed, 9 insertions, 9 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 diff --git a/xmake/core/platform/platform.lua b/xmake/core/platform/platform.lua index c0bf5a8d9..a6aff0bf6 100644 --- a/xmake/core/platform/platform.lua +++ b/xmake/core/platform/platform.lua @@ -99,7 +99,7 @@ end -- get the platform os function _instance:os() - return self._INFO:get("os") or config.get("target_os") + return self._INFO:get("os") end -- get the platform menu diff --git a/xmake/modules/package/tools/autoconf.lua b/xmake/modules/package/tools/autoconf.lua index da1210329..3bfa23181 100644 --- a/xmake/modules/package/tools/autoconf.lua +++ b/xmake/modules/package/tools/autoconf.lua @@ -91,7 +91,7 @@ function _get_configs(package, configs) elseif package:is_arch("arm.*") then host = "arm" end - host = host .. "-" .. package:os() + host = host .. "-" .. package:targetos() table.insert(configs, "--host=" .. host) end end |
