OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. 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 pipes | 5 import pipes |
6 | 6 |
7 from recipe_engine.config import config_item_context, ConfigGroup | 7 from recipe_engine.config import config_item_context, ConfigGroup |
8 from recipe_engine.config import Dict, List, Single, Static, Set, BadConf | 8 from recipe_engine.config import Dict, List, Single, Static, Set, BadConf |
9 from recipe_engine.config_types import Path | 9 from recipe_engine.config_types import Path |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 MEMORY_TOOLS = ('memcheck', 'drmemory_full', 'drmemory_light') | 22 MEMORY_TOOLS = ('memcheck', 'drmemory_full', 'drmemory_light') |
23 PROJECT_GENERATORS = ('gyp', 'gn', 'mb') | 23 PROJECT_GENERATORS = ('gyp', 'gn', 'mb') |
24 | 24 |
25 def check(val, potentials): | 25 def check(val, potentials): |
26 assert val in potentials, (val, potentials) | 26 assert val in potentials, (val, potentials) |
27 return val | 27 return val |
28 | 28 |
29 # Schema for config items in this module. | 29 # Schema for config items in this module. |
30 def BaseConfig(HOST_PLATFORM, HOST_ARCH, HOST_BITS, | 30 def BaseConfig(HOST_PLATFORM, HOST_ARCH, HOST_BITS, |
31 TARGET_PLATFORM, TARGET_ARCH, TARGET_BITS, | 31 TARGET_PLATFORM, TARGET_ARCH, TARGET_BITS, |
32 BUILD_CONFIG, TARGET_CROS_BOARD, **_kwargs): | 32 BUILD_CONFIG, TARGET_CROS_BOARD, BUILD_PATH, **_kwargs): |
33 equal_fn = lambda tup: ('%s=%s' % (tup[0], pipes.quote(str(tup[1])))) | 33 equal_fn = lambda tup: ('%s=%s' % (tup[0], pipes.quote(str(tup[1])))) |
34 return ConfigGroup( | 34 return ConfigGroup( |
35 compile_py = ConfigGroup( | 35 compile_py = ConfigGroup( |
36 default_targets = Set(basestring), | 36 default_targets = Set(basestring), |
37 build_args = Single(basestring, required=False), | 37 build_args = Single(basestring, required=False), |
38 build_tool = Single(basestring, required=False), | 38 build_tool = Single(basestring, required=False), |
39 cross_tool = Single(basestring, required=False), | 39 cross_tool = Single(basestring, required=False), |
40 compiler = Single(basestring, required=False), | 40 compiler = Single(basestring, required=False), |
41 mode = Single(basestring, required=False), | 41 mode = Single(basestring, required=False), |
42 goma_dir = Single(Path, required=False), | 42 goma_dir = Single(Path, required=False), |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 HOST_PLATFORM = Static(check(HOST_PLATFORM, HOST_PLATFORMS)), | 104 HOST_PLATFORM = Static(check(HOST_PLATFORM, HOST_PLATFORMS)), |
105 HOST_ARCH = Static(check(HOST_ARCH, HOST_ARCHS)), | 105 HOST_ARCH = Static(check(HOST_ARCH, HOST_ARCHS)), |
106 HOST_BITS = Static(check(HOST_BITS, HOST_TARGET_BITS)), | 106 HOST_BITS = Static(check(HOST_BITS, HOST_TARGET_BITS)), |
107 | 107 |
108 TARGET_PLATFORM = Static(check(TARGET_PLATFORM, TARGET_PLATFORMS)), | 108 TARGET_PLATFORM = Static(check(TARGET_PLATFORM, TARGET_PLATFORMS)), |
109 TARGET_ARCH = Static(check(TARGET_ARCH, TARGET_ARCHS)), | 109 TARGET_ARCH = Static(check(TARGET_ARCH, TARGET_ARCHS)), |
110 TARGET_BITS = Static(check(TARGET_BITS, HOST_TARGET_BITS)), | 110 TARGET_BITS = Static(check(TARGET_BITS, HOST_TARGET_BITS)), |
111 TARGET_CROS_BOARD = Static(TARGET_CROS_BOARD), | 111 TARGET_CROS_BOARD = Static(TARGET_CROS_BOARD), |
112 | 112 |
| 113 BUILD_PATH = Static(BUILD_PATH), |
| 114 |
113 gn_args = List(basestring), | 115 gn_args = List(basestring), |
114 | 116 |
115 lto = Single(bool, empty_val=False, required=False), | 117 lto = Single(bool, empty_val=False, required=False), |
116 ) | 118 ) |
117 | 119 |
118 config_ctx = config_item_context(BaseConfig) | 120 config_ctx = config_item_context(BaseConfig) |
119 | 121 |
120 | 122 |
121 @config_ctx(is_root=True) | 123 @config_ctx(is_root=True) |
122 def BASE(c): | 124 def BASE(c): |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 306 |
305 if not c.compile_py.compiler: | 307 if not c.compile_py.compiler: |
306 c.compile_py.compiler = 'goma' | 308 c.compile_py.compiler = 'goma' |
307 elif c.compile_py.compiler == 'clang': | 309 elif c.compile_py.compiler == 'clang': |
308 c.compile_py.compiler = 'goma-clang' | 310 c.compile_py.compiler = 'goma-clang' |
309 else: # pragma: no cover | 311 else: # pragma: no cover |
310 raise BadConf('goma config doesn\'t understand %s' % c.compile_py.compiler) | 312 raise BadConf('goma config doesn\'t understand %s' % c.compile_py.compiler) |
311 | 313 |
312 c.gyp_env.GYP_DEFINES['use_goma'] = 1 | 314 c.gyp_env.GYP_DEFINES['use_goma'] = 1 |
313 | 315 |
314 goma_dir = Path('[BUILD]', 'goma') | 316 goma_dir = c.BUILD_PATH.join('goma') |
315 c.gyp_env.GYP_DEFINES['gomadir'] = goma_dir | 317 c.gyp_env.GYP_DEFINES['gomadir'] = goma_dir |
316 c.compile_py.goma_dir = goma_dir | 318 c.compile_py.goma_dir = goma_dir |
317 | 319 |
318 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang': | 320 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang': |
319 fastbuild(c) | 321 fastbuild(c) |
320 pch(c, invert=True) | 322 pch(c, invert=True) |
321 | 323 |
322 @config_ctx() | 324 @config_ctx() |
323 def pch(c, invert=False): | 325 def pch(c, invert=False): |
324 if c.TARGET_PLATFORM == 'win': | 326 if c.TARGET_PLATFORM == 'win': |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 def internal_gles2_conform_tests(c): | 795 def internal_gles2_conform_tests(c): |
794 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 | 796 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 |
795 | 797 |
796 @config_ctx() | 798 @config_ctx() |
797 def build_angle_deqp_tests(c): | 799 def build_angle_deqp_tests(c): |
798 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 | 800 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 |
799 | 801 |
800 @config_ctx() | 802 @config_ctx() |
801 def force_mac_toolchain(c): | 803 def force_mac_toolchain(c): |
802 c.env.FORCE_MAC_TOOLCHAIN = 1 | 804 c.env.FORCE_MAC_TOOLCHAIN = 1 |
OLD | NEW |