diff --git a/modules/vstudio/tests/sln2005/test_platforms.lua b/modules/vstudio/tests/sln2005/test_platforms.lua index a9d693b7..ffd68abe 100644 --- a/modules/vstudio/tests/sln2005/test_platforms.lua +++ b/modules/vstudio/tests/sln2005/test_platforms.lua @@ -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#" diff --git a/modules/vstudio/tests/vc2010/test_globals.lua b/modules/vstudio/tests/vc2010/test_globals.lua index fe2bb956..a6542567 100644 --- a/modules/vstudio/tests/vc2010/test_globals.lua +++ b/modules/vstudio/tests/vc2010/test_globals.lua @@ -342,6 +342,56 @@ end end + function suite.windowsTargetPlatformVersion_latest_on2019_onUWP() + system "uwp" + p.action.set("vs2019") + systemversion "latest" + prepare() + test.capture [[ + + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + true + 10.0 + true + + ]] + end + + + function suite.windowsTargetPlatformVersion_latestToLatest_on2019_onUWP() + system "uwp" + p.action.set("vs2019") + systemversion "latest:latest" + prepare() + test.capture [[ + + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + true + 10.0 + 10.0 + true + + ]] + 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 [[ + + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + true + 10.0.10240.0 + 10.0.10240.1 + true + + ]] + 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 [[ + + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + true + 10.0.10240.0 + true + + + 10.0.10240.0 + 10.0 + + + 10.0.10240.0 + 10.0.10240.1 + + ]] + end + + function suite.disableFastUpToDateCheck() fastuptodate "Off" prepare() @@ -443,3 +521,17 @@ end ]] end + + + function suite.appContainerApplication2019UWP() + system "uwp" + p.action.set("vs2019") + prepare() + test.capture [[ + + {42B5DBC6-AE1F-903D-F75D-41E363076E92} + true + true + + ]] + end diff --git a/modules/vstudio/tests/vc2010/test_output_props.lua b/modules/vstudio/tests/vc2010/test_output_props.lua index eec855c6..9ab61b83 100644 --- a/modules/vstudio/tests/vc2010/test_output_props.lua +++ b/modules/vstudio/tests/vc2010/test_output_props.lua @@ -100,6 +100,17 @@ ]] end + function suite.outDir_onTargetDirUWP() + system "uwp" + targetdir "../bin" + prepare() + test.capture [[ + + true + ..\bin\ + ]] + end + -- -- The objeccts directory is applied, if specified. -- @@ -146,6 +157,17 @@ ]] end + function suite.ignoreImportLib_onUWP() + system "uwp" + kind "SharedLib" + prepare() + test.capture [[ + + true + false + ]] + end + function suite.omitIgnoreImportLib_onNonSharedLib() kind "ConsoleApp" flags "NoImportLib" diff --git a/modules/vstudio/vs2005_solution.lua b/modules/vstudio/vs2005_solution.lua index 740ea1be..ea1c7016 100644 --- a/modules/vstudio/vs2005_solution.lua +++ b/modules/vstudio/vs2005_solution.lua @@ -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. -- diff --git a/modules/vstudio/vs2010_vcxproj.lua b/modules/vstudio/vs2010_vcxproj.lua index 8df673f7..76450c4a 100644 --- a/modules/vstudio/vs2010_vcxproj.lua +++ b/modules/vstudio/vs2010_vcxproj.lua @@ -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 diff --git a/premake5.lua b/premake5.lua index db787a13..f9f2c8bb 100644 --- a/premake5.lua +++ b/premake5.lua @@ -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" diff --git a/src/_premake_init.lua b/src/_premake_init.lua index 6055eefb..370c7391 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -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" }, } } diff --git a/src/base/_foundation.lua b/src/base/_foundation.lua index ae4102ef..6c2413f1 100644 --- a/src/base/_foundation.lua +++ b/src/base/_foundation.lua @@ -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" diff --git a/src/base/os.lua b/src/base/os.lua index c0296dca..60df4bd6 100644 --- a/src/base/os.lua +++ b/src/base/os.lua @@ -801,6 +801,7 @@ ["linux"] = { "linux", "posix" }, ["macosx"] = { "macosx", "darwin", "posix" }, ["solaris"] = { "solaris", "posix" }, + ["uwp"] = { "uwp", "windows" }, ["windows"] = { "windows", "win32" }, } diff --git a/website/docs/system.md b/website/docs/system.md index 65a8e046..a45d6a1c 100644 --- a/website/docs/system.md +++ b/website/docs/system.md @@ -18,6 +18,7 @@ If no system is specified, Premake will identify and target the current operatin * linux * macosx * solaris +* uwp * wii * windows * xbox360