Skip to content

Commit c569504

Browse files
vejmartinSkia Commit-Bot
authored and
Skia Commit-Bot
committed
fall back to vswhere.exe to find msvc
Change-Id: I5cba7406522479c05dc5148357eed31d105a31fd Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275876 Reviewed-by: Brian Osman <[email protected]> Reviewed-by: Mike Klein <[email protected]> Commit-Queue: Mike Klein <[email protected]>
1 parent 475b9d0 commit c569504

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

gn/find_msvc.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import os
77
import sys
8+
import subprocess
89

910
'''
1011
Look for the first match in the format
@@ -18,6 +19,17 @@ def find_msvc():
1819
path = os.path.join(default_dir, release, version, 'VC')
1920
if os.path.isdir(path):
2021
return path
22+
23+
# Fall back to vswhere.exe to determine non-standard installation paths
24+
# Fixed location, https://github.com/Microsoft/vswhere/wiki/Installing
25+
vswhere = os.path.join(os.getenv('ProgramFiles(x86)'),
26+
'Microsoft Visual Studio', 'Installer', 'vswhere.exe')
27+
command = (vswhere + ' -prerelease -legacy -products * -sort -utf8 '
28+
'-property installationPath')
29+
paths = subprocess.check_output(command).decode('utf-8').splitlines()
30+
if paths:
31+
return paths[0] + '\\VC'
32+
2133
return None
2234

2335
if __name__ == '__main__':

0 commit comments

Comments
 (0)