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

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

Issue 2294353002: Add and use a clang_linux asset. (Closed)
Patch Set: SAN|Clang 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
« no previous file with comments | « infra/bots/assets/clang_linux/upload.py ('k') | infra/bots/recipes/swarm_compile.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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', '')
11 11
12 return any([ 12 return any([
13 extra_config == 'GN', 13 extra_config == 'GN',
14 extra_config == 'Fast', 14 extra_config == 'Fast',
15 extra_config.startswith('SK') 15 extra_config.startswith('SK')
16 ]) 16 ])
17 17
18 def compile(self, unused_target, **kwargs): 18 def compile(self, unused_target, **kwargs):
19 """Build Skia with GN.""" 19 """Build Skia with GN."""
20 compiler = self.m.vars.builder_cfg.get('compiler', '') 20 compiler = self.m.vars.builder_cfg.get('compiler', '')
21 configuration = self.m.vars.builder_cfg.get('configuration', '') 21 configuration = self.m.vars.builder_cfg.get('configuration', '')
22 extra_config = self.m.vars.builder_cfg.get('extra_config', '') 22 extra_config = self.m.vars.builder_cfg.get('extra_config', '')
23 os = self.m.vars.builder_cfg.get('os', '')
23 24
24 cc, cxx = 'cc', 'c++' 25 cc, cxx = 'cc', 'c++'
25 extra_cflags = [] 26 extra_cflags = []
26 27
27 if compiler == 'Clang': 28 if compiler == 'Clang' and os == 'Ubuntu':
29 cc = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang')
30 cxx = self.m.vars.slave_dir.join('clang_linux', 'bin', 'clang++')
31 elif compiler == 'Clang':
28 cc, cxx = 'clang', 'clang++' 32 cc, cxx = 'clang', 'clang++'
29 elif compiler == 'GCC': 33 elif compiler == 'GCC':
30 cc, cxx = 'gcc', 'g++' 34 cc, cxx = 'gcc', 'g++'
31 35
32 compiler_prefix = "" 36 compiler_prefix = ""
33 ccache = self.m.run.ccache() 37 ccache = self.m.run.ccache()
34 if ccache: 38 if ccache:
35 compiler_prefix = ccache 39 compiler_prefix = ccache
36 if compiler == 'Clang': 40 if compiler == 'Clang':
37 # Stifle "argument unused during compilation: ..." warnings. 41 # Stifle "argument unused during compilation: ..." warnings.
38 extra_cflags.append('-Qunused-arguments') 42 extra_cflags.append('-Qunused-arguments')
39 43
40 if extra_config == 'Fast': 44 if extra_config == 'Fast':
41 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3']) 45 extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3'])
42 if extra_config.startswith('SK'): 46 if extra_config.startswith('SK'):
43 extra_cflags.append('-D' + extra_config) 47 extra_cflags.append('-D' + extra_config)
44 48
45 quote = lambda x: '"%s"' % x 49 quote = lambda x: '"%s"' % x
46 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in { 50 gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted({
47 'cc': quote(cc), 51 'cc': quote(cc),
48 'cxx': quote(cxx), 52 'cxx': quote(cxx),
49 'compiler_prefix': quote(compiler_prefix), 53 'compiler_prefix': quote(compiler_prefix),
50 'extra_cflags': quote(' '.join(extra_cflags)), 54 'extra_cflags': quote(' '.join(extra_cflags)),
51 'is_debug': 'true' if configuration == 'Debug' else 'false', 55 'is_debug': 'true' if configuration == 'Debug' else 'false',
52 }.iteritems()) 56 }.iteritems()))
53 57
54 run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd, 58 run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd,
55 cwd=self.m.vars.skia_dir, **kwargs) 59 cwd=self.m.vars.skia_dir, **kwargs)
56 60
57 run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')]) 61 run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
58 run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args]) 62 run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
59 run('ninja', ['ninja', '-C', self.out_dir]) 63 run('ninja', ['ninja', '-C', self.out_dir])
OLDNEW
« no previous file with comments | « infra/bots/assets/clang_linux/upload.py ('k') | infra/bots/recipes/swarm_compile.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698