improve msvc (#5827)

* improve msvc

* fix deps

* improve tips
pull/5830/head
ruki 3 months ago committed by GitHub
parent be2efcfb75
commit 83c421954e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 15
      packages/m/msvc/xmake.lua

@ -31,7 +31,7 @@ package("msvc")
on_load(function (package) on_load(function (package)
if not package:is_precompiled() then if not package:is_precompiled() then
if is_host("windows") then if is_host("windows") then
package:add("deps", "portablebuildtools") package:add("deps", "portable_build_tools")
elseif is_host("linux") then elseif is_host("linux") then
-- TODO use msvc-wine -- TODO use msvc-wine
end end
@ -52,6 +52,18 @@ package("msvc")
on_install("@windows", "@msys", function (package) on_install("@windows", "@msys", function (package)
import("core.base.semver") import("core.base.semver")
-- get confirm result
local result = utils.confirm({description = function ()
cprint("${bright color.warning}note: ${clear}Do you accept the license agreement for installing msvc build toolchain?")
cprint(" https://go.microsoft.com/fwlink/?LinkId=2179911")
end, answer = function ()
cprint("please input: ${bright}y${clear} (y/n)")
io.flush()
return (io.read() or "n"):trim()
end})
if result and result ~= "n" then
local argv = {"accept_license"} local argv = {"accept_license"}
local sdkver = semver.new(package:config("sdkver") or "10.0.26100") local sdkver = semver.new(package:config("sdkver") or "10.0.26100")
if package:config("preview") then if package:config("preview") then
@ -68,6 +80,7 @@ package("msvc")
-- https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/ -- https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/
-- https://github.com/Data-Oriented-House/PortableBuildTools/blob/3a2cd42b1de75da63ad30a55982d8dff3c36aa45/source.c#L724 -- https://github.com/Data-Oriented-House/PortableBuildTools/blob/3a2cd42b1de75da63ad30a55982d8dff3c36aa45/source.c#L724
os.vrunv("PortableBuildTools.exe", argv) os.vrunv("PortableBuildTools.exe", argv)
end
end) end)
on_test(function (package) on_test(function (package)

Loading…
Cancel
Save