Skip to content

Commit

Permalink
Add support for VS 2019
Browse files Browse the repository at this point in the history
One thing of interest is that when VS 2019 produces a solution (.sln)
file, it gives it this version heading:

Microsoft Visual Studio Solution File, Format Version 12.00

The other IDE generation files such as msvc141.lua emit higher numbers
than 12 (eg msvc141.lua emits 14.0). VS 2019 refuses to open .sln files
with numbers higher than 14.00, but it seems unlikely that the versions
between 12 to 14 make any difference. I've made the 2019 version 12.00,
for consistency with the native values produced by the IDE, but I'm not
sure if this is correct.
  • Loading branch information
bmharper committed Oct 23, 2019
1 parent 5ae273e commit 8de456b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
18 changes: 12 additions & 6 deletions scripts/tundra/ide/msvc-common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,11 @@ function msvc_generator:generate_project(project, all_projects)
p:write(' DefaultTargets="Build"')

-- This doesn't seem to change any behaviour, but this is the default
-- value when creating a makefile project from VS2013, VS2015 and VS2017
-- wizards.
if VERSION_YEAR == '2017' then
-- value when creating a makefile project from VS2013, VS2015, VS2017,
-- and VS2019 wizards.
if VERSION_YEAR == '2019' then
p:write(' ToolsVersion="16.0"')
elseif VERSION_YEAR == '2017' then
p:write(' ToolsVersion="15.0"')
elseif VERSION_YEAR == '2015' then
p:write(' ToolsVersion="14.0"')
Expand All @@ -542,11 +544,13 @@ function msvc_generator:generate_project(project, all_projects)
p:write('\t</ItemGroup>', LF)

p:write('\t<PropertyGroup Label="Globals">', LF)
if VERSION_YEAR == '2017' then
if VERSION_YEAR == '2019' then
p:write('\t\t<VCProjectVersion>16.0</VCProjectVersion>', LF)
elseif VERSION_YEAR == '2017' then
p:write('\t\t<VCProjectVersion>15.0</VCProjectVersion>', LF)
end
p:write('\t\t<ProjectGuid>{', project.Guid, '}</ProjectGuid>', LF)
if VERSION_YEAR == '2017' then
if VERSION_YEAR == '2019' or VERSION_YEAR == '2017' then
p:write('\t\t<Keyword>Win32Proj</Keyword>', LF)
else
p:write('\t\t<Keyword>MakefileProj</Keyword>', LF)
Expand Down Expand Up @@ -581,13 +585,15 @@ function msvc_generator:generate_project(project, all_projects)
p:write('\t\t<PlatformToolset>v140</PlatformToolset>', LF) -- I have no idea what this setting affects
elseif VERSION_YEAR == '2017' then
p:write('\t\t<PlatformToolset>v141</PlatformToolset>', LF) -- I have no idea what this setting affects
elseif VERSION_YEAR == '2019' then
p:write('\t\t<PlatformToolset>v142</PlatformToolset>', LF) -- I have no idea what this setting affects
end
p:write('\t</PropertyGroup>', LF)
end

p:write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />', LF)

if VERSION_YEAR == '2017' then
if VERSION_YEAR == '2019' or VERSION_YEAR == '2017' then
for _, tuple in ipairs(self.config_tuples) do
p:write('\t<ImportGroup Label="PropertySheets" Condition="\'$(Configuration)|$(Platform)\'==\'', tuple.MsvcName, '\'">', LF)
p:write('\t\t<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists(\'$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props\')" Label="LocalAppDataPlatform" />', LF)
Expand Down
7 changes: 7 additions & 0 deletions scripts/tundra/ide/msvc142.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- Microsoft Visual Studio 2019 Solution/Project file generation

module(..., package.seeall)

local msvc_common = require "tundra.ide.msvc-common"

msvc_common.setup("12.00", "2019")
8 changes: 8 additions & 0 deletions scripts/tundra/tools/msvc-vs2019.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

module(..., package.seeall)

local vscommon = require "tundra.tools.msvc-vscommon-next"

function apply(env, options)
vscommon.apply_msvc_visual_studio("2019", env, options)
end

0 comments on commit 8de456b

Please sign in to comment.