OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 default_flavor | 5 import default_flavor |
6 | 6 |
7 """GN flavor utils, used for building Skia with GN.""" | 7 """GN flavor utils, used for building Skia with GN.""" |
8 class GNFlavorUtils(default_flavor.DefaultFlavorUtils): | 8 class GNFlavorUtils(default_flavor.DefaultFlavorUtils): |
9 def supported(self): | 9 def supported(self): |
10 extra_config = self.m.vars.builder_cfg.get('extra_config', '') | 10 extra_config = self.m.vars.builder_cfg.get('extra_config', '') |
11 os = self.m.vars.builder_cfg.get('os', '') | 11 os = self.m.vars.builder_cfg.get('os', '') |
12 target_arch = self.m.vars.builder_cfg.get('target_arch', '') | 12 target_arch = self.m.vars.builder_cfg.get('target_arch', '') |
13 | 13 |
14 return any([ | 14 return any([ |
15 'CT' in extra_config, | 15 'CT' in extra_config, |
16 'SAN' in extra_config, | 16 'SAN' in extra_config, |
| 17 extra_config == 'CommandBuffer', |
17 extra_config == 'Fast', | 18 extra_config == 'Fast', |
18 extra_config == 'GN', | 19 extra_config == 'GN', |
19 extra_config == 'Mesa', | 20 extra_config == 'Mesa', |
20 extra_config == 'NoGPU', | 21 extra_config == 'NoGPU', |
21 extra_config.startswith('SK'), | 22 extra_config.startswith('SK'), |
22 os == 'Ubuntu' and target_arch == 'x86', | 23 os == 'Ubuntu' and target_arch == 'x86', |
23 ]) | 24 ]) |
24 | 25 |
25 def _run(self, title, cmd, env=None, infra_step=False): | 26 def _run(self, title, cmd, env=None, infra_step=False): |
26 self.m.vars.default_env = {k: v for (k,v) | 27 self.m.vars.default_env = {k: v for (k,v) |
27 in self.m.vars.default_env.iteritems() | 28 in self.m.vars.default_env.iteritems() |
28 if k in ['PATH']} | 29 if k in ['PATH']} |
29 self.m.run(self.m.step, title, cmd=cmd, | 30 self.m.run(self.m.step, title, cmd=cmd, |
30 env=env, cwd=self.m.vars.skia_dir, infra_step=infra_step) | 31 env=env, cwd=self.m.vars.skia_dir, infra_step=infra_step) |
31 | 32 |
| 33 def build_command_buffer(self): |
| 34 self.m.run(self.m.python, 'build command_buffer', |
| 35 script=self.m.vars.skia_dir.join('tools', 'build_command_buffer.py'), |
| 36 args=[ |
| 37 '--chrome-dir', self.m.vars.checkout_root, |
| 38 '--output-dir', self.m.vars.skia_out.join(self.m.vars.configuration), |
| 39 '--chrome-build-type', self.m.vars.configuration, |
| 40 '--no-sync', '--make-output-dir']) |
| 41 |
32 def compile(self, unused_target, **kwargs): | 42 def compile(self, unused_target, **kwargs): |
33 """Build Skia with GN.""" | 43 """Build Skia with GN.""" |
34 compiler = self.m.vars.builder_cfg.get('compiler', '') | 44 compiler = self.m.vars.builder_cfg.get('compiler', '') |
35 configuration = self.m.vars.builder_cfg.get('configuration', '') | 45 configuration = self.m.vars.builder_cfg.get('configuration', '') |
36 extra_config = self.m.vars.builder_cfg.get('extra_config', '') | 46 extra_config = self.m.vars.builder_cfg.get('extra_config', '') |
37 os = self.m.vars.builder_cfg.get('os', '') | 47 os = self.m.vars.builder_cfg.get('os', '') |
38 target_arch = self.m.vars.builder_cfg.get('target_arch', '') | 48 target_arch = self.m.vars.builder_cfg.get('target_arch', '') |
39 | 49 |
40 clang_linux = str(self.m.vars.slave_dir.join('clang_linux')) | 50 clang_linux = str(self.m.vars.slave_dir.join('clang_linux')) |
41 | 51 |
(...skipping 14 matching lines...) Expand all Loading... |
56 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3']) | 66 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3']) |
57 if extra_config.startswith('SK'): | 67 if extra_config.startswith('SK'): |
58 extra_cflags.append('-D' + extra_config) | 68 extra_cflags.append('-D' + extra_config) |
59 if extra_config == 'MSAN': | 69 if extra_config == 'MSAN': |
60 extra_ldflags.append('-L' + clang_linux + '/msan') | 70 extra_ldflags.append('-L' + clang_linux + '/msan') |
61 | 71 |
62 args = {} | 72 args = {} |
63 | 73 |
64 if configuration != 'Debug': | 74 if configuration != 'Debug': |
65 args['is_debug'] = 'false' | 75 args['is_debug'] = 'false' |
| 76 if extra_config == 'CommandBuffer': |
| 77 self.m.run.run_once(self.build_command_buffer) |
66 if extra_config == 'MSAN': | 78 if extra_config == 'MSAN': |
67 args['skia_use_fontconfig'] = 'false' | 79 args['skia_use_fontconfig'] = 'false' |
68 if extra_config == 'Mesa': | 80 if extra_config == 'Mesa': |
69 args['skia_use_mesa'] = 'true' | 81 args['skia_use_mesa'] = 'true' |
70 if extra_config == 'NoGPU': | 82 if extra_config == 'NoGPU': |
71 args['skia_enable_gpu'] = 'false' | 83 args['skia_enable_gpu'] = 'false' |
72 | 84 |
73 for (k,v) in { | 85 for (k,v) in { |
74 'cc': cc, | 86 'cc': cc, |
75 'cxx': cxx, | 87 'cxx': cxx, |
(...skipping 29 matching lines...) Expand all Loading... |
105 if 'ASAN' == extra_config: | 117 if 'ASAN' == extra_config: |
106 env[ 'ASAN_OPTIONS'] = 'symbolize=1 detect_leaks=1' | 118 env[ 'ASAN_OPTIONS'] = 'symbolize=1 detect_leaks=1' |
107 env[ 'LSAN_OPTIONS'] = 'symbolize=1 print_suppressions=1' | 119 env[ 'LSAN_OPTIONS'] = 'symbolize=1 print_suppressions=1' |
108 env['UBSAN_OPTIONS'] = 'symbolize=1 print_stacktrace=1' | 120 env['UBSAN_OPTIONS'] = 'symbolize=1 print_stacktrace=1' |
109 | 121 |
110 if 'MSAN' == extra_config: | 122 if 'MSAN' == extra_config: |
111 # Find the MSAN-built libc++. | 123 # Find the MSAN-built libc++. |
112 env['LD_LIBRARY_PATH'] = clang_linux + '/msan' | 124 env['LD_LIBRARY_PATH'] = clang_linux + '/msan' |
113 | 125 |
114 self._run(name, cmd, env=env) | 126 self._run(name, cmd, env=env) |
OLD | NEW |