Merge pull request #1980 from LORgames/ssurtees/uwp

Added UWP support for VS projects
This commit is contained in:
Nick Clark 2022-10-12 08:29:31 -04:00 committed by GitHub
commit ff5328c214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 206 additions and 13 deletions

View File

@ -69,6 +69,48 @@ EndGlobalSection
]]
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()
project "MyProject1"
language "C#"

View File

@ -342,6 +342,56 @@ 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
---
@ -399,6 +449,34 @@ 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()
fastuptodate "Off"
prepare()
@ -443,3 +521,17 @@ end
</PropertyGroup>
]]
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
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.
--
@ -146,6 +157,17 @@
]]
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()
kind "ConsoleApp"
flags "NoImportLib"

View File

@ -197,6 +197,7 @@
return {
sln2005.activeCfg,
sln2005.build0,
sln2005.deploy0,
}
end
@ -251,6 +252,13 @@
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.
--

View File

@ -135,6 +135,7 @@
m.windowsTargetPlatformVersion,
m.fastUpToDateCheck,
m.toolsVersion,
m.appContainerApplication,
}
end
@ -1660,6 +1661,13 @@
end
function m.appContainerApplication(prj)
if prj.system == p.UWP then
m.element("AppContainerApplication", nil, "true")
end
end
function m.compileAsManaged(fcfg, condition)
if fcfg.clr and fcfg ~= p.OFF then
m.element("CompileAsManaged", condition, "true")
@ -2094,8 +2102,12 @@
function m.ignoreImportLibrary(cfg)
if cfg.kind == p.SHAREDLIB and cfg.flags.NoImportLib then
m.element("IgnoreImportLibrary", nil, "true")
if cfg.kind == p.SHAREDLIB then
if cfg.flags.NoImportLib then
m.element("IgnoreImportLibrary", nil, "true")
elseif cfg.system == p.UWP then
m.element("IgnoreImportLibrary", nil, "false")
end
end
end
@ -2807,29 +2819,37 @@
end
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 cfg then
local prjVersion = project.systemversion(prj)
if not prjVersion or version == prjVersion then
local prjMinVersion, prjMaxVersion = project.systemversion(prj)
if not prjMinVersion or (minversion == prjMinVersion and maxversion == prjMaxVersion) then
return
end
end
-- 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
version = nil -- SDK v10 is not supported by VS2015
minversion = nil -- SDK v10 is not supported by VS2015
elseif _ACTION == "vs2017" then
version = "$(LatestTargetPlatformVersion)"
minversion = "$(LatestTargetPlatformVersion)"
else
version = "10.0"
minversion = "10.0"
end
end
if version then
m.element("WindowsTargetPlatformVersion", nil, version)
-- Max version is only supported in UWP projects
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

View File

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

View File

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

View File

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

View File

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

View File

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