diff options
| author | ruki <waruqi@gmail.com> | 2018-10-12 22:41:35 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-10-12 10:09:32 +0800 |
| commit | 7d0111e60889fcebd22b789622e1afc68b28592f (patch) | |
| tree | a7edb8ac3555d95d9683651a7ce1e20468373f5e | |
| parent | d14d4b67a8ece523d6492cc56b7bc906d4651049 (diff) | |
| download | xmake-docs-7d0111e60889fcebd22b789622e1afc68b28592f.tar.gz xmake-docs-7d0111e60889fcebd22b789622e1afc68b28592f.zip | |
add set_config and set_dependir
| -rw-r--r-- | manual.md | 31 | ||||
| -rw-r--r-- | zh/manual.md | 30 |
2 files changed, 61 insertions, 0 deletions
@@ -331,6 +331,7 @@ The global interface affects the whole project description scope and all sub-pro | [add_plugindirs](#add_plugindirs) | Add plugin directories | >= 2.0.1 | | [add_packagedirs](#add_packagedirs) | Add package directories | >= 2.0.1 | | [get_config](#get_config) | Get the configuration value | >= 2.2.2 | +| [set_config](#set_config) | Set the default configuration value | >= 2.2.2 | ##### includes @@ -538,6 +539,24 @@ if get_config("myconfig") == "xxx" then end ``` +##### set_config + +###### Set the default configuration value + +This interface is introduced from version 2.2.2 to set the default configuration value in xmake.lua. + +Many previous configurations, including the build toolchain, build directory, etc. +We can only be configured by `$xmake f --name=value`. If we want to write a default value in xmake.lua, we can use the following method: + +```lua +set_config("name", "value") +set_config("buildir", "other/buildir") +set_config("cc", "gcc") +set_config("ld", "g++") +``` + +However, we can still modify the default configuration in xmake.lua by `$xmake f --name=value`. + #### Project Target We can use `target("test")` to define a project target named "test", each target generates an executable program, a static library, or a dynamic library. @@ -581,6 +600,7 @@ target("test2") | [set_headerdir](#targetset_headerdir) | Set output directories for header files | >= 1.0.1 | | [set_targetdir](#targetset_targetdir) | Set output directories for target file | >= 1.0.1 | | [set_objectdir](#targetset_objectdir) | Set output directories for object files | >= 1.0.1 | +| [set_dependir](#targetset_dependir) | Set output directories for dependent files | >= 2.2.2 | | [add_imports](#targetadd_imports) | Add imported modules for the custom script | >= 2.1.7 | | [add_rules](#targetadd_rules) | Add custom compilation rule to target | >= 2.1.9 | | [on_load](#targeton_load) | Run custom load target configuartion script | >= 2.1.5 | @@ -1045,6 +1065,17 @@ target("test") set_objectdir("$(buildir)/.objs") ``` +##### target:set_dependir + +###### Set output directories for dependent files + +设置目标target的编译依赖文件(`.deps`)的输出目录,例如: + +```lua +target("test") + set_dependir("$(buildir)/.deps") +``` + ##### target:add_imports ###### Add imported modules for the custom script diff --git a/zh/manual.md b/zh/manual.md index 1cc00103..9056c770 100644 --- a/zh/manual.md +++ b/zh/manual.md @@ -352,6 +352,7 @@ $ xmake f --test1=false | [add_plugindirs](#add_plugindirs) | 添加插件目录 | >= 2.0.1 | | [add_packagedirs](#add_packagedirs) | 添加包目录 | >= 2.0.1 | | [get_config](#get_config) | 获取给的配置值 | >= 2.2.2 | +| [set_config](#set_config) | 设置默认的配置值 | >= 2.2.2 | ##### includes @@ -563,6 +564,23 @@ if get_config("myconfig") == "xxx" then end ``` +##### set_config + +###### 设置给定的默认配置值 + +此接口从2.2.2版本开始引入,用于快速在xmake.lua中设置一个默认配置值,仅用于描述域。 + +之前很多配置,包括编译工具链,构建目录等只能通过`$ xmake f --name=value`的方式来配置,如果我们想写死在xmake.lua提供一个默认值,就可以通过下面的方式来配置: + +```lua +set_config("name", "value") +set_config("buildir", "other/buildir") +set_config("cc", "gcc") +set_config("ld", "g++") +``` + +不过,我们还是可以通过`$ xmake f --name=value`的方式,去修改xmake.lua中的默认配置。 + #### 工程目标 定义和设置子工程模块,每个`target`对应一个子工程,最后会生成一个目标程序,有可能是可执行程序,也有可能是库模块。 @@ -607,6 +625,7 @@ target("test2") | [set_headerdir](#targetset_headerdir) | 设置头文件安装目录 | >= 1.0.1 | | [set_targetdir](#targetset_targetdir) | 设置生成目标文件目录 | >= 1.0.1 | | [set_objectdir](#targetset_objectdir) | 设置对象文件生成目录 | >= 1.0.1 | +| [set_dependir](#targetset_dependir) | 设置依赖文件生成目录 | >= 2.2.2 | | [add_imports](#targetadd_imports) | 为所有自定义脚本预先导入扩展模块 | >= 2.1.7 | | [add_rules](#targetadd_rules) | 添加规则到目标 | >= 2.1.9 | | [on_load](#targeton_load) | 自定义目标加载脚本 | >= 2.1.5 | @@ -1067,6 +1086,17 @@ target("test") set_objectdir("$(buildir)/.objs") ``` +##### target:set_dependir + +###### 设置依赖文件生成目录 + +设置目标target的编译依赖文件(`.deps`)的输出目录,例如: + +```lua +target("test") + set_dependir("$(buildir)/.deps") +``` + ##### target:add_imports ###### 为自定义脚本预先导入扩展模块 |
