diff options
| author | ruki <[email protected]> | 2017-04-26 14:41:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-04-26 14:41:59 +0800 |
| commit | 6346af0f672353eedc5c3a6efe4ed3d5a0a52e5a (patch) | |
| tree | c533a03262179392ee8d10f9ec83964812a55d71 /docs | |
| parent | 38a85e0cfac525962e347174fb16080fc447664c (diff) | |
fix os.host and add is_host
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/manual.md | 43 | ||||
| -rwxr-xr-x | docs/zh/manual.md | 30 |
2 files changed, 62 insertions, 11 deletions
diff --git a/docs/manual.md b/docs/manual.md index 803eb0283..aed9bdfef 100644 --- a/docs/manual.md +++ b/docs/manual.md @@ -28,18 +28,19 @@ It's according to the following rules: Conditions are generally used to handle some special compilation platforms. -| 接口 | 描述 | 支持版本 | -| ------------------------- | ---------------------------------------- | -------- | -| [is_os](#is_os) | Is the current compilation system? | >= 2.0.1 | -| [is_arch](#is_arch) | Is the current compilation architecture? | >= 2.0.1 | -| [is_plat](#is_plat) | Is the current compilation platform? | >= 2.0.1 | -| [is_mode](#is_mode) | Is the current compilation mode? | >= 2.0.1 | -| [is_kind](#is_kind) | Is the current target kind? | >= 2.0.1 | -| [is_option](#is_option) | Is the given options enabled? | >= 2.0.1 | +| 接口 | 描述 | 支持版本 | +| ------------------------- | ---------------------------------------- | -------- | +| [is_os](#is_os) | Is the current compilation target system? | >= 2.0.1 | +| [is_arch](#is_arch) | Is the current compilation architecture? | >= 2.0.1 | +| [is_plat](#is_plat) | Is the current compilation platform? | >= 2.0.1 | +| [is_host](#is_host) | Is the current compilation host system? | >= 2.1.4 | +| [is_mode](#is_mode) | Is the current compilation mode? | >= 2.0.1 | +| [is_kind](#is_kind) | Is the current target kind? | >= 2.0.1 | +| [is_option](#is_option) | Is the given options enabled? | >= 2.0.1 | ##### is_os -###### Is the current compilation system +###### Is the current compilation target system ```lua if is_os("ios") then @@ -110,6 +111,30 @@ Support platforms: * iphoneos * watchos +##### is_host + +###### Is the current compilation host system + +Some compilation platforms can be built on multiple different operating systems, for example: android ndk (on linux, macOS and windows). + +So, we can use this api to determine the current host operating system. + +```lua +if is_host("windows") then + add_includes("C:\\includes") +else + add_includes("/usr/includess") +end +``` + +Support hosts: + +* windows +* linux +* macosx + +We can also get it from [$(host)](#var-host) or [os.host](#os-host). + ##### is_mode ###### Is the current compilation mode diff --git a/docs/zh/manual.md b/docs/zh/manual.md index d7a4d9b7d..63c6f7f0d 100755 --- a/docs/zh/manual.md +++ b/docs/zh/manual.md @@ -30,16 +30,17 @@ search: zh | 接口 | 描述 | 支持版本 | | ------------------------- | ----------------------------- | -------- | -| [is_os](#is_os) | 判断当前构建的操作系统 | >= 2.0.1 | +| [is_os](#is_os) | 判断当前构建目标的操作系统 | >= 2.0.1 | | [is_arch](#is_arch) | 判断当前编译架构 | >= 2.0.1 | | [is_plat](#is_plat) | 判断当前编译平台 | >= 2.0.1 | +| [is_host](#is_host) | 判断当前主机环境操作系统 | >= 2.1.4 | | [is_mode](#is_mode) | 判断当前编译模式 | >= 2.0.1 | | [is_kind](#is_kind) | 判断当前编译类型 | >= 2.0.1 | | [is_option](#is_option) | 判断选项是否启用 | >= 2.0.1 | ##### is_os -###### 判断当前构建的操作系统 +###### 判断当前构建目标的操作系统 ```lua -- 如果当前操作系统是ios @@ -115,6 +116,31 @@ end 当然你也可以自己扩展添加自己的平台。。。 +##### is_host + +###### 判断当前主机环境的操作系统 + +有些编译平台是可以在多个不同的操作系统进行构建的,例如:android的ndk就支持linux,macOS还有windows环境。 + +这个时候就可以通过这个接口,区分当前是在哪个系统环境下进行的构建。 + +```lua +-- 如果当前主机环境是windows +if is_host("windows") then + add_includes("C:\\includes") +else + add_includes("/usr/includess") +end +``` + +目前支持的主机环境有: + +* windows +* linux +* macosx + +你也可以通过[$(host)](#var-host)内置变量或者[os.host](#os-host)接口,来进行获取 + ##### is_mode ###### 判断当前编译模式 |
