diff options
| author | ruki <[email protected]> | 2020-10-29 00:12:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-29 00:12:54 +0800 |
| commit | 83104b07b4511c5f592173cfd4a261a5d2373146 (patch) | |
| tree | 35e5a68f4c28721c976f98d3d4eb39b16cb3e344 /xmake/core/package/package.lua | |
| parent | 140d675280a6cb46c02ed48c925fb0f694f70f21 (diff) | |
add target os for cross-compilation
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() |
