Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VS2022 support #536

Merged
merged 1 commit into from
Oct 19, 2021
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ of Premake 4.4 beta 5, and there is no intention to keep it compatible with it.
- Added support for generating Switch/NX32 Switch/NX64 projects.
- Removed FASTBuild.
- Removed Qbs support.
- Added vs2022 support.

build - GENie build system scripts
----------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/_manifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"actions/vstudio/vs2015.lua",
"actions/vstudio/vs2017.lua",
"actions/vstudio/vs2019.lua",
"actions/vstudio/vs2022.lua",

-- Xcode action
"actions/xcode/_xcode.lua",
Expand Down
1 change: 1 addition & 0 deletions src/actions/vstudio/_vstudio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
vs2015 = "v140",
vs2017 = "v141",
vs2019 = "v142",
vs2022 = "v143",
}
premake.vstudio.toolset = toolsets[_ACTION] or "unknown?"
premake.vstudio.splashpath = ''
Expand Down
64 changes: 64 additions & 0 deletions src/actions/vstudio/vs2022.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
--
-- vs2022.lua
-- Baseline support for Visual Studio 2022.
--

premake.vstudio.vc2022 = {}
local vc2022 = premake.vstudio.vc2022
local vstudio = premake.vstudio


---
-- Register a command-line action for Visual Studio 2022.
---

newaction
{
trigger = "vs2022",
shortname = "Visual Studio 2022",
description = "Generate Microsoft Visual Studio 2022 project files",
os = "windows",

valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Bundle" },

valid_languages = { "C", "C++", "C#" },

valid_tools = {
cc = { "msc" },
dotnet = { "msnet" },
},

onsolution = function(sln)
premake.generate(sln, "%%.sln", vstudio.sln2005.generate)
end,

onproject = function(prj)
if premake.isdotnetproject(prj) then
premake.generate(prj, "%%.csproj", vstudio.cs2005.generate)
premake.generate(prj, "%%.csproj.user", vstudio.cs2005.generate_user)
else
premake.vstudio.needAppxManifest = false
premake.generate(prj, "%%.vcxproj", premake.vs2010_vcxproj)
premake.generate(prj, "%%.vcxproj.user", premake.vs2010_vcxproj_user)
premake.generate(prj, "%%.vcxproj.filters", vstudio.vc2010.generate_filters)

if premake.vstudio.needAppxManifest then
premake.generate(prj, "%%/Package.appxmanifest", premake.vs2010_appxmanifest)
end
end
end,


oncleansolution = premake.vstudio.cleansolution,
oncleanproject = premake.vstudio.cleanproject,
oncleantarget = premake.vstudio.cleantarget,

vstudio = {
solutionVersion = "12",
targetFramework = "4.7.2",
toolsVersion = "16.0",
windowsTargetPlatformVersion = "10.0",
supports64bitEditContinue = true,
intDirAbsolute = false,
}
}
10 changes: 6 additions & 4 deletions src/actions/vstudio/vstudio_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@
, premake.esc(cfginfo.name))

local is2019 = premake.action.current() == premake.action.get("vs2019")
if is2019 then
local is2022 = premake.action.current() == premake.action.get("vs2022")
if is2019 or is2022 then
_p(2, '<VCProjectVersion>%s</VCProjectVersion>', action.vstudio.toolsVersion)
if cfg.flags.UnitySupport then
_p(2, '<EnableUnitySupport>true</EnableUnitySupport>')
Expand Down Expand Up @@ -340,7 +341,7 @@

end

local function cppstandard_vs2017_or_2019(cfg)
local function cppstandard(cfg)
if cfg.flags.CppLatest then
_p(3, '<LanguageStandard>stdcpplatest</LanguageStandard>')
_p(3, '<EnableModules>true</EnableModules>')
Expand Down Expand Up @@ -665,8 +666,9 @@
end

if premake.action.current() == premake.action.get("vs2017") or
premake.action.current() == premake.action.get("vs2019") then
cppstandard_vs2017_or_2019(cfg)
premake.action.current() == premake.action.get("vs2019") or
premake.action.current() == premake.action.get("vs2022") then
cppstandard(cfg)
end

exceptions(cfg)
Expand Down
Loading