summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/msvs.py
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Tool/msvs.py')
-rw-r--r--engine/SCons/Tool/msvs.py40
1 files changed, 25 insertions, 15 deletions
diff --git a/engine/SCons/Tool/msvs.py b/engine/SCons/Tool/msvs.py
index 9976d42..afe4bef 100644
--- a/engine/SCons/Tool/msvs.py
+++ b/engine/SCons/Tool/msvs.py
@@ -9,7 +9,7 @@ selection method.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -32,7 +32,7 @@ selection method.
from __future__ import print_function
-__revision__ = "src/engine/SCons/Tool/msvs.py 74b2c53bc42290e911b334a6b44f187da698a668 2017/11/14 13:16:53 bdbaddog"
+__revision__ = "src/engine/SCons/Tool/msvs.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
import SCons.compat
@@ -149,9 +149,9 @@ def splitFully(path):
return [base]
def makeHierarchy(sources):
- '''Break a list of files into a hierarchy; for each value, if it is a string,
+ """Break a list of files into a hierarchy; for each value, if it is a string,
then it is a file. If it is a dictionary, it is a folder. The string is
- the original path of the file.'''
+ the original path of the file."""
hierarchy = {}
for file in sources:
@@ -189,7 +189,7 @@ class _UserGenerator(object):
elif SCons.Util.is_List(env['variant']):
variants = env['variant']
- if 'DebugSettings' not in env or env['DebugSettings'] == None:
+ if 'DebugSettings' not in env or env['DebugSettings'] is None:
dbg_settings = []
elif SCons.Util.is_Dict(env['DebugSettings']):
dbg_settings = [env['DebugSettings']]
@@ -520,7 +520,7 @@ class _DSPGenerator(object):
config.cmdargs = cmdargs
config.runfile = runfile
- match = re.match('(.*)\|(.*)', variant)
+ match = re.match(r'(.*)\|(.*)', variant)
if match:
config.variant = match.group(1)
config.platform = match.group(2)
@@ -1096,12 +1096,17 @@ V10DSPCommandLine = """\
\t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
"""
+V15DSPHeader = """\
+<?xml version="1.0" encoding="%(encoding)s"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+"""
+
class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
"""Generates a Project file for MSVS 2010"""
- def __init__(self, dspfile, source, env):
+ def __init__(self, dspfile, header, source, env):
_DSPGenerator.__init__(self, dspfile, source, env)
- self.dspheader = V10DSPHeader
+ self.dspheader = header
self.dspconfiguration = V10DSPProjectConfiguration
self.dspglobals = V10DSPGlobals
@@ -1287,7 +1292,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
'Other Files': ''}
cats = sorted([k for k in list(categories.keys()) if self.sources[k]],
- key = lambda a: a.lower())
+ key = lambda a: a.lower())
# print vcxproj.filters file first
self.filters_file.write('\t<ItemGroup>\n')
@@ -1423,7 +1428,7 @@ class _GenerateV7DSW(_DSWGenerator):
def AddConfig(self, variant, dswfile=dswfile):
config = Config()
- match = re.match('(.*)\|(.*)', variant)
+ match = re.match(r'(.*)\|(.*)', variant)
if match:
config.variant = match.group(1)
config.platform = match.group(2)
@@ -1501,7 +1506,9 @@ class _GenerateV7DSW(_DSWGenerator):
def PrintSolution(self):
"""Writes a solution file"""
self.file.write('Microsoft Visual Studio Solution File, Format Version %s\n' % self.versionstr)
- if self.version_num >= 12.0:
+ if self.version_num > 14.0:
+ self.file.write('# Visual Studio 15\n')
+ elif self.version_num >= 12.0:
self.file.write('# Visual Studio 14\n')
elif self.version_num >= 11.0:
self.file.write('# Visual Studio 11\n')
@@ -1519,7 +1526,7 @@ class _GenerateV7DSW(_DSWGenerator):
name = base
self.file.write('Project("%s") = "%s", "%s", "%s"\n'
% (external_makefile_guid, name, dspinfo['SLN_RELATIVE_FILE_PATH'], dspinfo['GUID']))
- if self.version_num >= 7.1 and self.version_num < 8.0:
+ if 7.1 <= self.version_num < 8.0:
self.file.write('\tProjectSection(ProjectDependencies) = postProject\n'
'\tEndProjectSection\n')
self.file.write('EndProject\n')
@@ -1679,8 +1686,11 @@ def GenerateDSP(dspfile, source, env):
version_num = 6.0
if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
- if version_num >= 10.0:
- g = _GenerateV10DSP(dspfile, source, env)
+ if version_num > 14.0:
+ g = _GenerateV10DSP(dspfile, V15DSPHeader, source, env)
+ g.Build()
+ elif version_num >= 10.0:
+ g = _GenerateV10DSP(dspfile, V10DSPHeader, source, env)
g.Build()
elif version_num >= 7.0:
g = _GenerateV7DSP(dspfile, source, env)
@@ -1990,7 +2000,7 @@ def generate(env):
env['SCONS_HOME'] = os.environ.get('SCONS_HOME')
def exists(env):
- return msvc_exists()
+ return msvc_exists(env)
# Local Variables:
# tab-width:4