Added VS2022, v143 default, unit tests

This commit is contained in:
Nick Clark 2021-08-30 22:00:13 -05:00
parent b3de107f4c
commit e3c2f78f46
5 changed files with 135 additions and 2 deletions

View File

@ -24,5 +24,6 @@ return {
"vs2013_vcxitems.lua",
"vs2015.lua",
"vs2017.lua",
"vs2019.lua"
"vs2019.lua",
"vs2022.lua"
}

View File

@ -21,6 +21,7 @@
include("vs2015.lua")
include("vs2017.lua")
include("vs2019.lua")
include("vs2022.lua")
-- Initialize Specific API

View File

@ -101,5 +101,8 @@ return {
-- Visual Studio 2019+ C/C++ Projects
"vc2019/test_compile_settings.lua",
"vc2019/test_link.lua",
"vc2019/test_toolset_settings.lua"
"vc2019/test_toolset_settings.lua",
-- Visual Studio 2022+ C/C++ Projects
"vc2022/test_toolset_settings.lua"
}

View File

@ -0,0 +1,59 @@
--
-- tests/actions/vstudio/vc2010/test_compile_settings.lua
-- Validate compiler settings in Visual Studio 2022 C/C++ projects.
-- Copyright (c) 2011-2021 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_vs2022_toolset_settings")
local vc2010 = p.vstudio.vc2010
local project = p.project
--
-- Setup
--
local wks, prj
function suite.setup()
p.action.set("vs2022")
wks, prj = test.createWorkspace()
end
local function prepare(platform)
local cfg = test.getconfig(prj, "Debug", platform)
vc2010.configurationProperties(cfg)
end
---
-- Check the default project settings
---
function suite.defaultSettings()
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
]]
end
---
-- Check the project settings with the clang toolset
---
function suite.toolsetClang()
toolset "clang"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>ClangCL</PlatformToolset>
</PropertyGroup>
]]
end

View File

@ -0,0 +1,69 @@
--
-- vs2022.lua
-- Extend the existing exporters with support for Visual Studio 2022.
-- Copyright (c) Jason Perkins and the Premake project
--
local p = premake
local vstudio = p.vstudio
---
-- Define the Visual Studio 2019 export action.
---
newaction {
-- Metadata for the command line and help system
trigger = "vs2022",
shortname = "Visual Studio 2022",
description = "Generate Visual Studio 2022 project files",
-- Visual Studio always uses Windows path and naming conventions
targetos = "windows",
toolset = "msc-v143",
-- The capabilities of this action
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None", "Utility", "SharedItems" },
valid_languages = { "C", "C++", "C#", "F#" },
valid_tools = {
cc = { "msc", "clang" },
dotnet = { "msnet" },
},
-- Workspace and project generation logic
onWorkspace = function(wks)
p.vstudio.vs2005.generateSolution(wks)
end,
onProject = function(prj)
p.vstudio.vs2010.generateProject(prj)
end,
onRule = function(rule)
p.vstudio.vs2010.generateRule(rule)
end,
onCleanWorkspace = function(wks)
p.vstudio.cleanSolution(wks)
end,
onCleanProject = function(prj)
p.vstudio.cleanProject(prj)
end,
onCleanTarget = function(prj)
p.vstudio.cleanTarget(prj)
end,
pathVars = vstudio.vs2010.pathVars,
-- This stuff is specific to the Visual Studio exporters
vstudio = {
solutionVersion = "12",
versionName = "Version 16",
targetFramework = "4.7.2",
toolsVersion = "15.0",
userToolsVersion = "Current",
filterToolsVersion = "4.0",
}
}