From 2100f3ade2062adfea1aadba740163aced6515f7 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Tue, 17 Dec 2024 18:34:38 +0800 Subject: [PATCH] update for windows platform --- pkgs/c/cpp.lua | 4 ++-- pkgs/m/msvc.lua | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/c/cpp.lua b/pkgs/c/cpp.lua index c64c71d..31bfd6c 100644 --- a/pkgs/c/cpp.lua +++ b/pkgs/c/cpp.lua @@ -15,7 +15,7 @@ package = { xpm = { windows = { - deps = {"msvc"}, + deps = {"msvc@2022"}, ["latest"] = { ref = "msvc" }, ["msvc"] = {}, }, @@ -38,7 +38,7 @@ local pkginfo = runtime.get_pkginfo() function installed() if pkginfo.version == "msvc" then - return toolchain.load("msvc"):check() + return toolchain.load("msvc"):check() == "2022" elseif pkginfo.version == "gnu" then local output = os.iorun("gcc --version") return string.find(output:trim(), "gcc", 1, true) ~= nil diff --git a/pkgs/m/msvc.lua b/pkgs/m/msvc.lua index d73910e..8e153a2 100644 --- a/pkgs/m/msvc.lua +++ b/pkgs/m/msvc.lua @@ -10,19 +10,21 @@ package = { keywords = { "msvc", "c++", "c" }, xpm = { - deps = { "vs-buildtools@2022" }, windows = { + deps = { "vs-buildtools@2022" }, ["latest"] = { ref = "2022" }, ["2022"] = { } -- v143 }, } } +import("core.tool.toolchain") + -- https://learn.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2022 local msvc_component = "Microsoft.VisualStudio.Component.VC.Tools.x86.x64" function installed() - return toolchain.load("msvc"):check() + return toolchain.load("msvc"):check() == "2022" end function install() @@ -36,6 +38,7 @@ function install() -- " --norestart " .. " --wait " -- .. ) + return true end function uninstall() @@ -45,4 +48,5 @@ function uninstall() " --passive " .. " --wait " ) + return true end \ No newline at end of file