return an error if no VS or MSVC is found
[platform/upstream/libSkiaSharp.git] / gn / find_windk.py
1 #!/usr/bin/env python
2 #
3 # Copyright 2016 Google Inc.
4 #
5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file.
7
8 import os
9 import sys
10
11 msvc = int(sys.argv[1])
12
13 editions = [
14   'Community',
15   'Professional',
16   'Enterprise',
17 ]
18
19 if msvc == 2015:
20   # just assume it is installed to the default location
21   print 'C:/Program Files (x86)/Microsoft Visual Studio 14.0'
22 else:
23   # try each of the editions
24   root = 'C:/Program Files (x86)/Microsoft Visual Studio/2017/'
25   for edition in editions:
26     if os.path.exists(root + edition):
27       print root + edition
28       sys.exit(0)
29   sys.exit(1)