Added UWP support for VS projects

This commit is contained in:
Sam Surtees 2022-10-09 15:52:06 +10:00
parent 7d241a6d98
commit 2a2feac1c9
10 changed files with 206 additions and 13 deletions

View File

@ -69,6 +69,48 @@ EndGlobalSection
]] ]]
end end
function suite.DeployConsoleApp_onUWP()
project "MyProject"
kind "ConsoleApp"
system "uwp"
prepare()
test.capture [[
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.Build.0 = Debug|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.Deploy.0 = Debug|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Build.0 = Release|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Deploy.0 = Release|Win32
EndGlobalSection
]]
end
function suite.DeployWindowedApp_onUWP()
project "MyProject"
kind "WindowedApp"
system "uwp"
prepare()
test.capture [[
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.ActiveCfg = Debug|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.Build.0 = Debug|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Debug|Win32.Deploy.0 = Debug|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.ActiveCfg = Release|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Build.0 = Release|Win32
{C9135098-6047-8142-B10E-D27E7F73FCB3}.Release|Win32.Deploy.0 = Release|Win32
EndGlobalSection
]]
end
function suite.onMixedLanguage_noPlatforms_noArchs() function suite.onMixedLanguage_noPlatforms_noArchs()
project "MyProject1" project "MyProject1"
language "C#" language "C#"

View File

@ -342,6 +342,56 @@ end
end end
function suite.windowsTargetPlatformVersion_latest_on2019_onUWP()
system "uwp"
p.action.set("vs2019")
systemversion "latest"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<AppContainerApplication>true</AppContainerApplication>
</PropertyGroup>
]]
end
function suite.windowsTargetPlatformVersion_latestToLatest_on2019_onUWP()
system "uwp"
p.action.set("vs2019")
systemversion "latest:latest"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<WindowsTargetPlatformMinVersion>10.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<AppContainerApplication>true</AppContainerApplication>
</PropertyGroup>
]]
end
function suite.windowsTargetPlatformVersion_versionToVersion_on2019_onUWP()
system "uwp"
p.action.set("vs2019")
systemversion "10.0.10240.0:10.0.10240.1"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0.10240.1</WindowsTargetPlatformVersion>
<AppContainerApplication>true</AppContainerApplication>
</PropertyGroup>
]]
end
--- ---
-- Check handling of per-configuration systemversion -- Check handling of per-configuration systemversion
--- ---
@ -399,6 +449,34 @@ end
end end
function suite.windowsTargetPlatformVersion_perConfig_on2019_onUWP()
system "uwp"
p.action.set("vs2019")
systemversion "10.0.10240.0"
filter "Debug"
systemversion "10.0.10240.0:latest"
filter "Release"
systemversion "10.0.10240.0:10.0.10240.1"
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
<AppContainerApplication>true</AppContainerApplication>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Globals">
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Globals">
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
<WindowsTargetPlatformVersion>10.0.10240.1</WindowsTargetPlatformVersion>
</PropertyGroup>
]]
end
function suite.disableFastUpToDateCheck() function suite.disableFastUpToDateCheck()
fastuptodate "Off" fastuptodate "Off"
prepare() prepare()
@ -443,3 +521,17 @@ end
</PropertyGroup> </PropertyGroup>
]] ]]
end end
function suite.appContainerApplication2019UWP()
system "uwp"
p.action.set("vs2019")
prepare()
test.capture [[
<PropertyGroup Label="Globals">
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
<AppContainerApplication>true</AppContainerApplication>
</PropertyGroup>
]]
end

View File

@ -100,6 +100,17 @@
]] ]]
end end
function suite.outDir_onTargetDirUWP()
system "uwp"
targetdir "../bin"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>..\bin\</OutDir>
]]
end
-- --
-- The objeccts directory is applied, if specified. -- The objeccts directory is applied, if specified.
-- --
@ -146,6 +157,17 @@
]] ]]
end end
function suite.ignoreImportLib_onUWP()
system "uwp"
kind "SharedLib"
prepare()
test.capture [[
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IgnoreImportLibrary>false</IgnoreImportLibrary>
]]
end
function suite.omitIgnoreImportLib_onNonSharedLib() function suite.omitIgnoreImportLib_onNonSharedLib()
kind "ConsoleApp" kind "ConsoleApp"
flags "NoImportLib" flags "NoImportLib"

View File

@ -197,6 +197,7 @@
return { return {
sln2005.activeCfg, sln2005.activeCfg,
sln2005.build0, sln2005.build0,
sln2005.deploy0,
} }
end end
@ -251,6 +252,13 @@
end end
end end
function sln2005.deploy0(cfg, context)
if context.prjCfg.system == p.UWP and not context.excluded and (context.prjCfg.kind == p.WINDOWEDAPP or context.prjCfg.kind == p.CONSOLEAPP) then
p.w('{%s}.%s.Deploy.0 = %s|%s', context.prj.uuid, context.descriptor, context.platform, context.architecture)
end
end
-- --
-- Write out the tables that map solution configurations to project configurations. -- Write out the tables that map solution configurations to project configurations.
-- --

View File

