Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 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 os.path | 7 import os.path |
8 import re | 8 import re |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1291 pass | 1291 pass |
1292 return open(path, mode) | 1292 return open(path, mode) |
1293 | 1293 |
1294 | 1294 |
1295 def GenerateOutputForConfig(target_list, target_dicts, data, params, | 1295 def GenerateOutputForConfig(target_list, target_dicts, data, params, |
1296 config_name): | 1296 config_name): |
1297 options = params['options'] | 1297 options = params['options'] |
1298 flavor = gyp.common.GetFlavor(params) | 1298 flavor = gyp.common.GetFlavor(params) |
1299 generator_flags = params.get('generator_flags', {}) | 1299 generator_flags = params.get('generator_flags', {}) |
1300 | 1300 |
1301 # generator_dir: relative path from pwd to where make puts build files. | |
thakis
2012/10/02 05:32:47
# This is only to make migrating from make to ninj
bungeman of chrome
2012/10/02 05:51:48
Done.
| |
1302 generator_dir = os.path.relpath(params['options'].generator_output or '.') | |
1303 | |
1304 # output_dir: relative path from generator_dir to the build directory. | |
1305 output_dir = generator_flags.get('output_dir', 'out') | |
1306 | |
1301 # build_dir: relative path from source root to our output files. | 1307 # build_dir: relative path from source root to our output files. |
1302 # e.g. "out/Debug" | 1308 # e.g. "out/Debug" |
1303 build_dir = gyp.common.RelativePath( | 1309 build_dir = os.path.normpath(os.path.join(generator_dir, |
1304 os.path.normpath(os.path.join(params['options'].generator_output or '.', | 1310 output_dir, |
1305 generator_flags.get('output_dir', 'out'), | 1311 config_name)) |
1306 config_name)), | |
1307 options.toplevel_dir) | |
1308 | 1312 |
1309 toplevel_build = os.path.join(options.toplevel_dir, build_dir) | 1313 toplevel_build = os.path.join(options.toplevel_dir, build_dir) |
1310 | 1314 |
1311 master_ninja = ninja_syntax.Writer( | 1315 master_ninja = ninja_syntax.Writer( |
1312 OpenOutput(os.path.join(toplevel_build, 'build.ninja')), | 1316 OpenOutput(os.path.join(toplevel_build, 'build.ninja')), |
1313 width=120) | 1317 width=120) |
1314 case_sensitive_filesystem = not os.path.exists( | 1318 case_sensitive_filesystem = not os.path.exists( |
1315 os.path.join(toplevel_build, 'BUILD.NINJA')) | 1319 os.path.join(toplevel_build, 'BUILD.NINJA')) |
1316 | 1320 |
1317 # Put build-time support tools in out/{config_name}. | 1321 # Put build-time support tools in out/{config_name}. |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1734 def GenerateOutput(target_list, target_dicts, data, params): | 1738 def GenerateOutput(target_list, target_dicts, data, params): |
1735 user_config = params.get('generator_flags', {}).get('config', None) | 1739 user_config = params.get('generator_flags', {}).get('config', None) |
1736 if user_config: | 1740 if user_config: |
1737 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1741 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1738 user_config) | 1742 user_config) |
1739 else: | 1743 else: |
1740 config_names = target_dicts[target_list[0]]['configurations'].keys() | 1744 config_names = target_dicts[target_list[0]]['configurations'].keys() |
1741 for config_name in config_names: | 1745 for config_name in config_names: |
1742 GenerateOutputForConfig(target_list, target_dicts, data, params, | 1746 GenerateOutputForConfig(target_list, target_dicts, data, params, |
1743 config_name) | 1747 config_name) |
LEFT | RIGHT |