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