Skip to content

Commit

Permalink
fall back to vswhere.exe to find msvc
Browse files Browse the repository at this point in the history
Change-Id: I5cba7406522479c05dc5148357eed31d105a31fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275876
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
  • Loading branch information
vejmartin authored and Skia Commit-Bot committed Mar 8, 2020
1 parent 475b9d0 commit c569504
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gn/find_msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os
import sys
import subprocess

'''
Look for the first match in the format
Expand All @@ -18,6 +19,17 @@ def find_msvc():
path = os.path.join(default_dir, release, version, 'VC')
if os.path.isdir(path):
return path

# Fall back to vswhere.exe to determine non-standard installation paths
# Fixed location, https://github.com/Microsoft/vswhere/wiki/Installing
vswhere = os.path.join(os.getenv('ProgramFiles(x86)'),
'Microsoft Visual Studio', 'Installer', 'vswhere.exe')
command = (vswhere + ' -prerelease -legacy -products * -sort -utf8 '
'-property installationPath')
paths = subprocess.check_output(command).decode('utf-8').splitlines()
if paths:
return paths[0] + '\\VC'

return None

if __name__ == '__main__':
Expand Down

0 comments on commit c569504

Please sign in to comment.