Skip to content

Commit

Permalink
C: Add support for Visual Studio 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
jjensen committed Jul 2, 2019
1 parent 68482fa commit 366bbd6
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 6 deletions.
13 changes: 13 additions & 0 deletions bin/modules/c/toolchain/vc/detect.jam
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

rule FindVisualStudioHelper VERSION : COMPILER {
switch $(VERSION) {
case vs2019 :
local pf = $(ProgramFiles(x86):J=" ") ;
VS150COMNTOOLS = "$(pf)/Microsoft Visual Studio/2019/Community/Common7/Tools" ;
if [ Glob $(VS150COMNTOOLS) : VsDevCmd.bat ] {
MSVCNT = $(VS150COMNTOOLS) ;
}
if $(MSVCNT) {
MSVCNT_BIN_PATH = @(../Common7/IDE:R=$(MSVCNT)) ;
local dirs = [ Glob @(..\\..\\VC\\Tools\\MSVC:R=$(MSVCNT)) : * ] ;
MSVCNT = $(dirs[1]) ;
COMPILER = vs2019 ;
}

case vs2017 :
local pf = $(ProgramFiles(x86):J=" ") ;
VS150COMNTOOLS = "$(pf)/Microsoft Visual Studio/2017/Community/Common7/Tools" ;
Expand Down
27 changes: 27 additions & 0 deletions bin/modules/c/toolchain/vc/win32.jam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ rule C.Toolchain.vc.win32.Detect COMPILER {
local RC ;
local rc_nologo ;
switch $(COMPILER) {
case vs2019 :
local key = HKEY_LOCAL_MACHINE SOFTWARE Microsoft "Windows Kits" "Installed Roots" KitsRoot10 ;
MSSDK10 = [ W32_GETREG $(key) ] ;
key = HKEY_LOCAL_MACHINE SOFTWARE Microsoft "Windows Kits" "Installed Roots" KitsRoot10 ;
MSSDK = [ W32_GETREG $(key) ] ;
MSSDK ?= $(MSVCNT) ;
MSSDK_BINDIR = "$(MSSDK)/bin/x86" ;
local dirs = [ Glob $(MSSDK)/Include : */ ] ;
local MSSDK_VERSION = $(dirs[1]:P) ;
MSSDK_VERSION = $(MSSDK_VERSION:D=) ;
MSSDK_STDHDRS =
$(MSVCNT)/include
$(MSVCNT)/../../../Auxiliary/VS/include
$(MSSDK)/Include/$(MSSDK_VERSION)/ucrt
$(MSSDK)/Include/$(MSSDK_VERSION)/um
$(MSSDK)/Include/$(MSSDK_VERSION)/shared
$(MSSDK)/Include/$(MSSDK_VERSION)/winrt
;
MSSDK_LINKDIRECTORIES =
$(MSVCNT)/lib/x86
$(MSSDK)/lib/$(MSSDK_VERSION)/ucrt/x64
$(MSSDK)/lib/$(MSSDK_VERSION)/um/x64
;
MSVCBIN = "$(MSVCNT)/bin/HostX86/x86/" ;
RC = $(MSSDK)/bin/x86/rc ;
rc_nologo = /nologo ;

case vs2017 :
local key = HKEY_LOCAL_MACHINE SOFTWARE Microsoft "Windows Kits" "Installed Roots" KitsRoot10 ;
MSSDK10 = [ W32_GETREG $(key) ] ;
Expand Down
27 changes: 27 additions & 0 deletions bin/modules/c/toolchain/vc/win64.jam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ rule C.Toolchain.vc.win64.Detect COMPILER {
local RC ;
local rc_nologo ;
switch $(COMPILER) {
case vs2019 :
local key = HKEY_LOCAL_MACHINE SOFTWARE Microsoft "Windows Kits" "Installed Roots" KitsRoot10 ;
MSSDK10 = [ W32_GETREG $(key) ] ;
key = HKEY_LOCAL_MACHINE SOFTWARE Microsoft "Windows Kits" "Installed Roots" KitsRoot10 ;
MSSDK = [ W32_GETREG $(key) ] ;
MSSDK ?= $(MSVCNT) ;
MSSDK_BINDIR = "$(MSSDK)/bin/x64" ;
local dirs = [ Glob $(MSSDK)/Include : */ ] ;
local MSSDK_VERSION = $(dirs[1]:P) ;
MSSDK_VERSION = $(MSSDK_VERSION:D=) ;
MSSDK_STDHDRS =
$(MSVCNT)/include
$(MSVCNT)/../../../Auxiliary/VS/include
$(MSSDK)/Include/$(MSSDK_VERSION)/ucrt
$(MSSDK)/Include/$(MSSDK_VERSION)/um
$(MSSDK)/Include/$(MSSDK_VERSION)/shared
$(MSSDK)/Include/$(MSSDK_VERSION)/winrt
;
MSSDK_LINKDIRECTORIES =
$(MSVCNT)/lib/x64
$(MSSDK)/lib/$(MSSDK_VERSION)/ucrt/x64
$(MSSDK)/lib/$(MSSDK_VERSION)/um/x64
;
MSVCBIN = "$(MSVCNT)/bin/HostX64/x64/" ;
RC = $(MSSDK)/bin/x64/rc ;
rc_nologo = /nologo ;

case vs2017 :
local key = HKEY_LOCAL_MACHINE SOFTWARE Microsoft "Windows Kits" "Installed Roots" KitsRoot10 ;
MSSDK10 = [ W32_GETREG $(key) ] ;
Expand Down
2 changes: 1 addition & 1 deletion bin/modules/c/toolchain/win32.jam
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rule C.Toolchain.win32.* {
C.ToolchainSpecKeys C.PLATFORM/PLATFORM C.CONFIG/CONFIG ;

if $(C.COMPILER) {
if $(C.COMPILER) in vs2017 vs2015 vs2013 vs2012 vs2010 vs2008 vs2005 vs2003 vc6 {
if $(C.COMPILER) in vs2019 vs2017 vs2015 vs2013 vs2012 vs2010 vs2008 vs2005 vs2003 vc6 {
if ! [ C.Toolchain.vc.$(C.PLATFORM).Detect $(C.COMPILER) : force ] {
return ;
}
Expand Down
2 changes: 1 addition & 1 deletion bin/modules/c/toolchain/win64.jam
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rule C.Toolchain.win64.* {
C.ToolchainSpecKeys C.PLATFORM/PLATFORM C.CONFIG/CONFIG ;

if $(C.COMPILER) {
if $(C.COMPILER) in vs2017 vs2015 vs2013 vs2012 vs2010 vs2008 vs2005 vs2003 vc6 {
if $(C.COMPILER) in vs2019 vs2017 vs2015 vs2013 vs2012 vs2010 vs2008 vs2005 vs2003 vc6 {
if ! [ C.Toolchain.vc.$(C.PLATFORM).Detect $(C.COMPILER) : force ] {
return ;
}
Expand Down
15 changes: 15 additions & 0 deletions bin/scripts/JamToWorkspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jamPath = ospath.simplify(ospath.make_absolute(scriptPath .. '../'))

Compilers =
{
{ 'vs2019', 'Visual Studio 2019' },
{ 'vs2017', 'Visual Studio 2017' },
{ 'vs2015', 'Visual Studio 2015' },
{ 'vs2013', 'Visual Studio 2013' },
Expand Down Expand Up @@ -388,6 +389,7 @@ require 'ide/vs2012'
require 'ide/vs2013'
require 'ide/vs2015'
require 'ide/vs2017'
require 'ide/vs2019'
require 'ide/codeblocks'
require 'ide/xcode'

Expand Down Expand Up @@ -527,6 +529,19 @@ Exporters =
}
},

vs2019 =
{
Initialize = VisualStudio201xInitialize,
ProjectExporter = VisualStudio201xProject,
WorkspaceExporter = VisualStudio201xSolution,
Shutdown = VisualStudio201xShutdown,
Description = 'Generate Visual Studio 2019 solutions and projects.',
Options =
{
vs2019 = true,
}
},

codeblocks =
{
Initialize = CodeBlocksInitialize,
Expand Down
31 changes: 27 additions & 4 deletions bin/scripts/ide/helper/vs201x.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,12 @@ function VisualStudio201xProjectMetaTable:WriteHelper(outputPath, commandLines,
end

-- Write header.
if self.Options.vs2017 then
if self.Options.vs2019 then
table.insert(self.Contents, expand([[
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="16.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
]]))
elseif self.Options.vs2017 then
table.insert(self.Contents, expand([[
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Expand Down Expand Up @@ -200,9 +205,16 @@ function VisualStudio201xProjectMetaTable:WriteHelper(outputPath, commandLines,
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>$(Uuid)</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
]], extraInfo, info))
elseif self.Options.vs2019 then
table.insert(self.Contents, expand([[
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<ProjectGuid>$(Uuid)</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
]], extraInfo, info))
end
if not self.Options.vs2017 then
if not self.Options.vs2017 and not self.Options.vs2019 then
table.insert(self.Contents, expand([[
<PropertyGroup Label="Globals">
<ProjectGUID>$(Uuid)</ProjectGUID>
Expand Down Expand Up @@ -351,13 +363,17 @@ function VisualStudio201xProjectMetaTable:WriteHelper(outputPath, commandLines,
self.Contents[#self.Contents + 1] = [[
<PlatformToolset>v120</PlatformToolset>
]]
elseif self.Options.vs2015 or self.Options.vs2017 then
elseif self.Options.vs2015 or self.Options.vs2017 or self.Options.vs2019 then
if androidApplication then
self.Contents[#self.Contents + 1] = [[
<PlatformToolset>Clang_3_8</PlatformToolset>
]]
else
if self.Options.vs2017 then
if self.Options.vs2019 then
self.Contents[#self.Contents + 1] = [[
<PlatformToolset>v142</PlatformToolset>
]]
elseif self.Options.vs2017 then
self.Contents[#self.Contents + 1] = [[
<PlatformToolset>v141</PlatformToolset>
]]
Expand Down Expand Up @@ -649,6 +665,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.4
MinimumVisualStudioVersion = 10.0.40219.1
]])
elseif self.Options.vs2019 then
table.insert(self.Contents, [[
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 16
VisualStudioVersion = 16.0.29029.237
MinimumVisualStudioVersion = 10.0.40219.1
]])
end

Expand Down
1 change: 1 addition & 0 deletions bin/scripts/ide/vs2019.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(__JAM_SCRIPTS_PATH)/ide/helper/vs201x.jam ;
1 change: 1 addition & 0 deletions bin/scripts/ide/vs2019.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'ide/helper/vs201x'
15 changes: 15 additions & 0 deletions src/jmakehelper.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ REM Setup 64-bit aware registry location

IF NOT "%ProgramFiles(x86)%"=="" SET WOW6432NODE=WOW6432NODE\

REM Test for Visual Studio 2019

if %VERBOSE% == 1 echo.Checking Visual Studio 2019

set COMNTOOLS=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\
if exist "%COMNTOOLS%vcvars32.bat" (
set VS=2019
set COMNTOOLS="%COMNTOOLS%vcvars32.bat"
goto :foundenv
)
set COMNTOOLS=

if %VERBOSE% == 1 echo ...done

REM Test for Visual Studio 2017

if %VERBOSE% == 1 echo.Checking Visual Studio 2017
Expand Down Expand Up @@ -151,6 +165,7 @@ if %COMNTOOLS% == "" (
if %VERBOSE% == 1 echo.Found Visual Studio %VS%
if %VERBOSE% == 1 echo.

echo "%COMNTOOLS%"
call %COMNTOOLS%

:end
Expand Down

0 comments on commit 366bbd6

Please sign in to comment.