Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/vstudio/_manifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ return {
"vs2015.lua",
"vs2017.lua",
"vs2019.lua",
"vs2022.lua"
"vs2022.lua",
"vs2026_solution.lua",
"vs2026.lua",
}
2 changes: 2 additions & 0 deletions modules/vstudio/_preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
include("vs2017.lua")
include("vs2019.lua")
include("vs2022.lua")
include("vs2026.lua")

-- Initialize Specific API

Expand Down Expand Up @@ -767,5 +768,6 @@
_ACTION == "vs2017" or
_ACTION == "vs2019" or
_ACTION == "vs2022" or
_ACTION == "vs2026" or
false;
end
4 changes: 4 additions & 0 deletions modules/vstudio/tests/_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,8 @@ return {

-- Linux projects
"linux/test_linux_files.lua",

-- Visual Studio 2026+ Solutions
"sln2026/test_configurations.lua",
"sln2026/test_projects.lua",
}
83 changes: 83 additions & 0 deletions modules/vstudio/tests/sln2026/test_configurations.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
--
-- tests/actions/vstudio/sln2026/test_dependencies.lua
-- Validate generation of Visual Studio 2026+ solution project dependencies.
-- Author Nick Clark
-- Copyright (c) 2025 Jess Perkins and the Premake project
--

local p = premake
local suite = test.declare("vstudio_sln2026_dependencies")
local sln2026 = p.vstudio.sln2026


function suite.setup()
p.action.set("vs2026")
end


function suite.solution_header()
sln2026.solution()

test.capture [[
<Solution Description="Visual Studio slnx file generated by Premake" Version="1.4">
]]
end


function suite.default_configurations()
local wks = workspace "MyWorkspace"

sln2026.configurations(wks)

test.capture [[
<Configurations>
</Configurations>
]]
end


function suite.multiple_configurations()
local wks = workspace "MyWorkspace"

configurations { "Debug", "Release" }

sln2026.configurations(wks)

test.capture [[
<Configurations>
<BuildType Name="Debug" />
<BuildType Name="Release" />
<Platform Name="Win32" />
</Configurations>
]]
end


function suite.default_platforms()
local wks = workspace "MyWorkspace"

sln2026.configurations(wks)

test.capture [[
<Configurations>
</Configurations>
]]
end


function suite.multiple_platforms()
local wks = workspace "MyWorkspace"

configurations { "Debug" }
platforms { "x86", "x64" }

sln2026.configurations(wks)

test.capture [[
<Configurations>
<BuildType Name="Debug" />
<Platform Name="Win32" />
<Platform Name="x64" />
</Configurations>
]]
end
222 changes: 222 additions & 0 deletions modules/vstudio/tests/sln2026/test_projects.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
--
-- tests/actions/vstudio/sln2026/test_dependencies.lua
-- Validate generation of Visual Studio 2026+ solution project dependencies.
-- Author Nick Clark
-- Copyright (c) 2025 Jess Perkins and the Premake project
--

local p = premake
local suite = test.declare("vstudio_sln2026_projects")
local sln2026 = p.vstudio.sln2026


function suite.setup()
p.action.set("vs2026")
end


function suite.single_project()
local wks = workspace "MyWorkspace"
local prj = project "MyProject"
uuid "AE61726D-187C-E440-BD07-2556188A6565"

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
</Project>
]]
end


function suite.multiple_projects_no_dependencies()
local wks = workspace "MyWorkspace"

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"

local prj2 = project "MyProject2"
uuid "BE62726D-187C-E440-BD07-2556188A6565"

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
</Project>
<Project Path="MyProject2.vcxproj" Id="BE62726D-187C-E440-BD07-2556188A6565">
</Project>
]]
end


function suite.multiple_projects_with_dependency()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release" }

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
language "C++"
kind "ConsoleApp"

local prj2 = project "MyProject2"
uuid "BE62726D-187C-E440-BD07-2556188A6565"
dependson "MyProject1"
language "C++"
kind "StaticLib"

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
</Project>
<Project Path="MyProject2.vcxproj" Id="BE62726D-187C-E440-BD07-2556188A6565">
<BuildDependency Project="MyProject1.vcxproj" />
</Project>
]]
end

function suite.project_in_groups()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release" }

local grp1 = group "Group1"

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"

sln2026.projects(wks)

test.capture [[
<Folder Name="/Group1/">
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
</Project>
</Folder>
]]
end


function suite.project_with_configmap()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release", "SpecialRelease" }

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
configmap {
[ "Release" ] = "Release",
[ "SpecialRelease" ] = "Release",
[ "Debug" ] = "Debug",
}

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
<BuildType Solution="Debug|*" Project="Debug" />
<BuildType Solution="Release|*" Project="Release" />
<BuildType Solution="SpecialRelease|*" Project="Release" />
</Project>
]]
end


function suite.project_with_single_configmap()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release", "SpecialRelease" }

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
configmap {
[ "SpecialRelease" ] = "Release",
}

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
<BuildType Solution="SpecialRelease|*" Project="Release" />
</Project>
]]
end


function suite.project_with_platform_configmap()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release" }
platforms { "x64", "MyPlatform" }

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
configmap {
[ "MyPlatform" ] = "x64",
}

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
<Platform Solution="*|MyPlatform" Project="x64" />
</Project>
]]
end


function suite.project_with_platform_and_config_configmap()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release" }
platforms { "x64", "MyPlatform" }

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
configmap {
[ { "Debug", "MyPlatform" } ] = { "Debug", "x64" },
}

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
<Platform Solution="Debug|MyPlatform" Project="x64" />
<BuildType Solution="Debug|MyPlatform" Project="Debug" />
</Project>
]]
end


function suite.project_excluded_from_build()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release" }

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"

filter "configurations:Release"
flags { "ExcludeFromBuild" }

filter {}

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
<Build Solution="Release|Win32" Project="false" />
</Project>
]]
end


function suite.project_remove_configuration()
local wks = workspace "MyWorkspace"
configurations { "Debug", "Release" }

local prj1 = project "MyProject1"
uuid "AE61726D-187C-E440-BD07-2556188A6565"
removeconfigurations { "Release" }

sln2026.projects(wks)

test.capture [[
<Project Path="MyProject1.vcxproj" Id="AE61726D-187C-E440-BD07-2556188A6565">
<Build Solution="Release|Win32" Project="false" />
</Project>
]]
end
Loading
Loading