@@ -84,6 +84,10 @@ def SetupScript(self, target_arch):
84
84
# vcvars32, which it can only find if VS??COMNTOOLS is set, which it
85
85
# isn't always.
86
86
if target_arch == 'x86' :
87
+ if self .short_name == '2017' :
88
+ return [os .path .normpath (
89
+ os .path .join (self .path , 'Common7/Tools/VsDevCmd.bat' )), '/no_logo' ,
90
+ '/arch=x86' ]
87
91
if self .short_name >= '2013' and self .short_name [- 1 ] != 'e' and (
88
92
os .environ .get ('PROCESSOR_ARCHITECTURE' ) == 'AMD64' or
89
93
os .environ .get ('PROCESSOR_ARCHITEW6432' ) == 'AMD64' ):
@@ -96,6 +100,10 @@ def SetupScript(self, target_arch):
96
100
os .path .join (self .path , 'Common7/Tools/vsvars32.bat' ))]
97
101
else :
98
102
assert target_arch == 'x64'
103
+ if self .short_name == '2017' :
104
+ return [os .path .normpath (
105
+ os .path .join (self .path , 'Common7/Tools/VsDevCmd.bat' )), '/no_logo' ,
106
+ '/arch=x64' ]
99
107
arg = 'x86_amd64'
100
108
# Use the 64-on-64 compiler if we're not using an express
101
109
# edition and we're running on a 64bit OS.
@@ -226,6 +234,15 @@ def _CreateVersion(name, path, sdk_based=False):
226
234
if path :
227
235
path = os .path .normpath (path )
228
236
versions = {
237
+ '2017' : VisualStudioVersion ('2017' ,
238
+ 'Visual Studio 2017' ,
239
+ solution_version = '12.00' ,
240
+ project_version = '14.0' ,
241
+ flat_sln = False ,
242
+ uses_vcxproj = True ,
243
+ path = path ,
244
+ sdk_based = sdk_based ,
245
+ default_toolset = 'v141' ),
229
246
'2015' : VisualStudioVersion ('2015' ,
230
247
'Visual Studio 2015' ,
231
248
solution_version = '12.00' ,
@@ -346,6 +363,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
346
363
2012(e) - Visual Studio 2012 (11)
347
364
2013(e) - Visual Studio 2013 (12)
348
365
2015 - Visual Studio 2015 (14)
366
+ 2017 - Visual Studio 2017 (15)
349
367
Where (e) is e for express editions of MSVS and blank otherwise.
350
368
"""
351
369
version_to_year = {
@@ -355,6 +373,7 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
355
373
'11.0' : '2012' ,
356
374
'12.0' : '2013' ,
357
375
'14.0' : '2015' ,
376
+ '15.0' : '2017' ,
358
377
}
359
378
versions = []
360
379
for version in versions_to_check :
@@ -395,6 +414,17 @@ def _DetectVisualStudioVersions(versions_to_check, force_express):
395
414
versions .append (_CreateVersion (version_to_year [version ] + 'e' ,
396
415
os .path .join (path , '..' ), sdk_based = True ))
397
416
417
+ if version == '15.0' :
418
+ # The VC++ 2017 install location needs to be located using COM instead of
419
+ # the registry. For details see:
420
+ # https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/
421
+ # For now we use a hardcoded default with an environment variable
422
+ # override.
423
+ path = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional'
424
+ path = os .environ .get ('vs2017_install' , path )
425
+ if os .path .exists (path ):
426
+ versions .append (_CreateVersion ('2017' , path ))
427
+
398
428
return versions
399
429
400
430
@@ -410,7 +440,7 @@ def SelectVisualStudioVersion(version='auto', allow_fallback=True):
410
440
if version == 'auto' :
411
441
version = os .environ .get ('GYP_MSVS_VERSION' , 'auto' )
412
442
version_map = {
413
- 'auto' : ('14.0' , '12.0' , '10.0' , '9.0' , '8.0' , '11.0' ),
443
+ 'auto' : ('15.0' , ' 14.0' , '12.0' , '10.0' , '9.0' , '8.0' , '11.0' ),
414
444
'2005' : ('8.0' ,),
415
445
'2005e' : ('8.0' ,),
416
446
'2008' : ('9.0' ,),
@@ -422,6 +452,7 @@ def SelectVisualStudioVersion(version='auto', allow_fallback=True):
422
452
'2013' : ('12.0' ,),
423
453
'2013e' : ('12.0' ,),
424
454
'2015' : ('14.0' ,),
455
+ '2017' : ('15.0' ,),
425
456
}
426
457
override_path = os .environ .get ('GYP_MSVS_OVERRIDE_PATH' )
427
458
if override_path :
0 commit comments