diff options
| -rw-r--r-- | manual/configuration_option.md | 74 | ||||
| -rw-r--r-- | manual/project_target.md | 4 | ||||
| -rw-r--r-- | zh-cn/manual/configuration_option.md | 127 |
3 files changed, 2 insertions, 203 deletions
diff --git a/manual/configuration_option.md b/manual/configuration_option.md index 96d60585..0141435a 100644 --- a/manual/configuration_option.md +++ b/manual/configuration_option.md @@ -79,15 +79,6 @@ The `option` field can be repeatedly entered to implement separate settings. If | [add_frameworks](#targetadd_frameworks) | Add Linked Framework | >= 2.1.1 | | [add_frameworkdirs](#targetadd_frameworkdirs) | Add Linked Framework | >= 2.1.5 | -| Obsolete Interface | Description | Supported Version | -| ----------------------------------------------------- | -------------------------------------------- | ---------------- | -| [add_bindings](#optionadd_bindings) | Add Forward Association Options, Sync Enable and Disable | >= 2.0.1 < 2.1.5 | -| [add_rbindings](#optionadd_rbindings) | Add reverse association option, sync enable and disable | >= 2.0.1 < 2.1.5 | -| [add_defines_if_ok](#optionadd_defines_if_ok) | Add macro definitions if the detection option passes | >= 1.0.1 < 2.1.5 | -| [add_defines_h_if_ok](#optionadd_defines_h_if_ok) | Add macro definitions to the configuration header if the detection option passes | >= 1.0.1 < 2.1.5 | -| [add_undefines_if_ok](#optionadd_undefines_if_ok) | Cancel macro definition if detection option passes | >= 1.0.1 < 2.1.5 | -| [add_undefines_h_if_ok](#optionadd_undefines_h_if_ok) | If the detection option passes, cancel the macro definition in the configuration header file | >= 1.0.1 < 2.1.5 | - ### option #### Defining options @@ -587,69 +578,4 @@ For the detection of compiler features, there is a more convenient and efficient If you want more flexible detection, you can do this in [option.on_check](#optionon_check) via [lib.detect.check_cxsnippets](#detect-check_cxsnippets). -### option:add_defines_if_ok - -#### Add macro definition if the detection option is passed - -<p class="tip"> -After the 2.1.5 version has been deprecated, please use the [add_defines](#targetadd_defines) interface instead. -</p> - -The detection options will not be set until they are passed. See the example in [add_cincludes](#optionadd_cincludes) for details. - -### option:add_defines_h_if_ok - -#### If the detection option is passed, add the macro definition to the configuration header file. - -<p class="tip"> -After the 2.1.5 version has been deprecated, please use the [add_defines_h](#targetadd_defines_h) interface instead. -</p> - -Similar to [add_defines_if_ok](#optionadd_defines_if_ok), the macro definitions are automatically added to the `config.h` header file after the test is passed. - -E.g: - -```lua -option("pthread") - set_default(false) - add_cincludes("pthread.h") - add_defines_h_if_ok("ENABLE_PTHREAD") - -target("test") - add_options("pthread") -``` - -After passing, it will be added to `config.h`: - -```c -#define ENABLE_PTHREAD 1 -``` - -How to set the specific `config.h`, see: [set_config_h](#targetset_config_h) - -### option:add_undefines_if_ok - -#### If the detection option is passed, cancel the macro definition - -<p class="tip"> -After the 2.1.5 version has been deprecated, please use the [add_undefines](#targetadd_undefines) interface instead. -</p> - -Similar to [add_defines_if_ok](#optionadd_defines_if_ok), except that the macro definition is canceled after the pass is detected. - -### option:add_undefines_h_if_ok - -#### If the detection option is passed, the macro definition is canceled in the configuration header file. - -<p class="tip"> -Deprecated after version 2.1.5, please use [add_undefines_h](#targetadd_undefines_h) interface instead. -</p> - -Similar to [add_defines_h_if_ok](#optionadd_defines_h_if_ok), the macro definition will be canceled in `config.h` after the test is passed. - -```c -#undef DEFINED_MACRO -``` - -How to set the specific `config.h`, see: [set_config_h](#targetset_config_h) diff --git a/manual/project_target.md b/manual/project_target.md index 59d4863a..f1ca3703 100644 --- a/manual/project_target.md +++ b/manual/project_target.md @@ -2230,7 +2230,7 @@ option("foo") target("test") add_configfiles("config.h.in") - -- If the foo option is enabled -> Tianjian FOO_ENABLE and FOO_STRING definitions + -- If the foo option is enabled -> Add FOO_ENABLE and FOO_STRING definitions add_options("foo") ``` @@ -2250,7 +2250,7 @@ Config.h Regarding the option option detection, and the automatic generation of config.h, there are some helper functions, you can look at it: https://github.com/xmake-io/xmake/issues/342 -In addition to `#define`, if you want to other non-##defIne xxx` also performs state switching processing. You can use the `${default xxx 0}` mode to set default values, for example: +In addition to `#define`, if you want to other non`#define xxx` also performs state switching processing. You can use the `${default xxx 0}` mode to set default values, for example: ``` HAVE_SSE2 equ ${default VAR_HAVE_SSE2 0} diff --git a/zh-cn/manual/configuration_option.md b/zh-cn/manual/configuration_option.md index 361c9b07..47109d4c 100644 --- a/zh-cn/manual/configuration_option.md +++ b/zh-cn/manual/configuration_option.md @@ -79,15 +79,6 @@ option("test2") | [add_frameworks](#targetadd_frameworks) | 添加链接框架 | >= 2.1.1 | | [add_frameworkdirs](#targetadd_frameworkdirs) | 添加链接框架 | >= 2.1.5 | -| 废弃接口 | 描述 | 支持版本 | -| ----------------------------------------------------- | -------------------------------------------- | ---------------- | -| [add_bindings](#optionadd_bindings) | 添加正向关联选项,同步启用和禁用 | >= 2.0.1 < 2.1.5 | -| [add_rbindings](#optionadd_rbindings) | 添加逆向关联选项,同步启用和禁用 | >= 2.0.1 < 2.1.5 | -| [add_defines_if_ok](#optionadd_defines_if_ok) | 如果检测选项通过,则添加宏定义 | >= 1.0.1 < 2.1.5 | -| [add_defines_h_if_ok](#optionadd_defines_h_if_ok) | 如果检测选项通过,则添加宏定义到配置头文件 | >= 1.0.1 < 2.1.5 | -| [add_undefines_if_ok](#optionadd_undefines_if_ok) | 如果检测选项通过,则取消宏定义 | >= 1.0.1 < 2.1.5 | -| [add_undefines_h_if_ok](#optionadd_undefines_h_if_ok) | 如果检测选项通过,则在配置头文件中取消宏定义 | >= 1.0.1 < 2.1.5 | - ### option #### 定义选项 @@ -427,58 +418,6 @@ Options: $ xmake f --mode=release ``` -### option:add_bindings - -#### 添加正向关联选项,同步启用和禁用 - -<p class="tip"> -2.1.5版本之后已废弃,请用[add_deps](#optionadd_deps), [on_check](#optionon_check), [after_check](#optionafter_check)等接口代替。 -</p> - -绑定关联选项,例如我想在命令行中配置一个`smallest`的参数:`xmake f --smallest=y` - -这个时候,需要同时禁用多个其他的选项开关,来禁止编译多个模块,就是这个需求,相当于一个选项 与其他 多个选项之间 是有联动效应的。 - -而这个接口就是用来设置需要正向绑定的一些关联选项,例如: - -```lua --- 定义选项开关: --smallest=y|n -option("smallest") - - -- 添加正向绑定,如果smallest被启用,下面的所有选项开关也会同步被启用 - add_bindings("nozip", "noxml", "nojson") -``` - -### option:add_rbindings - -#### 添加逆向关联选项,同步启用和禁用 - -<p class="tip"> -2.1.5版本之后已废弃,请用[add_deps](#optionadd_deps), [on_check](#optionon_check), [after_check](#optionafter_check)等接口代替。 -</p> - -逆向绑定关联选项,被关联选项的开关状态是相反的。 - -```lua --- 定义选项开关: --smallest=y|n -option("smallest") - - -- 添加反向绑定,如果smallest被启用,下面的所有模块全部禁用 - add_rbindings("xml", "zip", "asio", "regex", "object", "thread", "network", "charset", "database") - add_rbindings("zlib", "mysql", "sqlite3", "openssl", "polarssl", "pcre2", "pcre", "base") -``` - -<p class="warn"> -需要注意的是,命令行配置是有顺序的,你可以先通过启用smallest禁用所有模块,然后添加其他选项,逐一启用。 -</p> - -例如: - -```bash --- 禁用所有模块,然后仅仅启用xml和zip模块 -$ xmake f --smallest=y --xml=y --zip=y -``` - ### option:add_links #### 添加链接库检测 @@ -588,69 +527,3 @@ option("constexpr") 如果想要更加灵活的检测,可以通过[lib.detect.check_cxsnippets](#detect-check_cxsnippets)在[option.on_check](#optionon_check)中去实现。 -### option:add_defines_if_ok - -#### 如果检测选项通过,则添加宏定义 - -<p class="tip"> -2.1.5版本之后已废弃,请用[add_defines](#targetadd_defines)接口代替。 -</p> - -检测选项通过后才会被设置,具体使用见[add_cincludes](#optionadd_cincludes)中的例子。 - -### option:add_defines_h_if_ok - -#### 如果检测选项通过,则添加宏定义到配置头文件 - -<p class="tip"> -2.1.5版本之后已废弃,请用[add_defines_h](#targetadd_defines_h)接口代替。 -</p> - -跟[add_defines_if_ok](#optionadd_defines_if_ok)类似,只是检测通过后,会在`config.h`头文件中自动加上被设置的宏定义。 - -例如: - -```lua -option("pthread") - set_default(false) - add_cincludes("pthread.h") - add_defines_h_if_ok("ENABLE_PTHREAD") - -target("test") - add_options("pthread") -``` - -通过后,会在`config.h`中加上: - -```c -#define ENABLE_PTHREAD 1 -``` - -具体`config.h`如何设置,见:[set_config_h](#targetset_config_h) - -### option:add_undefines_if_ok - -#### 如果检测选项通过,则取消宏定义 - -<p class="tip"> -2.1.5版本之后已废弃,请用[add_undefines](#targetadd_undefines)接口代替。 -</p> - -跟[add_defines_if_ok](#optionadd_defines_if_ok)类似,只是检测通过后,取消被设置的宏定义。 - -### option:add_undefines_h_if_ok - -#### 如果检测选项通过,则在配置头文件中取消宏定义 - -<p class="tip"> -2.1.5版本之后已废弃,请用[add_undefines_h](#targetadd_undefines_h)接口代替。 -</p> - -跟[add_defines_h_if_ok](#optionadd_defines_h_if_ok)类似,只是检测通过后,会在`config.h`中取消被设置的宏定义。 - -```c -#undef DEFINED_MACRO -``` - -具体`config.h`如何设置,见:[set_config_h](#targetset_config_h) - |
