aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2019-06-07 00:16:04 +0800
committerruki <waruqi@gmail.com>2019-06-06 19:36:27 +0800
commitfe20f4db17fa6b350eee237d476d7635ee1a4e69 (patch)
tree4cdbd314d36583ad651f0ebd68c91e7877e0d830
parent894bc38bd69e997095b5b899787a74a48229d172 (diff)
downloadxmake-docs-fe20f4db17fa6b350eee237d476d7635ee1a4e69.tar.gz
xmake-docs-fe20f4db17fa6b350eee237d476d7635ee1a4e69.zip
add set_rundir and add_runenvs api
-rw-r--r--manual.md33
-rw-r--r--zh/manual.md33
2 files changed, 66 insertions, 0 deletions
diff --git a/manual.md b/manual.md
index 0842c274..3bcf1c45 100644
--- a/manual.md
+++ b/manual.md
@@ -922,6 +922,8 @@ target("test2")
| [add_tools](#targetadd_tools) | Add toolchains | >= 2.2.1 |
| [set_values](#targetset_values) | Set custom configuartion values | >= 2.2.1 |
| [add_values](#targetadd_values) | Add custom configuartion values | >= 2.2.1 |
+| [set_rundir](#targetset_rundir) | Set run directory | >= 2.2.7 |
+| [add_runenvs](#targetadd_runenvs) | Add run environments | >= 2.2.7 |
| [set_installdir](#targetset_installdir) | Set the installation directory | >= 2.2.5 |
| [add_installfiles](#targetadd_installfiles) | add installation files | >= 2.2.5 |
| [add_headerfiles](#targetadd_headerfiles) | Add header files | >= 2.2.5 |
@@ -2917,6 +2919,37 @@ The specific extension configuration name will be different according to differe
Usage is similar to [target:set_values](#targetset_tools), the difference is that this interface is an additional setting, and will not override the settings each time.
+##### target:set_rundir
+
+###### Setting the running directory
+
+This interface is used to set the current running directory of the default running target program. If not set, by default, the target is loaded and run in the directory where the executable file is located.
+
+If the user wants to modify the load directory, one is to customize the run logic by `on_run()`, and to do the switch inside, but just to cut the directory, this is too cumbersome.
+
+Therefore, you can quickly switch settings to the default directory environment through this interface.
+
+```lua
+target("test")
+     set_kind("binary")
+     add_files("src/*.c")
+     set_rundir("$(projectdir)/xxx")
+```
+
+##### target:add_runenvs
+
+###### Adding runtime variables
+
+This interface is used to add environment variables that set the default run target program.
+
+```lua
+target("test")
+     set_kind("binary")
+     add_files("src/*.c")
+     add_runenvs("PATH", "/tmp/bin", "xxx/bin")
+     add_runenvs("NAME", "value")
+```
+
##### target:set_installdir
###### Set the installation directory
diff --git a/zh/manual.md b/zh/manual.md
index bee6d49a..9865dc21 100644
--- a/zh/manual.md
+++ b/zh/manual.md
@@ -950,6 +950,8 @@ target("test2")
| [add_tools](#targetadd_tools) | 添加编译链接工具链 | >= 2.2.1 |
| [set_values](#targetset_values) | 设置一些扩展配置值 | >= 2.2.1 |
| [add_values](#targetadd_values) | 添加一些扩展配置值 | >= 2.2.1 |
+| [set_rundir](#targetset_rundir) | 设置运行目录 | >= 2.2.7 |
+| [add_runenvs](#targetadd_runenvs) | 添加运行环境变量 | >= 2.2.7 |
| [set_installdir](#targetset_installdir) | 设置安装目录 | >= 2.2.5 |
| [add_installfiles](#targetadd_installfiles) | 添加安装文件 | >= 2.2.5 |
| [add_headerfiles](#targetadd_headerfiles) | 添加安装头文件 | >= 2.2.5 |
@@ -2938,6 +2940,37 @@ target("test")
用法跟[target:set_values](#targetset_tools)类似,区别就是这个接口是追加设置,而不会每次覆盖设置。
+##### target:set_rundir
+
+###### 设置运行目录
+
+此接口用于设置默认运行target程序的当前运行目录,如果不设置,默认情况下,target是在可执行文件所在目录加载运行。
+
+如果用户想要修改加载目录,一种是通过`on_run()`的方式自定义运行逻辑,里面去做切换,但仅仅为了切个目录就这么做,太过繁琐。
+
+因此可以通过这个接口快速的对默认执行的目录环境做设置切换。
+
+```lua
+target("test")
+ set_kind("binary")
+ add_files("src/*.c")
+ set_rundir("$(projectdir)/xxx")
+```
+
+##### target:add_runenvs
+
+###### 添加运行环境变量
+
+此接口用于添加设置默认运行target程序的环境变量。
+
+```lua
+target("test")
+ set_kind("binary")
+ add_files("src/*.c")
+ add_runenvs("PATH", "/tmp/bin", "xxx/bin")
+ add_runenvs("NAME", "value")
+```
+
##### target:set_installdir
###### 设置安装目录