1#!/usr/bin/python2 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 12import sys, os, subprocess 13 14# Change this to target another VS version. 15target_ide = 'vs2017' 16solution_name = 'ANGLE' 17 18script_dir = os.path.dirname(sys.argv[0]) 19 20# Set the CWD to the root ANGLE folder. 21os.chdir(os.path.join(script_dir, '..')) 22 23out_dir = 'out' 24 25 26# Generate the VS solutions for any valid directory. 27def generate_projects(dirname): 28 args = ['gn.bat', 'gen', dirname, '--ide=' + target_ide, '--sln=' + solution_name] 29 print('Running "' + ' '.join(args) + '"') 30 subprocess.call(args) 31 32 33for potential_dir in os.listdir(out_dir): 34 path = os.path.join(out_dir, potential_dir) 35 build_ninja_d = os.path.join(path, 'build.ninja.d') 36 if os.path.exists(build_ninja_d): 37 generate_projects(path) 38 39# Run the helper utility that merges the projects. 40args = ['python', os.path.join('build', 'win', 'gn_meta_sln.py')] 41print('Running "' + ' '.join(args) + '"') 42subprocess.call(args) 43