summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-11-27 23:14:58 +0800
committerruki <[email protected]>2020-11-27 23:14:58 +0800
commit13c783ea053370c0f66d671b185c4c640cff3d07 (patch)
tree13cb38a09cb57f312970cb1df5996107610aea38
parent5ad143faae2708284f9db29aacfc745c52b76753 (diff)
improve tools/msbuild
-rw-r--r--xmake/modules/package/tools/msbuild.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/modules/package/tools/msbuild.lua b/xmake/modules/package/tools/msbuild.lua
index 4e7dbeb39..f35269e5f 100644
--- a/xmake/modules/package/tools/msbuild.lua
+++ b/xmake/modules/package/tools/msbuild.lua
@@ -23,6 +23,11 @@ import("core.base.option")
import("core.tool.toolchain")
import("lib.detect.find_tool")
+-- get the build environments
+function buildenvs(package, opt)
+ return table.copy(toolchain.load("msvc"):runenvs())
+end
+
-- build package
function build(package, configs, opt)
@@ -43,7 +48,7 @@ function build(package, configs, opt)
end
-- do build
- local runenvs = toolchain.load("msvc"):runenvs()
- local msbuild = find_tool("msbuild", {envs = runenvs})
- os.vrunv(msbuild.program, argv, {envs = runenvs})
+ local envs = opt.envs or buildenvs(package, opt)
+ local msbuild = find_tool("msbuild", {envs = envs})
+ os.vrunv(msbuild.program, argv, {envs = envs})
end