diff options
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 398c89285..459b1e573 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -113,6 +113,15 @@ function _instance:arch() return config.get("arch") or os.arch() end +-- get the target os +function _instance:os() + local requireinfo = self:requireinfo() + if requireinfo and requireinfo.os then + return requireinfo.os + end + return platform.os() +end + -- get the build mode function _instance:mode() return self:debug() and "debug" or "release" @@ -143,6 +152,16 @@ function _instance:is_arch(...) end end +-- the current platform is belong to the given target os? +function _instance:is_os(...) + local os = self:os() + for _, v in ipairs(table.join(...)) do + if v and os == v then + return true + end + end +end + -- get the package alias function _instance:alias() local requireinfo = self:requireinfo() |
