OLD | NEW |
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 Google Inc. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import copy | 5 import copy |
6 import hashlib | 6 import hashlib |
7 import json | 7 import json |
8 import multiprocessing | 8 import multiprocessing |
9 import os.path | 9 import os.path |
10 import re | 10 import re |
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 flavor = gyp.common.GetFlavor(params) | 1649 flavor = gyp.common.GetFlavor(params) |
1650 generator_flags = params.get('generator_flags', {}) | 1650 generator_flags = params.get('generator_flags', {}) |
1651 | 1651 |
1652 # build_dir: relative path from source root to our output files. | 1652 # build_dir: relative path from source root to our output files. |
1653 # e.g. "out/Debug" | 1653 # e.g. "out/Debug" |
1654 build_dir = os.path.normpath( | 1654 build_dir = os.path.normpath( |
1655 os.path.join(ComputeOutputDir(params), config_name)) | 1655 os.path.join(ComputeOutputDir(params), config_name)) |
1656 | 1656 |
1657 toplevel_build = os.path.join(options.toplevel_dir, build_dir) | 1657 toplevel_build = os.path.join(options.toplevel_dir, build_dir) |
1658 | 1658 |
1659 master_ninja = ninja_syntax.Writer( | 1659 master_ninja_file = OpenOutput(os.path.join(toplevel_build, 'build.ninja')) |
1660 OpenOutput(os.path.join(toplevel_build, 'build.ninja')), | 1660 master_ninja = ninja_syntax.Writer(master_ninja_file, width=120) |
1661 width=120) | |
1662 | 1661 |
1663 # Put build-time support tools in out/{config_name}. | 1662 # Put build-time support tools in out/{config_name}. |
1664 gyp.common.CopyTool(flavor, toplevel_build) | 1663 gyp.common.CopyTool(flavor, toplevel_build) |
1665 | 1664 |
1666 # Grab make settings for CC/CXX. | 1665 # Grab make settings for CC/CXX. |
1667 # The rules are | 1666 # The rules are |
1668 # - The priority from low to high is gcc/g++, the 'make_global_settings' in | 1667 # - The priority from low to high is gcc/g++, the 'make_global_settings' in |
1669 # gyp, the environment variable. | 1668 # gyp, the environment variable. |
1670 # - If there is no 'make_global_settings' for CC.host/CXX.host or | 1669 # - If there is no 'make_global_settings' for CC.host/CXX.host or |
1671 # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set | 1670 # 'CC_host'/'CXX_host' enviroment variable, cc_host/cxx_host should be set |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 master_ninja.comment('Short names for targets.') | 2090 master_ninja.comment('Short names for targets.') |
2092 for short_name in target_short_names: | 2091 for short_name in target_short_names: |
2093 master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in | 2092 master_ninja.build(short_name, 'phony', [x.FinalOutput() for x in |
2094 target_short_names[short_name]]) | 2093 target_short_names[short_name]]) |
2095 | 2094 |
2096 if all_outputs: | 2095 if all_outputs: |
2097 master_ninja.newline() | 2096 master_ninja.newline() |
2098 master_ninja.build('all', 'phony', list(all_outputs)) | 2097 master_ninja.build('all', 'phony', list(all_outputs)) |
2099 master_ninja.default(generator_flags.get('default_target', 'all')) | 2098 master_ninja.default(generator_flags.get('default_target', 'all')) |
2100 | 2099 |
| 2100 master_ninja_file.close() |
| 2101 |
2101 | 2102 |
2102 def PerformBuild(data, configurations, params): | 2103 def PerformBuild(data, configurations, params): |
2103 options = params['options'] | 2104 options = params['options'] |
2104 for config in configurations: | 2105 for config in configurations: |
2105 builddir = os.path.join(options.toplevel_dir, 'out', config) | 2106 builddir = os.path.join(options.toplevel_dir, 'out', config) |
2106 arguments = ['ninja', '-C', builddir] | 2107 arguments = ['ninja', '-C', builddir] |
2107 print 'Building [%s]: %s' % (config, arguments) | 2108 print 'Building [%s]: %s' % (config, arguments) |
2108 subprocess.check_call(arguments) | 2109 subprocess.check_call(arguments) |
2109 | 2110 |
2110 | 2111 |
(...skipping 30 matching lines...) Expand all Loading... |
2141 arglists.append( | 2142 arglists.append( |
2142 (target_list, target_dicts, data, params, config_name)) | 2143 (target_list, target_dicts, data, params, config_name)) |
2143 pool.map(CallGenerateOutputForConfig, arglists) | 2144 pool.map(CallGenerateOutputForConfig, arglists) |
2144 except KeyboardInterrupt, e: | 2145 except KeyboardInterrupt, e: |
2145 pool.terminate() | 2146 pool.terminate() |
2146 raise e | 2147 raise e |
2147 else: | 2148 else: |
2148 for config_name in config_names: | 2149 for config_name in config_names: |
2149 GenerateOutputForConfig(target_list, target_dicts, data, params, | 2150 GenerateOutputForConfig(target_list, target_dicts, data, params, |
2150 config_name) | 2151 config_name) |
OLD | NEW |