diff options
| author | ruki <[email protected]> | 2018-04-14 00:54:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-04-13 23:27:52 +0800 |
| commit | 7467328ac81ac59a95125420b4dbca1bc3abc5f3 (patch) | |
| tree | 3f5bdaa14fdb149f27489be4493e7a0d35fdf8a1 /xmake/core/project/project.lua | |
| parent | 9e80cf8b5075b5eb4af1a2a0b652b486ddfe2da9 (diff) | |
add is_mode is_plat and is_arch builtin apis
Diffstat (limited to 'xmake/core/project/project.lua')
| -rw-r--r-- | xmake/core/project/project.lua | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 9c8020c38..f54198132 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -65,47 +65,17 @@ end -- the current mode is belong to the given modes? function project._api_is_mode(interp, ...) - - -- get the current mode - local mode = config.get("mode") - if not mode then return false end - - -- exists this mode? - for _, m in ipairs(table.join(...)) do - if m and type(m) == "string" and m == mode then - return true - end - end + return config.is_mode(...) end -- the current platform is belong to the given platforms? function project._api_is_plat(interp, ...) - - -- get the current platform - local plat = config.get("plat") - if not plat then return false end - - -- exists this platform? and escape '-' - for _, p in ipairs(table.join(...)) do - if p and type(p) == "string" and plat:find("^" .. p:gsub("%-", "%%-") .. "$") then - return true - end - end + return config.is_plat(...) end -- the current platform is belong to the given architectures? function project._api_is_arch(interp, ...) - - -- get the current architecture - local arch = config.get("arch") - if not arch then return false end - - -- exists this architecture? and escape '-' - for _, a in ipairs(table.join(...)) do - if a and type(a) == "string" and arch:find("^" .. a:gsub("%-", "%%-") .. "$") then - return true - end - end + return config.is_arch(...) end -- the current kind is belong to the given kinds? @@ -125,17 +95,7 @@ end -- the current host is belong to the given hosts? function project._api_is_host(interp, ...) - - -- get the current host - local host = os.host() - if not host then return false end - - -- exists this host? and escape '-' - for _, h in ipairs(table.join(...)) do - if h and type(h) == "string" and host:find(h:gsub("%-", "%%-")) then - return true - end - end + return os.is_host(...) end -- enable options? |
