summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-09-10 17:34:22 +0800
committerGitHub <[email protected]>2025-09-10 17:34:22 +0800
commite47954aadbb5dd06b9a09b31792de72cc01295a4 (patch)
tree929feeaeb4d2800937f925e29131cbac7cf9879e
parent73e8fef22ad9381e525962104a60b97e37cdf209 (diff)
parentc589a45b14063d6f21fcfd1e192ebf360ca6c2b7 (diff)
Merge pull request #6787 from xmake-io/msvc
Support for vs2026
-rw-r--r--README.md2
-rw-r--r--README_zh.md2
m---------core/src/tbox/tbox0
-rw-r--r--xmake/modules/detect/sdks/find_vstudio.lua6
-rw-r--r--xmake/modules/package/manager/conan/v1/install_package.lua12
-rw-r--r--xmake/modules/package/tools/cmake.lua13
-rw-r--r--xmake/modules/private/action/trybuild/cmake.lua15
-rw-r--r--xmake/modules/private/action/trybuild/msbuild.lua2
-rw-r--r--xmake/modules/private/utils/toolchain.lua15
-rw-r--r--xmake/plugins/project/main.lua2
-rw-r--r--xmake/plugins/project/vstudio/impl/vsinfo.lua8
-rw-r--r--xmake/scripts/vsxmake/vsproj/Xmake.props1
12 files changed, 38 insertions, 40 deletions
diff --git a/README.md b/README.md
index debff4722..3cc6f581b 100644
--- a/README.md
+++ b/README.md
@@ -565,7 +565,7 @@ target("test")
## Plugins
-#### Generate IDE project file plugin(makefile, vs2002 - vs2022 .. )
+#### Generate IDE project file plugin(makefile, vs2002 - vs2026 .. )
```bash
$ xmake project -k vsxmake -m "debug,release" # New vsproj generator (Recommended)
diff --git a/README_zh.md b/README_zh.md
index 22dea813d..361b48bc1 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -553,7 +553,7 @@ target("test")
## 插件
-#### 生成IDE工程文件插件(makefile, vs2002 - vs2022, ...)
+#### 生成IDE工程文件插件(makefile, vs2002 - vs2026, ...)
```bash
$ xmake project -k vsxmake -m "debug,release" # 新版vs工程生成插件(推荐)
diff --git a/core/src/tbox/tbox b/core/src/tbox/tbox
-Subproject 91a110d061d6486a7a0826919e0c60caf7586a3
+Subproject b4c7e09b76751eacb7afa1521ac688e54b9cc76
diff --git a/xmake/modules/detect/sdks/find_vstudio.lua b/xmake/modules/detect/sdks/find_vstudio.lua
index ba81d1993..cf56fcca9 100644
--- a/xmake/modules/detect/sdks/find_vstudio.lua
+++ b/xmake/modules/detect/sdks/find_vstudio.lua
@@ -56,7 +56,8 @@ local vcvars = {"path",
-- init vsvers
local vsvers =
{
- ["17.0"] = "2022"
+ ["18.0"] = "2026"
+, ["17.0"] = "2022"
, ["16.0"] = "2019"
, ["15.0"] = "2017"
, ["14.0"] = "2015"
@@ -75,7 +76,8 @@ local vsvers =
-- init vsenvs
local vsenvs =
{
- ["17.0"] = "VS170COMNTOOLS"
+ ["18.0"] = "VS180COMNTOOLS"
+, ["17.0"] = "VS170COMNTOOLS"
, ["16.0"] = "VS160COMNTOOLS"
, ["15.0"] = "VS150COMNTOOLS"
, ["14.0"] = "VS140COMNTOOLS"
diff --git a/xmake/modules/package/manager/conan/v1/install_package.lua b/xmake/modules/package/manager/conan/v1/install_package.lua
index 22bdb0bfd..d96727eb7 100644
--- a/xmake/modules/package/manager/conan/v1/install_package.lua
+++ b/xmake/modules/package/manager/conan/v1/install_package.lua
@@ -27,6 +27,7 @@ import("core.platform.platform")
import("lib.detect.find_tool")
import("devel.git")
import("net.fasturl")
+import("private.utils.toolchain", {alias = "toolchain_utils"})
-- get build env
function _conan_get_build_env(name, plat)
@@ -197,20 +198,11 @@ function main(conan, name, opt)
-- set compiler settings
if opt.plat == "windows" then
- local vsvers = {["2022"] = "17",
- ["2019"] = "16",
- ["2017"] = "15",
- ["2015"] = "14",
- ["2013"] = "12",
- ["2012"] = "11",
- ["2010"] = "10",
- ["2008"] = "9",
- ["2005"] = "8"}
local vs = assert(config.get("vs"), "vs not found!")
table.insert(argv, "-s")
table.insert(argv, "compiler=Visual Studio")
table.insert(argv, "-s")
- table.insert(argv, "compiler.version=" .. assert(vsvers[vs], "unknown msvc version!"))
+ table.insert(argv, "compiler.version=" .. toolchain_utils.get_vsver(vs))
if configs.runtimes then
table.insert(argv, "-s")
table.insert(argv, "compiler.runtime=" .. configs.runtimes)
diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua
index 21eed5392..cbf9bcb37 100644
--- a/xmake/modules/package/tools/cmake.lua
+++ b/xmake/modules/package/tools/cmake.lua
@@ -764,20 +764,9 @@ end
-- get cmake generator for msvc
function _get_cmake_generator_for_msvc(package)
- local vsvers =
- {
- ["2022"] = "17",
- ["2019"] = "16",
- ["2017"] = "15",
- ["2015"] = "14",
- ["2013"] = "12",
- ["2012"] = "11",
- ["2010"] = "10",
- ["2008"] = "9"
- }
local vs = _get_msvc(package):config("vs") or config.get("vs")
assert(vsvers[vs], "Unknown Visual Studio version: '" .. tostring(vs) .. "' set in project.")
- return "Visual Studio " .. vsvers[vs] .. " " .. vs
+ return "Visual Studio " .. toolchain_utils.get_vsver(vs) .. " " .. vs
end
-- get configs for cmake generator
diff --git a/xmake/modules/private/action/trybuild/cmake.lua b/xmake/modules/private/action/trybuild/cmake.lua
index 3cf96c7e3..377c9c66e 100644
--- a/xmake/modules/private/action/trybuild/cmake.lua
+++ b/xmake/modules/private/action/trybuild/cmake.lua
@@ -395,20 +395,9 @@ end
-- get cmake generator for msvc
function _get_cmake_generator_for_msvc()
- local vsvers =
- {
- ["2022"] = "17",
- ["2019"] = "16",
- ["2017"] = "15",
- ["2015"] = "14",
- ["2013"] = "12",
- ["2012"] = "11",
- ["2010"] = "10",
- ["2008"] = "9"
- }
local vs = _get_msvc():config("vs") or config.get("vs")
assert(vsvers[vs], "Unknown Visual Studio version: '" .. tostring(vs) .. "' set in project.")
- return "Visual Studio " .. vsvers[vs] .. " " .. vs
+ return "Visual Studio " .. toolchain_utils.get_vsver(vs) .. " " .. vs
end
-- get configs for cmake generator
@@ -500,7 +489,7 @@ end
function _build_for_msvc(opt)
local runenvs = _get_msvc_runenvs()
local msbuild = find_tool("msbuild", {envs = runenvs})
- local slnfile = assert(find_file("*.sln", os.curdir()), "*.sln file not found!")
+ local slnfile = assert(find_file("*.sln", os.curdir()) or find_file("*.slnx", os.curdir()), "*.sln/slnx file not found!")
os.vexecv(msbuild.program, {slnfile, "-nologo", "-t:Build", "-m",
"-p:Configuration=" .. (is_mode("debug") and "Debug" or "Release"),
"-p:Platform=" .. _get_vsarch()}, {envs = runenvs})
diff --git a/xmake/modules/private/action/trybuild/msbuild.lua b/xmake/modules/private/action/trybuild/msbuild.lua
index 665bbf72c..a2baa9a6d 100644
--- a/xmake/modules/private/action/trybuild/msbuild.lua
+++ b/xmake/modules/private/action/trybuild/msbuild.lua
@@ -27,7 +27,7 @@ import("lib.detect.find_tool")
-- find project file
function _find_projectfile()
- return find_file("*.sln", os.curdir())
+ return find_file("*.sln", os.curdir()) or find_file("*.slnx", os.curdir())
end
-- detect build-system and configuration file
diff --git a/xmake/modules/private/utils/toolchain.lua b/xmake/modules/private/utils/toolchain.lua
index 8fbd5c111..da2e9febf 100644
--- a/xmake/modules/private/utils/toolchain.lua
+++ b/xmake/modules/private/utils/toolchain.lua
@@ -35,6 +35,21 @@ function is_compatible_with_host(name)
end
end
+-- get vs version
+function get_vsver(vs)
+ local vsvers = {["2026"] = "18",
+ ["2022"] = "17",
+ ["2019"] = "16",
+ ["2017"] = "15",
+ ["2015"] = "14",
+ ["2013"] = "12",
+ ["2012"] = "11",
+ ["2010"] = "10",
+ ["2008"] = "9",
+ ["2005"] = "8"}
+ return assert(vsvers[vs], "unknown msvc version!")
+end
+
-- get vs toolset version, e.g. v143, v144, ..
function get_vs_toolset_ver(vs_toolset)
local toolset_ver
diff --git a/xmake/plugins/project/main.lua b/xmake/plugins/project/main.lua
index 9b85f0b6f..d48f6662d 100644
--- a/xmake/plugins/project/main.lua
+++ b/xmake/plugins/project/main.lua
@@ -54,6 +54,7 @@ function makers()
, vs2017 = vs.make(2017)
, vs2019 = vs.make(2019)
, vs2022 = vs.make(2022)
+ , vs2026 = vs.make(2026)
, vs = vs.make()
, vsxmake2010 = vsxmake.make(2010)
, vsxmake2012 = vsxmake.make(2012)
@@ -62,6 +63,7 @@ function makers()
, vsxmake2017 = vsxmake.make(2017)
, vsxmake2019 = vsxmake.make(2019)
, vsxmake2022 = vsxmake.make(2022)
+ , vsxmake2026 = vsxmake.make(2026)
, vsxmake = vsxmake.make()
, compile_flags = compile_flags.make
, compile_commands = compile_commands.make
diff --git a/xmake/plugins/project/vstudio/impl/vsinfo.lua b/xmake/plugins/project/vstudio/impl/vsinfo.lua
index 1743f00ab..2168e734d 100644
--- a/xmake/plugins/project/vstudio/impl/vsinfo.lua
+++ b/xmake/plugins/project/vstudio/impl/vsinfo.lua
@@ -93,6 +93,14 @@ local vsinfo =
, toolset_version = "v143"
, sdk_version = "10.0.19041.0"
}
+, [2026] =
+ { vstudio_version = "2026"
+ , project_version = "18"
+ , filters_version = "4.0"
+ , solution_version = "12"
+ , toolset_version = "v145"
+ , sdk_version = "10.0.26100.0"
+ }
}
function main(version)
diff --git a/xmake/scripts/vsxmake/vsproj/Xmake.props b/xmake/scripts/vsxmake/vsproj/Xmake.props
index 0c8f0e987..e2bf58dfe 100644
--- a/xmake/scripts/vsxmake/vsproj/Xmake.props
+++ b/xmake/scripts/vsxmake/vsproj/Xmake.props
@@ -58,6 +58,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '16.0'">v142</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '17.0'">v143</PlatformToolset>
+ <PlatformToolset Condition="'$(VisualStudioVersion)' == '18.0'">v145</PlatformToolset>
</PropertyGroup>
<PropertyGroup Label="AdditionalProps">