From 96e0ba81e20fa68d973ac84c01ead139118c072a Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 11 Aug 2018 00:46:01 +0800 Subject: modify title orders --- manual.md | 72 ++++++++++++++++++++++++++++---------------------------- zh/manual.md | 76 ++++++++++++++++++++++++++++++------------------------------ 2 files changed, 74 insertions(+), 74 deletions(-) diff --git a/manual.md b/manual.md index 17cda852..cb0f9e5c 100644 --- a/manual.md +++ b/manual.md @@ -240,6 +240,42 @@ if is_option("demo") then end ``` +##### is_config + +###### Is the given config values? + +This interface is introduced from version 2.2.2 to determine whether the specified configuration is a given value. + +For example: + +```console +$ xmake f --test=hello1 +``` + +```lua +option("test") + set_showmenu("true") + set_description("The test config option") +option_end() + +if is_config("test", "hello1", "hello2") then + add_defines("HELLO") +end +``` + +Not only that, we can also set pattern matching rules to determine values, such as: + +```lua +if is_config("test", "hello.*") then + add_defines("HELLO") +end +``` + +

+This interface is not only able to determine the custom options defined through the [option](#option), +but also to determine the built-in global and local configuration. +

+ ##### has_config ###### Is the given configs enabled? @@ -278,42 +314,6 @@ This interface can determine not only the built-in global and local configs, but also the custom options defined through the [option](#option).

-##### is_config - -###### Is the given config values? - -This interface is introduced from version 2.2.2 to determine whether the specified configuration is a given value. - -For example: - -```console -$ xmake f --test=hello1 -``` - -```lua -option("test") - set_showmenu("true") - set_description("The test config option") -option_end() - -if is_config("test", "hello1", "hello2") then - add_defines("HELLO") -end -``` - -Not only that, we can also set pattern matching rules to determine values, such as: - -```lua -if is_config("test", "hello.*") then - add_defines("HELLO") -end -``` - -

-This interface is not only able to determine the custom options defined through the [option](#option), -but also to determine the built-in global and local configuration. -

- #### Global Interfaces The global interface affects the whole project description scope and all sub-project files. diff --git a/zh/manual.md b/zh/manual.md index ba5ab285..3236b4f3 100644 --- a/zh/manual.md +++ b/zh/manual.md @@ -258,44 +258,6 @@ if is_option("demo") then end ``` -##### has_config - -###### 判断配置是否启用或者存在 - -此接口从2.2.2版本开始引入,用于检测自定义或者内置的编译配置是否存在或启用。 - -例如以下配置情况,都会返回true: - -```console -# 启用某个配置选项(如果是boolean类型配置) -$ xmake f --test1=y -$ xmake f --test1=yes -$ xmake f --test1=true - -# 设置某个配置选项的值 -$ xmake f --test2=value -``` - -```lua --- 如果test1或者test2被设置或者启用 -if has_config("test1", "test2") then - add_defines("TEST") -end -``` - -而下面的情况则会禁用配置,返回false: - -```console -# 禁用配置(如果是boolean类型配置) -$ xmake f --test1=n -$ xmake f --test1=no -$ xmake f --test1=false -``` - -

-此接口不仅能够判断内置的全局配置、本地配置,同时还可以判断通过[option](#option)定义的自定义配置选项。 -

- ##### is_config ###### 判断指定配置是否为给定的值 @@ -334,6 +296,44 @@ end 此接口不仅能够判断通过[option](#option)定义的自定义配置选项,同时还能判断内置的全局配置、本地配置。

+##### has_config + +###### 判断配置是否启用或者存在 + +此接口从2.2.2版本开始引入,用于检测自定义或者内置的编译配置是否存在或启用。 + +例如以下配置情况,都会返回true: + +```console +# 启用某个配置选项(如果是boolean类型配置) +$ xmake f --test1=y +$ xmake f --test1=yes +$ xmake f --test1=true + +# 设置某个配置选项的值 +$ xmake f --test2=value +``` + +```lua +-- 如果test1或者test2被设置或者启用 +if has_config("test1", "test2") then + add_defines("TEST") +end +``` + +而下面的情况则会禁用配置,返回false: + +```console +# 禁用配置(如果是boolean类型配置) +$ xmake f --test1=n +$ xmake f --test1=no +$ xmake f --test1=false +``` + +

+此接口不仅能够判断内置的全局配置、本地配置,同时还可以判断通过[option](#option)定义的自定义配置选项。 +

+ #### 全局接口 全局接口影响整个工程描述,被调用后,后面被包含进来的所有子`xmake.lua`都会受影响。 -- cgit v1.2.3