@ -135,6 +135,7 @@
m.windowsTargetPlatformVersion, m.windowsTargetPlatformVersion,
m.fastUpToDateCheck, m.fastUpToDateCheck,
m.toolsVersion, m.toolsVersion,
m.appContainerApplication,
} }
end end
@ -1638,6 +1639,13 @@
end end
function m.appContainerApplication(prj)
if prj.system == p.UWP then
m.element("AppContainerApplication", nil, "true")
end
end
function m.compileAsManaged(fcfg, condition) function m.compileAsManaged(fcfg, condition)
if fcfg.clr and fcfg ~= p.OFF then if fcfg.clr and fcfg ~= p.OFF then
m.element("CompileAsManaged", condition, "true") m.element("CompileAsManaged", condition, "true")
@ -2065,8 +2073,12 @@
function m.ignoreImportLibrary(cfg) function m.ignoreImportLibrary(cfg)
if cfg.kind == p.SHAREDLIB and cfg.flags.NoImportLib then if cfg.kind == p.SHAREDLIB then
m.element("IgnoreImportLibrary", nil, "true") if cfg.flags.NoImportLib then
m.element("IgnoreImportLibrary", nil, "true")
elseif cfg.system == p.UWP then
m.element("IgnoreImportLibrary", nil, "false")
end
end end
end end
@ -2778,29 +2790,37 @@
end end
local target = cfg or prj local target = cfg or prj
local version = project.systemversion(target) local minversion, maxversion = project.systemversion(target)
-- if this is a config, only emit if different from project -- if this is a config, only emit if different from project
if cfg then if cfg then
local prjVersion = project.systemversion(prj) local prjMinVersion, prjMaxVersion = project.systemversion(prj)
if not prjVersion or version == prjVersion then if not prjMinVersion or (minversion == prjMinVersion and maxversion == prjMaxVersion) then
return return
end end
end end
-- See https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html -- See https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html
if version == "latest" then if minversion == "latest" then
if _ACTION == "vs2015" then if _ACTION == "vs2015" then
version = nil -- SDK v10 is not supported by VS2015 minversion = nil -- SDK v10 is not supported by VS2015
elseif _ACTION == "vs2017" then elseif _ACTION == "vs2017" then
version = "$(LatestTargetPlatformVersion)" minversion = "$(LatestTargetPlatformVersion)"
else else
version = "10.0" minversion = "10.0"
end end
end end
if version then -- Max version is only supported in UWP projects
m.element("WindowsTargetPlatformVersion", nil, version) if maxversion == "latest" then
maxversion = "10.0"
end
if maxversion and target.system == p.UWP then
m.element("WindowsTargetPlatformMinVersion", nil, minversion)
m.element("WindowsTargetPlatformVersion", nil, maxversion)
elseif minversion then
m.element("WindowsTargetPlatformVersion", nil, minversion)
end end
end end

View File

@ -133,7 +133,7 @@
configurations { "Release", "Debug" } configurations { "Release", "Debug" }
location ( _OPTIONS["to"] ) location ( _OPTIONS["to"] )
flags { "StaticRuntime", "MultiProcessorCompile" } flags { "MultiProcessorCompile" }
warnings "Extra" warnings "Extra"
if not _OPTIONS["no-zlib"] then if not _OPTIONS["no-zlib"] then
@ -190,6 +190,10 @@
filter { "system:windows", "configurations:Release", "toolset:not mingw" } filter { "system:windows", "configurations:Release", "toolset:not mingw" }
flags { "LinkTimeOptimization" } flags { "LinkTimeOptimization" }
filter { "system:uwp" }
systemversion "latest:latest"
consumewinrtextension "false"
project "Premake5" project "Premake5"
targetname "premake5" targetname "premake5"
language "C" language "C"

View File

@ -511,7 +511,7 @@
"NoEditAndContinue", -- DEPRECATED "NoEditAndContinue", -- DEPRECATED
"NoFramePointer", -- DEPRECATED "NoFramePointer", -- DEPRECATED
"NoImplicitLink", "NoImplicitLink",
"NoImportLib", "NoImportLib", -- DEPRECATED
"NoIncrementalLink", "NoIncrementalLink",
"NoManifest", "NoManifest",
"NoMinimalRebuild", "NoMinimalRebuild",
@ -1203,6 +1203,7 @@
"linux", "linux",
"macosx", "macosx",
"solaris", "solaris",
"uwp",
"wii", "wii",
"windows", "windows",
}, },
@ -1849,6 +1850,7 @@
{ "linux", "Linux" }, { "linux", "Linux" },
{ "macosx", "Apple Mac OS X" }, { "macosx", "Apple Mac OS X" },
{ "solaris", "Solaris" }, { "solaris", "Solaris" },
{ "uwp", "Microsoft Univesral Windows Platform"},
{ "windows", "Microsoft Windows" }, { "windows", "Microsoft Windows" },
} }
} }

View File

@ -54,6 +54,7 @@
premake.UNICODE = "Unicode" premake.UNICODE = "Unicode"
premake.UNIVERSAL = "universal" premake.UNIVERSAL = "universal"
premake.UTILITY = "Utility" premake.UTILITY = "Utility"
premake.UWP = "uwp"
premake.PACKAGING = "Packaging" premake.PACKAGING = "Packaging"
premake.WINDOWEDAPP = "WindowedApp" premake.WINDOWEDAPP = "WindowedApp"
premake.WINDOWS = "windows" premake.WINDOWS = "windows"

View File

@ -801,6 +801,7 @@
["linux"] = { "linux", "posix" }, ["linux"] = { "linux", "posix" },
["macosx"] = { "macosx", "darwin", "posix" }, ["macosx"] = { "macosx", "darwin", "posix" },
["solaris"] = { "solaris", "posix" }, ["solaris"] = { "solaris", "posix" },
["uwp"] = { "uwp", "windows" },
["windows"] = { "windows", "win32" }, ["windows"] = { "windows", "win32" },
} }

View File

@ -18,6 +18,7 @@ If no system is specified, Premake will identify and target the current operatin
* linux * linux
* macosx * macosx
* solaris * solaris
* uwp
* wii * wii
* windows * windows
* xbox360 * xbox360