skia2/gn/find_msvc.py
Hal Canary f72728e3f1 documentation/build, BUILDCONFIG: Visual Studio Build Tools 2019
deprecate 2015

Docs-Preview: https://skia.org/?cl=226502
Change-Id: I32cd75937ebdc774138499c4cd79c1eda29bd0f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226502
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-07-12 14:17:16 +00:00

27 lines
776 B
Python

#!/usr/bin/env python
# Copyright 2019 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
'''
Look for the first match in the format
C:\\Program Files (x86)\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC
'''
def find_msvc():
if sys.platform.startswith('win'):
default_dir = r'C:\Program Files (x86)\Microsoft Visual Studio'
for release in ['2019', '2017']:
for version in ['Enterprise', 'Professional', 'Community', 'BuildTools']:
path = os.path.join(default_dir, release, version, 'VC')
if os.path.isdir(path):
return path
return None
if __name__ == '__main__':
result = find_msvc()
if result:
sys.stdout.write(result + '\n')