Frank Henigman | dda048c | 2018-01-11 20:09:09 -0500 | [diff] [blame^] | 1 | #!/usr/bin/python2 |
Jamie Madill | 54118be | 2017-10-24 09:20:14 -0400 | [diff] [blame] | 2 | # |
| 3 | # Copyright 2017 The ANGLE Project Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | # |
| 7 | # msvs_projects.py: |
| 8 | # A helper utility that generates Visual Studio projects for each of |
| 9 | # the available directories in 'out', and then runs another helper |
| 10 | # utility that merges these projects into one solution. |
| 11 | |
| 12 | import sys, os, subprocess |
| 13 | |
| 14 | # Change this to target another VS version. |
| 15 | target_ide = 'vs2017' |
| 16 | solution_name = 'ANGLE' |
| 17 | |
| 18 | script_dir = os.path.dirname(sys.argv[0]) |
| 19 | |
| 20 | # Set the CWD to the root ANGLE folder. |
| 21 | os.chdir(os.path.join(script_dir, '..')) |
| 22 | |
| 23 | out_dir = 'out' |
| 24 | |
| 25 | # Generate the VS solutions for any valid directory. |
| 26 | def generate_projects(dirname): |
| 27 | args = ['gn.bat', 'gen', dirname, '--ide=' + target_ide, '--sln=' + solution_name] |
| 28 | print('Running "' + ' '.join(args) + '"') |
| 29 | subprocess.call(args) |
| 30 | |
| 31 | for potential_dir in os.listdir(out_dir): |
| 32 | path = os.path.join(out_dir, potential_dir) |
| 33 | build_ninja_d = os.path.join(path, 'build.ninja.d') |
| 34 | if os.path.exists(build_ninja_d): |
| 35 | generate_projects(path) |
| 36 | |
| 37 | # Run the helper utility that merges the projects. |
| 38 | args = ['python', os.path.join('build', 'win', 'gn_meta_sln.py')] |
| 39 | print('Running "' + ' '.join(args) + '"') |
Frank Henigman | dda048c | 2018-01-11 20:09:09 -0500 | [diff] [blame^] | 40 | subprocess.call(args) |