From 8de456ba8dd9a3d873bfb8bd7fa2de39173a13d4 Mon Sep 17 00:00:00 2001 From: Ben Harper Date: Wed, 23 Oct 2019 15:02:27 +0200 Subject: [PATCH] Add support for VS 2019 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. --- scripts/tundra/ide/msvc-common.lua | 18 ++++++++++++------ scripts/tundra/ide/msvc142.lua | 7 +++++++ scripts/tundra/tools/msvc-vs2019.lua | 8 ++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 scripts/tundra/ide/msvc142.lua create mode 100644 scripts/tundra/tools/msvc-vs2019.lua diff --git a/scripts/tundra/ide/msvc-common.lua b/scripts/tundra/ide/msvc-common.lua index 221c3b06..cb293bc3 100644 --- a/scripts/tundra/ide/msvc-common.lua +++ b/scripts/tundra/ide/msvc-common.lua @@ -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"') @@ -542,11 +544,13 @@ function msvc_generator:generate_project(project, all_projects) p:write('\t', LF) p:write('\t', LF) - if VERSION_YEAR == '2017' then + if VERSION_YEAR == '2019' then + p:write('\t\t16.0', LF) + elseif VERSION_YEAR == '2017' then p:write('\t\t15.0', LF) end p:write('\t\t{', project.Guid, '}', LF) - if VERSION_YEAR == '2017' then + if VERSION_YEAR == '2019' or VERSION_YEAR == '2017' then p:write('\t\tWin32Proj', LF) else p:write('\t\tMakefileProj', LF) @@ -581,13 +585,15 @@ function msvc_generator:generate_project(project, all_projects) p:write('\t\tv140', LF) -- I have no idea what this setting affects elseif VERSION_YEAR == '2017' then p:write('\t\tv141', LF) -- I have no idea what this setting affects + elseif VERSION_YEAR == '2019' then + p:write('\t\tv142', LF) -- I have no idea what this setting affects end p:write('\t', LF) end p:write('\t', 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', LF) p:write('\t\t', LF) diff --git a/scripts/tundra/ide/msvc142.lua b/scripts/tundra/ide/msvc142.lua new file mode 100644 index 00000000..7b239f1a --- /dev/null +++ b/scripts/tundra/ide/msvc142.lua @@ -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") diff --git a/scripts/tundra/tools/msvc-vs2019.lua b/scripts/tundra/tools/msvc-vs2019.lua new file mode 100644 index 00000000..2bb72581 --- /dev/null +++ b/scripts/tundra/tools/msvc-vs2019.lua @@ -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