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', '') |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 if compiler == 'Clang' and os == 'Ubuntu': | 34 if compiler == 'Clang' and os == 'Ubuntu': |
35 cc = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang') | 35 cc = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang') |
36 cxx = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang++') | 36 cxx = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang++') |
37 extra_ldflags.append('-fuse-ld=lld') | 37 extra_ldflags.append('-fuse-ld=lld') |
38 elif compiler == 'Clang': | 38 elif compiler == 'Clang': |
39 cc, cxx = 'clang', 'clang++' | 39 cc, cxx = 'clang', 'clang++' |
40 elif compiler == 'GCC': | 40 elif compiler == 'GCC': |
41 cc, cxx = 'gcc', 'g++' | 41 cc, cxx = 'gcc', 'g++' |
42 | 42 |
43 compiler_prefix = "" | |
44 ccache = self.m.run.ccache() | |
45 if ccache: | |
46 compiler_prefix = ccache | |
47 if compiler == 'Clang': | |
48 # Stifle "argument unused during compilation: ..." warnings. | |
49 extra_cflags.append('-Qunused-arguments') | |
50 | |
51 if extra_config == 'Fast': | 43 if extra_config == 'Fast': |
52 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3']) | 44 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3']) |
53 if extra_config.startswith('SK'): | 45 if extra_config.startswith('SK'): |
54 extra_cflags.append('-D' + extra_config) | 46 extra_cflags.append('-D' + extra_config) |
55 | 47 |
56 quote = lambda x: '"%s"' % x | 48 quote = lambda x: '"%s"' % x |
57 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({ | 49 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({ |
58 'cc': quote(cc), | 50 'cc': quote(cc), |
59 'cxx': quote(cxx), | 51 'cxx': quote(cxx), |
60 'compiler_prefix': quote(compiler_prefix), | |
61 'extra_cflags': quote(' '.join(extra_cflags)), | 52 'extra_cflags': quote(' '.join(extra_cflags)), |
62 'extra_ldflags': quote(' '.join(extra_ldflags)), | 53 'extra_ldflags': quote(' '.join(extra_ldflags)), |
63 'is_debug': 'true' if configuration == 'Debug' else 'false', | 54 'is_debug': 'true' if configuration == 'Debug' else 'false', |
64 }.iteritems())) | 55 }.iteritems())) |
65 | 56 |
66 self._run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')]) | 57 self._run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')]) |
67 self._run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args]) | 58 self._run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args]) |
68 self._run('ninja', ['ninja', '-C', self.out_dir]) | 59 self._run('ninja', ['ninja', '-C', self.out_dir]) |
OLD | NEW |