Skip to content

Commit a84fd0d

Browse files
committed
Added support for Visual Studio 2026
1 parent 62634e4 commit a84fd0d

File tree

11 files changed

+556
-2
lines changed

11 files changed

+556
-2
lines changed

modules/vstudio/_manifest.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ return {
2626
"vs2015.lua",
2727
"vs2017.lua",
2828
"vs2019.lua",
29-
"vs2022.lua"
29+
"vs2022.lua",
30+
"vs2026_solution.lua",
31+
"vs2026.lua",
3032
}

modules/vstudio/_preload.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
include("vs2017.lua")
2323
include("vs2019.lua")
2424
include("vs2022.lua")
25+
include("vs2026.lua")
2526

2627
-- Initialize Specific API
2728

@@ -767,5 +768,6 @@
767768
_ACTION == "vs2017" or
768769
_ACTION == "vs2019" or
769770
_ACTION == "vs2022" or
771+
_ACTION == "vs2026" or
770772
false;
771773
end

modules/vstudio/tests/_tests.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,8 @@ return {
119119

120120
-- Linux projects
121121
"linux/test_linux_files.lua",
122+
123+
-- Visual Studio 2026+ Solutions
124+
"sln2026/test_configurations.lua",
125+
"sln2026/test_projects.lua",
122126
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
--
2+
-- tests/actions/vstudio/sln2026/test_dependencies.lua
3+
-- Validate generation of Visual Studio 2026+ solution project dependencies.
4+
-- Author Nick Clark
5+
-- Copyright (c) 2025 Jess Perkins and the Premake project
6+
--
7+
8+
local p = premake
9+
local suite = test.declare("vstudio_sln2026_dependencies")
10+
local sln2026 = p.vstudio.sln2026
11+
12+
13+
function suite.setup()
14+
p.action.set("vs2026")
15+
end
16+
17+
18+
function suite.solution_header()
19+
sln2026.solution()
20+
21+
test.capture [[
22+
<Solution Description="Visual Studio slnx file generated by Premake" Version="1.4">
23+
]]
24+
end
25+
26+
27+
function suite.default_configurations()
28+
local wks = workspace "MyWorkspace"
29+
30+
sln2026.configurations(wks)
31+
32+
test.capture [[
33+
<Configurations>
34+
</Configurations>
35+
]]
36+
end
37+
38+
39+
function suite.multiple_configurations()
40+
local wks = workspace "MyWorkspace"
41+
42+
configurations { "Debug", "Release" }
43+
44+
sln2026.configurations(wks)
45+
46+
test.capture [[
47+
<Configurations>
48+
<BuildType Name="Debug" />
49+
<BuildType Name="Release" />
50+
<Platform Name="Win32" />
51+
</Configurations>
52+
]]
53+
end
54+
55+
56+
function suite.default_platforms()
57+
local wks = workspace "MyWorkspace"
58+
59+
sln2026.configurations(wks)
60+
61+
test.capture [[
62+
<Configurations>
63+
</Configurations>
64+
]]
65+
end
66+
67+
68+
function suite.multiple_platforms()
69+
local wks = workspace "MyWorkspace"
70+
71+
configurations { "Debug" }
72+
platforms { "x86", "x64" }
73+
74+
sln2026.configurations(wks)
75+
76+
test.capture [[
77+
<Configurations>
78+
<BuildType Name="Debug" />
79+
<Platform Name="Win32" />
80+
<Platform Name="x64" />
81+
</Configurations>
82+
]]
83+
end
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
--
2+
-- tests/actions/vstudio/sln2026/test_dependencies.lua
3+
-- Validate generation of Visual Studio 2026+ solution project dependencies.
4+
-- Author Nick Clark
5+
-- Copyright (c) 2025 Jess Perkins and the Premake project
6+
--
7+
8+
local p = premake
9+
local suite = test.declare("vstudio_sln2026_projects")
10+
local sln2026 = p.vstudio.sln2026
11+
12+
13+
function suite.setup()
14+
p.action.set("vs2026")
15+
end
16+
17+
18+
function suite.single_project()
19+
local wks = workspace "MyWorkspace"
20+
local prj = project "MyProject"
21+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
22+
23+
sln2026.projects(wks)
24+
25+
test.capture [[
26+
<Project Path="MyProject.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
27+
</Project>
28+
]]
29+
end
30+
31+
32+
function suite.multiple_projects_no_dependencies()
33+
local wks = workspace "MyWorkspace"
34+
35+
local prj1 = project "MyProject1"
36+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
37+
38+
local prj2 = project "MyProject2"
39+
uuid "BE62726D-187C-E440-BD07-2556188A6565"
40+
41+
sln2026.projects(wks)
42+
43+
test.capture [[
44+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
45+
</Project>
46+
<Project Path="MyProject2.vcxproj" Id="BE62726D-187C-E440-BD07-2556188A6565">
47+
</Project>
48+
]]
49+
end
50+
51+
52+
function suite.multiple_projects_with_dependency()
53+
local wks = workspace "MyWorkspace"
54+
configurations { "Debug", "Release" }
55+
56+
local prj1 = project "MyProject1"
57+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
58+
language "C++"
59+
kind "ConsoleApp"
60+
61+
local prj2 = project "MyProject2"
62+
uuid "BE62726D-187C-E440-BD07-2556188A6565"
63+
dependson "MyProject1"
64+
language "C++"
65+
kind "StaticLib"
66+
67+
sln2026.projects(wks)
68+
69+
test.capture [[
70+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
71+
</Project>
72+
<Project Path="MyProject2.vcxproj" Id="BE62726D-187C-E440-BD07-2556188A6565">
73+
<BuildDependency Project="MyProject1.vcxproj" />
74+
</Project>
75+
]]
76+
end
77+
78+
function suite.project_in_groups()
79+
local wks = workspace "MyWorkspace"
80+
configurations { "Debug", "Release" }
81+
82+
local grp1 = group "Group1"
83+
84+
local prj1 = project "MyProject1"
85+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
86+
87+
sln2026.projects(wks)
88+
89+
test.capture [[
90+
<Folder Name="/Group1/">
91+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
92+
</Project>
93+
</Folder>
94+
]]
95+
end
96+
97+
98+
function suite.project_with_explicit_runtime()
99+
local wks = workspace "MyWorkspace"
100+
configurations { "Debug", "Release", "SpecialRelease" }
101+
102+
local prj1 = project "MyProject1"
103+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
104+
filter "configurations:SpecialRelease"
105+
runtime "Release"
106+
filter {}
107+
108+
sln2026.projects(wks)
109+
110+
test.capture [[
111+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
112+
<BuildType Solution="SpecialRelease|Win32" Project="Release" />
113+
</Project>
114+
]]
115+
end
116+
117+
118+
function suite.project_excluded_from_build()
119+
local wks = workspace "MyWorkspace"
120+
configurations { "Debug", "Release" }
121+
122+
local prj1 = project "MyProject1"
123+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
124+
125+
filter "configurations:Release"
126+
flags { "ExcludeFromBuild" }
127+
128+
filter {}
129+
130+
sln2026.projects(wks)
131+
132+
test.capture [[
133+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
134+
<Build Solution="Release|Win32" Project="false" />
135+
</Project>
136+
]]
137+
end
138+
139+
140+
function suite.project_remove_configuration()
141+
local wks = workspace "MyWorkspace"
142+
configurations { "Debug", "Release" }
143+
144+
local prj1 = project "MyProject1"
145+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
146+
removeconfigurations { "Release" }
147+
148+
sln2026.projects(wks)
149+
150+
test.capture [[
151+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
152+
<Build Solution="Release|Win32" Project="false" />
153+
</Project>
154+
]]
155+
end

modules/vstudio/vs2026.lua

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
--
2+
-- vs2026.lua
3+
-- Extend the existing exporters with support for Visual Studio 2026.
4+
-- Copyright (c) Jess Perkins and the Premake project
5+
--
6+
7+
local p = premake
8+
p.vstudio.vs2026 = {}
9+
10+
local vs2026 = p.vstudio.vs2026
11+
local vstudio = p.vstudio
12+
13+
function vs2026.generateSolution(wks)
14+
p.indent(" ")
15+
p.eol("\r\n")
16+
p.escaper(p.vstudio.vs2010.esc)
17+
18+
p.generate(wks, ".slnx", vstudio.sln2026.generate)
19+
end
20+
21+
---
22+
-- Define the Visual Studio 2022 export action.
23+
---
24+
25+
newaction {
26+
-- Metadata for the command line and help system
27+
28+
trigger = "vs2026",
29+
shortname = "Visual Studio 2026",
30+
description = "Generate Visual Studio 2026 project files",
31+
32+
-- Visual Studio always uses Windows path and naming conventions
33+
34+
targetos = "windows",
35+
toolset = "msc-v145",
36+
37+
-- The capabilities of this action
38+
39+
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None", "Utility", "SharedItems", p.PACKAGING },
40+
valid_languages = { "C", "C++", "C#", "F#" },
41+
valid_tools = {
42+
cc = { "msc", "clang" },
43+
dotnet = { "msnet" },
44+
},
45+
46+
-- Workspace and project generation logic
47+
48+
onWorkspace = function(wks)
49+
vstudio.vs2026.generateSolution(wks)
50+
end,
51+
onProject = function(prj)
52+
p.vstudio.vs2010.generateProject(prj)
53+
end,
54+
onRule = function(rule)
55+
p.vstudio.vs2010.generateRule(rule)
56+
end,
57+
58+
onCleanWorkspace = function(wks)
59+
p.vstudio.cleanSolution(wks)
60+
end,
61+
onCleanProject = function(prj)
62+
p.vstudio.cleanProject(prj)
63+
end,
64+
onCleanTarget = function(prj)
65+
p.vstudio.cleanTarget(prj)
66+
end,
67+
68+
pathVars = vstudio.vs2010.pathVars,
69+
70+
-- This stuff is specific to the Visual Studio exporters
71+
72+
vstudio = {
73+
solutionVersion = "1.4",
74+
versionName = "Version 18",
75+
targetFramework = "4.7.2",
76+
toolsVersion = "15.0",
77+
userToolsVersion = "Current",
78+
filterToolsVersion = "4.0",
79+
}
80+
}

0 commit comments

Comments
 (0)