Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: infra/bots/recipe_modules/flavor/gn_flavor.py

Issue 2281163002: GN: support compiler_prefix, use it for ccache on bots. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 11 matching lines...) Expand all
22 extra_config = self.m.vars.builder_cfg.get('extra_config', '') 22 extra_config = self.m.vars.builder_cfg.get('extra_config', '')
23 23
24 cc, cxx = 'cc', 'c++' 24 cc, cxx = 'cc', 'c++'
25 extra_cflags = [] 25 extra_cflags = []
26 26
27 if compiler == 'Clang': 27 if compiler == 'Clang':
28 cc, cxx = 'clang', 'clang++' 28 cc, cxx = 'clang', 'clang++'
29 elif compiler == 'GCC': 29 elif compiler == 'GCC':
30 cc, cxx = 'gcc', 'g++' 30 cc, cxx = 'gcc', 'g++'
31 31
32 compiler_prefix = ""
32 ccache = self.m.run.ccache() 33 ccache = self.m.run.ccache()
33 if ccache: 34 if ccache:
34 cc, cxx = '%s %s' % (ccache, cc), '%s %s' % (ccache, cxx) 35 compiler_prefix = ccache
35 if compiler == 'Clang': 36 if compiler == 'Clang':
36 # Stifle "argument unused during compilation: ..." warnings. 37 # Stifle "argument unused during compilation: ..." warnings.
37 extra_cflags.append('-Qunused-arguments') 38 extra_cflags.append('-Qunused-arguments')
38 39
39 if extra_config == 'Fast': 40 if extra_config == 'Fast':
40 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3']) 41 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3'])
41 if extra_config.startswith('SK'): 42 if extra_config.startswith('SK'):
42 extra_cflags.append('-D' + extra_config) 43 extra_cflags.append('-D' + extra_config)
43 44
44 quote = lambda x: '"%s"' % x 45 quote = lambda x: '"%s"' % x
45 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in { 46 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in {
46 'cc': quote(cc), 47 'cc': quote(cc),
47 'cxx': quote(cxx), 48 'cxx': quote(cxx),
49 'compiler_prefix': quote(compiler_prefix),
48 'extra_cflags': quote(' '.join(extra_cflags)), 50 'extra_cflags': quote(' '.join(extra_cflags)),
49 'is_debug': 'true' if configuration == 'Debug' else 'false', 51 'is_debug': 'true' if configuration == 'Debug' else 'false',
50 }.iteritems()) 52 }.iteritems())
51 53
52 run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd, 54 run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd,
53 cwd=self.m.vars.skia_dir, **kwargs) 55 cwd=self.m.vars.skia_dir, **kwargs)
54 56
55 run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')]) 57 run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
56 run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args]) 58 run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
57 run('ninja', ['ninja', '-C', self.out_dir]) 59 run('ninja', ['ninja', '-C', self.out_dir])
OLDNEW
« no previous file with comments | « gn/BUILD.gn ('k') | infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698