Explorar o código

update manual

ruki %!s(int64=7) %!d(string=hai) anos
pai
achega
da46cbb9f0
Modificáronse 2 ficheiros con 28 adicións e 2 borrados
  1. 13 0
      manual.md
  2. 15 2
      zh/manual.md

+ 13 - 0
manual.md

@@ -39,6 +39,7 @@ Conditions are generally used to handle some special compilation platforms.
 | [is_option](#is_option)   | Is the given options enabled?             | >= 2.0.1 < 2.2.2 deprecated |
 | [is_config](#is_config)   | Is the given config values?               | >= 2.2.2                    |
 | [has_config](#has_config) | Is the given configs enabled?             | >= 2.2.2                    |
+| [get_config](#get_config) | Get the configuration value               | >= 2.2.2                    |
 
 ##### is_os 
 
@@ -314,6 +315,18 @@ This interface can determine not only the built-in global and local configs,
 but also the custom options defined through the [option](#option).
 </p>
 
+##### get_config
+
+###### Get the configuration value 
+
+This interface is introduced from version 2.2.2 to get the configuration value from the given name.
+
+```lua
+if get_config("myconfig") == "xxx" then
+    add_defines("HELLO")
+end
+```
+
 #### Global Interfaces
 
 The global interface affects the whole project description scope and all sub-project files.

+ 15 - 2
zh/manual.md

@@ -39,6 +39,7 @@ search: zh
 | [is_option](#is_option)   | 判断选项是否启用              | >= 2.0.1 < 2.2.2 已废弃 |
 | [is_config](#is_config)   | 判断指定配置是否为给定的值    | >= 2.2.2                |
 | [has_config](#has_config) | 判断配置是否启用或者存在      | >= 2.2.2                |
+| [get_config](#get_config) | 获取给的配置值                | >= 2.2.2                |
 
 ##### is_os 
 
@@ -262,7 +263,7 @@ end
 
 ###### 判断指定配置是否为给定的值
 
-此接口从2.2.2版本开始引入,用于判断指定配置是否为给定的值。
+此接口从2.2.2版本开始引入,用于判断指定配置是否为给定的值,可用于描述域
 
 例如:
 
@@ -300,7 +301,7 @@ end
 
 ###### 判断配置是否启用或者存在
 
-此接口从2.2.2版本开始引入,用于检测自定义或者内置的编译配置是否存在或启用。
+此接口从2.2.2版本开始引入,用于检测自定义或者内置的编译配置是否存在或启用,可用于描述域
 
 例如以下配置情况,都会返回true:
 
@@ -334,6 +335,18 @@ $ xmake f --test1=false
 此接口不仅能够判断内置的全局配置、本地配置,同时还可以判断通过[option](#option)定义的自定义配置选项。
 </p>
 
+##### get_config
+
+###### 获取给定的配置值
+
+此接口从2.2.2版本开始引入,用于快速获取给定的配置值,可用于描述域。
+
+```lua
+if get_config("myconfig") == "xxx" then
+    add_defines("HELLO")
+end
+```
+
 #### 全局接口
 
 全局接口影响整个工程描述,被调用后,后面被包含进来的所有子`xmake.lua`都会受影响。