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 == 'Fast', | 17 extra_config == 'Fast', |
18 extra_config == 'GN', | 18 extra_config == 'GN', |
| 19 extra_config == 'Mesa', |
19 extra_config == 'NoGPU', | 20 extra_config == 'NoGPU', |
20 extra_config.startswith('SK'), | 21 extra_config.startswith('SK'), |
21 os == 'Ubuntu' and target_arch == 'x86', | 22 os == 'Ubuntu' and target_arch == 'x86', |
22 ]) | 23 ]) |
23 | 24 |
24 def _run(self, title, cmd, env=None, infra_step=False): | 25 def _run(self, title, cmd, env=None, infra_step=False): |
25 self.m.vars.default_env = {k: v for (k,v) | 26 self.m.vars.default_env = {k: v for (k,v) |
26 in self.m.vars.default_env.iteritems() | 27 in self.m.vars.default_env.iteritems() |
27 if k in ['PATH']} | 28 if k in ['PATH']} |
28 self.m.run(self.m.step, title, cmd=cmd, | 29 self.m.run(self.m.step, title, cmd=cmd, |
(...skipping 28 matching lines...) Expand all Loading... |
57 extra_cflags.append('-D' + extra_config) | 58 extra_cflags.append('-D' + extra_config) |
58 if extra_config == 'MSAN': | 59 if extra_config == 'MSAN': |
59 extra_ldflags.append('-L' + clang_linux + '/msan') | 60 extra_ldflags.append('-L' + clang_linux + '/msan') |
60 | 61 |
61 args = {} | 62 args = {} |
62 | 63 |
63 if configuration != 'Debug': | 64 if configuration != 'Debug': |
64 args['is_debug'] = 'false' | 65 args['is_debug'] = 'false' |
65 if extra_config == 'MSAN': | 66 if extra_config == 'MSAN': |
66 args['skia_use_fontconfig'] = 'false' | 67 args['skia_use_fontconfig'] = 'false' |
| 68 if extra_config == 'Mesa': |
| 69 args['skia_use_mesa'] = 'true' |
67 if extra_config == 'NoGPU': | 70 if extra_config == 'NoGPU': |
68 args['skia_enable_gpu'] = 'false' | 71 args['skia_enable_gpu'] = 'false' |
69 | 72 |
70 for (k,v) in { | 73 for (k,v) in { |
71 'cc': cc, | 74 'cc': cc, |
72 'cxx': cxx, | 75 'cxx': cxx, |
73 'extra_cflags': ' '.join(extra_cflags), | 76 'extra_cflags': ' '.join(extra_cflags), |
74 'extra_ldflags': ' '.join(extra_ldflags), | 77 'extra_ldflags': ' '.join(extra_ldflags), |
75 'sanitize': extra_config if 'SAN' in extra_config else '', | 78 'sanitize': extra_config if 'SAN' in extra_config else '', |
76 'target_cpu': 'x86' if target_arch == 'x86' else '', | 79 'target_cpu': 'x86' if target_arch == 'x86' else '', |
(...skipping 25 matching lines...) Expand all Loading... |
102 if 'ASAN' == extra_config: | 105 if 'ASAN' == extra_config: |
103 env[ 'ASAN_OPTIONS'] = 'symbolize=1 detect_leaks=1' | 106 env[ 'ASAN_OPTIONS'] = 'symbolize=1 detect_leaks=1' |
104 env[ 'LSAN_OPTIONS'] = 'symbolize=1 print_suppressions=1' | 107 env[ 'LSAN_OPTIONS'] = 'symbolize=1 print_suppressions=1' |
105 env['UBSAN_OPTIONS'] = 'symbolize=1 print_stacktrace=1' | 108 env['UBSAN_OPTIONS'] = 'symbolize=1 print_stacktrace=1' |
106 | 109 |
107 if 'MSAN' == extra_config: | 110 if 'MSAN' == extra_config: |
108 # Find the MSAN-built libc++. | 111 # Find the MSAN-built libc++. |
109 env['LD_LIBRARY_PATH'] = clang_linux + '/msan' | 112 env['LD_LIBRARY_PATH'] = clang_linux + '/msan' |
110 | 113 |
111 self._run(name, cmd, env=env) | 114 self._run(name, cmd, env=env) |
OLD | NEW |