diff options
| author | ruki <[email protected]> | 2019-06-06 22:36:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-06-06 09:36:16 +0800 |
| commit | 84e1151a89aefa2da12de34f763e36fda95eb2e4 (patch) | |
| tree | 4563584984e12aac13d6c8b8209b1a668bcf0a1a | |
| parent | 783dce4adabedce2062a90f3231e2b2f7e4942e2 (diff) | |
add set_rundir and add_runenvs
| -rw-r--r-- | CHANGELOG.md | 8 | ||||
| -rw-r--r-- | xmake/actions/run/main.lua | 8 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e51cfb907..7742469b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### New features + +* [#440](https://github.com/xmake-io/xmake/issues/440): Add `set_rundir()` and `add_runenvs()` api for target/run + ### Changes * [#430](https://github.com/xmake-io/xmake/pull/430): Add `includes("add_cucodegens.lua")` to improve set codegen for cuda @@ -589,6 +593,10 @@ ## master (开发中) +### 新特性 + +* [#440](https://github.com/xmake-io/xmake/issues/440): 为target/run添加`set_rundir()`和`add_runenvs()`接口设置 + ### 改进 * [#430](https://github.com/xmake-io/xmake/pull/430): 添加`includes("add_cucodegens.lua")`为cuda改进设置codegen diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index aab49ad50..41614f879 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -41,6 +41,14 @@ function _do_run_target(target) -- enter the run directory local oldir = os.cd(rundir) + -- add run environments + local runenvs = target:get("runenvs") + if runenvs then + for name, values in pairs(runenvs) do + os.addenv(name, unpack(table.wrap(values))) + end + end + -- add search directories for all dependent shared libraries on windows if is_plat("windows") or (is_plat("mingw") and is_host("windows")) then local searchdirs = {} diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index b2a77644d..44ac0c52c 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1548,6 +1548,7 @@ function target.apis() , "target.set_configvar" -- target.add_xxx , "target.add_values" + , "target.add_runenvs" } , pathes = { |
