blob: 864db094a3a3c8784bce3bf5ec69efcf753bcc35 [file] [log] [blame]
Hal Canaryf72728e2019-07-10 11:24:52 -04001#!/usr/bin/env python
2# Copyright 2019 Google Inc.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import os
7import sys
8
9'''
10Look for the first match in the format
11 C:\\Program Files (x86)\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC
12'''
13def find_msvc():
14 if sys.platform.startswith('win'):
15 default_dir = r'C:\Program Files (x86)\Microsoft Visual Studio'
16 for release in ['2019', '2017']:
17 for version in ['Enterprise', 'Professional', 'Community', 'BuildTools']:
18 path = os.path.join(default_dir, release, version, 'VC')
19 if os.path.isdir(path):
20 return path
21 return None
22
23if __name__ == '__main__':
24 result = find_msvc()
25 if result:
26 sys.stdout.write(result + '\n')