Merge pull request #1258 from CosmicRey/master
Added support for Visual Studio 2019 solutions
This commit is contained in:
commit
53dfe1e19d
@ -23,7 +23,8 @@
|
||||
|
||||
premake.action._list["vs2015"].valid_kinds = table.join(premake.action._list["vs2015"].valid_kinds, { p.ANDROIDPROJ })
|
||||
premake.action._list["vs2017"].valid_kinds = table.join(premake.action._list["vs2017"].valid_kinds, { p.ANDROIDPROJ })
|
||||
|
||||
premake.action._list["vs2019"].valid_kinds = table.join(premake.action._list["vs2019"].valid_kinds, { p.ANDROIDPROJ })
|
||||
|
||||
local osoption = p.option.get("os")
|
||||
if osoption ~= nil then
|
||||
table.insert(osoption.allowed, { "android", "Android" })
|
||||
|
@ -21,7 +21,7 @@
|
||||
-- Patch the vstudio actions with D support...
|
||||
--
|
||||
|
||||
for k,v in pairs({ "vs2005", "vs2008", "vs2010", "vs2012", "vs2013", "vs2015", "vs2017" }) do
|
||||
for k,v in pairs({ "vs2005", "vs2008", "vs2010", "vs2012", "vs2013", "vs2015", "vs2017", "vs2019" }) do
|
||||
local vs = p.action.get(v)
|
||||
if vs ~= nil then
|
||||
table.insert( vs.valid_languages, p.D )
|
||||
|
@ -23,4 +23,5 @@ return {
|
||||
"vs2013.lua",
|
||||
"vs2015.lua",
|
||||
"vs2017.lua",
|
||||
"vs2019.lua"
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
include("vs2013.lua")
|
||||
include("vs2015.lua")
|
||||
include("vs2017.lua")
|
||||
include("vs2019.lua")
|
||||
|
||||
-- Initialize Specific API
|
||||
|
||||
@ -146,5 +147,7 @@
|
||||
_ACTION == "vs2012" or
|
||||
_ACTION == "vs2013" or
|
||||
_ACTION == "vs2015" or
|
||||
_ACTION == "vs2017";
|
||||
_ACTION == "vs2017" or
|
||||
_ACTION == "vs2019" or
|
||||
false;
|
||||
end
|
||||
|
@ -153,7 +153,24 @@
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.onVs2019()
|
||||
p.action.set("vs2019")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- Framework Tests
|
||||
--
|
||||
|
@ -90,6 +90,15 @@
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.on2019()
|
||||
p.action.set("vs2019")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
@ -153,6 +153,24 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onVs2019()
|
||||
p.action.set("vs2019")
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AE61726D-187C-E440-BD07-2556188A6565}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<AssemblyName>MyProject</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onVs2015_462()
|
||||
p.action.set("vs2015")
|
||||
|
@ -1133,6 +1133,21 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onLanguage_Cpp14_VS2019()
|
||||
p.action.set("vs2019")
|
||||
|
||||
cppdialect 'C++14'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<LanguageStandard>stdcpp14</LanguageStandard>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onLanguage_Cpp17_VS2010()
|
||||
cppdialect 'C++17'
|
||||
prepare()
|
||||
@ -1175,6 +1190,21 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onLanguage_Cpp17_VS2019()
|
||||
p.action.set("vs2019")
|
||||
|
||||
cppdialect 'C++17'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onLanguage_CppLatest_VS2010()
|
||||
cppdialect 'C++latest'
|
||||
prepare()
|
||||
@ -1217,6 +1247,21 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.onLanguage_CppLatest_VS2019()
|
||||
p.action.set("vs2019")
|
||||
|
||||
cppdialect 'C++latest'
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||
</ClCompile>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check StaticLib SymbolsPath
|
||||
--
|
||||
|
@ -277,6 +277,22 @@
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.windowsTargetPlatformVersionLatest_on2019()
|
||||
p.action.set("vs2019")
|
||||
systemversion "latest"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
--
|
||||
-- Check that the "latest" systemversion will not add <WindowsTargetPlatformVersion>
|
||||
-- when the action is less than 2017
|
||||
@ -343,4 +359,4 @@
|
||||
</PropertyGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
@ -37,3 +37,11 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.project_on2019()
|
||||
p.action.set("vs2019")
|
||||
vc2010.project()
|
||||
test.capture [[
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
]]
|
||||
end
|
||||
|
@ -222,6 +222,16 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateDebugInfo_onSymbolsFull_on2019()
|
||||
p.action.set("vs2019")
|
||||
symbols "Full"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- Test the handling of the SymbolsPath flag.
|
||||
--
|
||||
@ -361,6 +371,20 @@
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.generateProgramDatabaseFile_onSymbolsFull_on2019()
|
||||
p.action.set("vs2019")
|
||||
symbols "Full"
|
||||
symbolspath "$(IntDir)$(TargetName).pdb"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||
<ImportLibrary>bin\Debug\MyProject.lib</ImportLibrary>
|
||||
<ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
</Link>
|
||||
]]
|
||||
end
|
||||
--
|
||||
-- Any system libraries specified in links() should be listed as
|
||||
-- additional dependencies.
|
||||
|
@ -63,8 +63,12 @@
|
||||
|
||||
function m.project(prj)
|
||||
local action = p.action.current()
|
||||
p.push('<Project DefaultTargets="Build" ToolsVersion="%s" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">',
|
||||
action.vstudio.toolsVersion)
|
||||
if _ACTION >= "vs2019" then
|
||||
p.push('<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">')
|
||||
else
|
||||
p.push('<Project DefaultTargets="Build" ToolsVersion="%s" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">',
|
||||
action.vstudio.toolsVersion)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -2507,7 +2511,13 @@
|
||||
-- handle special "latest" version
|
||||
if min == "latest" then
|
||||
-- vs2015 and lower can't build against SDK 10
|
||||
min = iif(_ACTION >= "vs2017", m.latestSDK10Version(), nil)
|
||||
-- vs2019 allows for automatic assignment to latest
|
||||
-- Windows 10 sdk if you set to "10.0"
|
||||
if _ACTION >= "vs2019" then
|
||||
min = "10.0"
|
||||
else
|
||||
min = iif(_ACTION == "vs2017", m.latestSDK10Version(), nil)
|
||||
end
|
||||
end
|
||||
|
||||
return min
|
||||
|
@ -55,7 +55,7 @@
|
||||
function m.userProject()
|
||||
local action = p.action.current()
|
||||
p.push('<Project ToolsVersion="%s" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">',
|
||||
action.vstudio.toolsVersion)
|
||||
action.vstudio.userToolsVersion or action.vstudio.toolsVersion)
|
||||
end
|
||||
|
||||
|
||||
|
69
modules/vstudio/vs2019.lua
Normal file
69
modules/vstudio/vs2019.lua
Normal file
@ -0,0 +1,69 @@
|
||||
--
|
||||
-- vs2019.lua
|
||||
-- Extend the existing exporters with support for Visual Studio 2019.
|
||||
-- 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 = "vs2019",
|
||||
shortname = "Visual Studio 2019",
|
||||
description = "Generate Visual Studio 2019 project files",
|
||||
|
||||
-- Visual Studio always uses Windows path and naming conventions
|
||||
|
||||
targetos = "windows",
|
||||
toolset = "msc-v142",
|
||||
|
||||
-- The capabilities of this action
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None", "Utility" },
|
||||
valid_languages = { "C", "C++", "C#", "F#" },
|
||||
valid_tools = {
|
||||
cc = { "msc" },
|
||||
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 = "16",
|
||||
targetFramework = "4.7.2",
|
||||
toolsVersion = "15.0",
|
||||
userToolsVersion = "Current",
|
||||
filterToolsVersion = "4.0",
|
||||
}
|
||||
}
|
@ -151,6 +151,7 @@ if kind == "source" then
|
||||
execQuiet("premake5 /to=build/vs2013 vs2013")
|
||||
execQuiet("premake5 /to=build/vs2015 vs2015")
|
||||
execQuiet("premake5 /to=build/vs2017 vs2017")
|
||||
execQuiet("premake5 /to=build/vs2019 vs2019")
|
||||
execQuiet("premake5 /to=build/gmake.windows /os=windows gmake")
|
||||
execQuiet("premake5 /to=build/gmake.unix /os=linux gmake")
|
||||
execQuiet("premake5 /to=build/gmake.macosx /os=macosx gmake")
|
||||
|
Reference in New Issue
Block a user