diff options
| author | ruki <[email protected]> | 2021-04-03 20:55:15 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-04-03 20:55:15 +0800 |
| commit | 366ead217061107fdb6b562cdbab3ca7e8192b88 (patch) | |
| tree | a1be613122d7584251fdf388bb2b992b574484ad /xmake/modules/package/tools/nmake.lua | |
| parent | 2d823f353f9d47d6f63ffa433390f3437a5b305c (diff) | |
improve tools/nmake
Diffstat (limited to 'xmake/modules/package/tools/nmake.lua')
| -rw-r--r-- | xmake/modules/package/tools/nmake.lua | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/xmake/modules/package/tools/nmake.lua b/xmake/modules/package/tools/nmake.lua index 146058a98..d8c40efca 100644 --- a/xmake/modules/package/tools/nmake.lua +++ b/xmake/modules/package/tools/nmake.lua @@ -24,13 +24,24 @@ import("core.project.config") import("core.tool.toolchain") import("lib.detect.find_tool") +-- get the build environments +function buildenvs(package, opt) + local envs = {} + for name, values in pairs(toolchain.load("msvc"):runenvs()) do + local oldvalues = os.getenv(name) + if oldvalues then + values = values .. path.envsep() .. oldvalues + end + envs[name] = values + end + return envs +end + -- build package function build(package, configs, opt) - -- init options - opt = opt or {} - -- pass configurations + opt = opt or {} local argv = {} if option.get("verbose") then table.insert(argv, "VERBOSE=1") @@ -47,15 +58,16 @@ function build(package, configs, opt) end -- do build - local runenvs = toolchain.load("msvc"):runenvs() + local runenvs = opt.envs or buildenvs(package, opt) local nmake = find_tool("nmake", {envs = runenvs}) os.vrunv(nmake.program, argv, {envs = runenvs}) end -- install package -function install(package, configs) +function install(package, configs, opt) -- pass configurations + opt = opt or {} local argv = {"install"} if option.get("verbose") then table.insert(argv, "VERBOSE=1") @@ -72,7 +84,7 @@ function install(package, configs) end -- do install - local runenvs = toolchain.load("msvc"):runenvs() + local runenvs = opt.envs or buildenvs(package, opt) local nmake = find_tool("nmake", {envs = runenvs}) os.vrunv(nmake.program, argv, {envs = runenvs}) end |
