summaryrefslogtreecommitdiff
path: root/xmake/modules/package
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-21 16:32:17 +0800
committerruki <[email protected]>2020-06-21 16:32:17 +0800
commitbf2a6694133db7b795b71e06e5a7162b21b5e26f (patch)
tree84f53941faf34b7da4cc710322f40d4b4ea7ceea /xmake/modules/package
parentb983c94fcda0e069e906f4dd46d1d19726780843 (diff)
improve to call msbuild
Diffstat (limited to 'xmake/modules/package')
-rw-r--r--xmake/modules/package/tools/cmake.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 7299f20b4..f35b489b4 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -20,7 +20,9 @@
-- imports
import("core.base.option")
+import("core.tool.toolchain")
import("lib.detect.find_file")
+import("lib.detect.find_tool")
-- get configs
function _get_configs(package, configs)
@@ -118,10 +120,12 @@ function install(package, configs, opt)
-- do build and install
if package:is_plat("windows") then
local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!")
- os.vrun("msbuild \"%s\" -nologo -t:Rebuild -p:Configuration=%s -p:Platform=%s", slnfile, package:debug() and "Debug" or "Release", package:is_arch("x64") and "x64" or "Win32")
+ local runenvs = toolchain.load("msvc", {plat = package:plat(), arch = package:arch()}):runenvs()
+ local msbuild = find_tool("msbuild", {envs = runenvs})
+ os.vrunv(msbuild.program, {slnfile, "-nologo", "-t:Rebuild", "-p:Configuration=" .. (package:debug() and "Debug" or "Release"), "-p:Platform=" .. (package:is_arch("x64") and "x64" or "Win32")}, {envs = runenvs})
local projfile = os.isfile("INSTALL.vcxproj") and "INSTALL.vcxproj" or "INSTALL.vcproj"
if os.isfile(projfile) then
- os.vrun("msbuild \"%s\" /property:configuration=%s", projfile, package:debug() and "Debug" or "Release")
+ os.vrunv(msbuild.program, {projfile, "/property:configuration=" .. (package:debug() and "Debug" or "Release")}, {envs = runenvs})
os.trycp("install/lib", package:installdir()) -- perhaps only headers library
os.cp("install/include", package:installdir())
else