Skip to content

Commit d18920d

Browse files
Added support for Visual Studio 2026 (#2504)
1 parent fc0c68f commit d18920d

File tree

11 files changed

+708
-2
lines changed

11 files changed

+708
-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: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
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_configmap()
99+
local wks = workspace "MyWorkspace"
100+
configurations { "Debug", "Release", "SpecialRelease" }
101+
102+
local prj1 = project "MyProject1"
103+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
104+
configmap {
105+
[ "Release" ] = "Release",
106+
[ "SpecialRelease" ] = "Release",
107+
[ "Debug" ] = "Debug",
108+
}
109+
110+
sln2026.projects(wks)
111+
112+
test.capture [[
113+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
114+
<BuildType Solution="Debug|*" Project="Debug" />
115+
<BuildType Solution="Release|*" Project="Release" />
116+
<BuildType Solution="SpecialRelease|*" Project="Release" />
117+
</Project>
118+
]]
119+
end
120+
121+
122+
function suite.project_with_single_configmap()
123+
local wks = workspace "MyWorkspace"
124+
configurations { "Debug", "Release", "SpecialRelease" }
125+
126+
local prj1 = project "MyProject1"
127+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
128+
configmap {
129+
[ "SpecialRelease" ] = "Release",
130+
}
131+
132+
sln2026.projects(wks)
133+
134+
test.capture [[
135+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
136+
<BuildType Solution="SpecialRelease|*" Project="Release" />
137+
</Project>
138+
]]
139+
end
140+
141+
142+
function suite.project_with_platform_configmap()
143+
local wks = workspace "MyWorkspace"
144+
configurations { "Debug", "Release" }
145+
platforms { "x64", "MyPlatform" }
146+
147+
local prj1 = project "MyProject1"
148+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
149+
configmap {
150+
[ "MyPlatform" ] = "x64",
151+
}
152+
153+
sln2026.projects(wks)
154+
155+
test.capture [[
156+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
157+
<Platform Solution="*|MyPlatform" Project="x64" />
158+
</Project>
159+
]]
160+
end
161+
162+
163+
function suite.project_with_platform_and_config_configmap()
164+
local wks = workspace "MyWorkspace"
165+
configurations { "Debug", "Release" }
166+
platforms { "x64", "MyPlatform" }
167+
168+
local prj1 = project "MyProject1"
169+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
170+
configmap {
171+
[ { "Debug", "MyPlatform" } ] = { "Debug", "x64" },
172+
}
173+
174+
sln2026.projects(wks)
175+
176+
test.capture [[
177+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
178+
<Platform Solution="Debug|MyPlatform" Project="x64" />
179+
<BuildType Solution="Debug|MyPlatform" Project="Debug" />
180+
</Project>
181+
]]
182+
end
183+
184+
185+
function suite.project_excluded_from_build()
186+
local wks = workspace "MyWorkspace"
187+
configurations { "Debug", "Release" }
188+
189+
local prj1 = project "MyProject1"
190+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
191+
192+
filter "configurations:Release"
193+
flags { "ExcludeFromBuild" }
194+
195+
filter {}
196+
197+
sln2026.projects(wks)
198+
199+
test.capture [[
200+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
201+
<Build Solution="Release|Win32" Project="false" />
202+
</Project>
203+
]]
204+
end
205+
206+
207+
function suite.project_remove_configuration()
208+
local wks = workspace "MyWorkspace"
209+
configurations { "Debug", "Release" }
210+
211+
local prj1 = project "MyProject1"
212+
uuid "AE61726D-187C-E440-BD07-2556188A6565"
213+
removeconfigurations { "Release" }
214+
215+
sln2026.projects(wks)
216+
217+
test.capture [[
218+
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
219+
<Build Solution="Release|Win32" Project="false" />
220+
</Project>
221+
]]
222+
end

0 commit comments

Comments
 (0)