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, BUILD_PATH, **_kwargs): | 32 BUILD_CONFIG, TARGET_CROS_BOARD, **_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 | |
115 gn_args = List(basestring), | 113 gn_args = List(basestring), |
116 | 114 |
117 lto = Single(bool, empty_val=False, required=False), | 115 lto = Single(bool, empty_val=False, required=False), |
118 ) | 116 ) |
119 | 117 |
120 config_ctx = config_item_context(BaseConfig) | 118 config_ctx = config_item_context(BaseConfig) |
121 | 119 |
122 | 120 |
123 @config_ctx(is_root=True) | 121 @config_ctx(is_root=True) |
124 def BASE(c): | 122 def BASE(c): |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 304 |
307 if not c.compile_py.compiler: | 305 if not c.compile_py.compiler: |
308 c.compile_py.compiler = 'goma' | 306 c.compile_py.compiler = 'goma' |
309 elif c.compile_py.compiler == 'clang': | 307 elif c.compile_py.compiler == 'clang': |
310 c.compile_py.compiler = 'goma-clang' | 308 c.compile_py.compiler = 'goma-clang' |
311 else: # pragma: no cover | 309 else: # pragma: no cover |
312 raise BadConf('goma config doesn\'t understand %s' % c.compile_py.compiler) | 310 raise BadConf('goma config doesn\'t understand %s' % c.compile_py.compiler) |
313 | 311 |
314 c.gyp_env.GYP_DEFINES['use_goma'] = 1 | 312 c.gyp_env.GYP_DEFINES['use_goma'] = 1 |
315 | 313 |
316 goma_dir = c.BUILD_PATH.join('goma') | 314 goma_dir = Path('[BUILD]', 'goma') |
317 c.gyp_env.GYP_DEFINES['gomadir'] = goma_dir | 315 c.gyp_env.GYP_DEFINES['gomadir'] = goma_dir |
318 c.compile_py.goma_dir = goma_dir | 316 c.compile_py.goma_dir = goma_dir |
319 | 317 |
320 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang': | 318 if c.TARGET_PLATFORM == 'win' and c.compile_py.compiler != 'goma-clang': |
321 fastbuild(c) | 319 fastbuild(c) |
322 pch(c, invert=True) | 320 pch(c, invert=True) |
323 | 321 |
324 @config_ctx() | 322 @config_ctx() |
325 def pch(c, invert=False): | 323 def pch(c, invert=False): |
326 if c.TARGET_PLATFORM == 'win': | 324 if c.TARGET_PLATFORM == 'win': |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 def internal_gles2_conform_tests(c): | 793 def internal_gles2_conform_tests(c): |
796 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 | 794 c.gyp_env.GYP_DEFINES['internal_gles2_conform_tests'] = 1 |
797 | 795 |
798 @config_ctx() | 796 @config_ctx() |
799 def build_angle_deqp_tests(c): | 797 def build_angle_deqp_tests(c): |
800 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 | 798 c.gyp_env.GYP_DEFINES['build_angle_deqp_tests'] = 1 |
801 | 799 |
802 @config_ctx() | 800 @config_ctx() |
803 def force_mac_toolchain(c): | 801 def force_mac_toolchain(c): |
804 c.env.FORCE_MAC_TOOLCHAIN = 1 | 802 c.env.FORCE_MAC_TOOLCHAIN = 1 |
OLD | NEW |