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

Unified Diff: infra/bots/recipe_modules/flavor/gn_flavor.py

Issue 2241263003: GN: add extra_cflags et al. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: quote manually Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/bots/recipe_modules/flavor/gn_flavor.py
diff --git a/infra/bots/recipe_modules/flavor/gn_flavor.py b/infra/bots/recipe_modules/flavor/gn_flavor.py
index ef258965695f7e144dc728a583a90a7909662d4d..75c318f818335c16c32bb3ac0e7150100b18efdb 100644
--- a/infra/bots/recipe_modules/flavor/gn_flavor.py
+++ b/infra/bots/recipe_modules/flavor/gn_flavor.py
@@ -21,12 +21,8 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
configuration = self.m.vars.builder_cfg.get('configuration', '')
extra_config = self.m.vars.builder_cfg.get('extra_config', '')
- gn_args = []
- if configuration != 'Debug':
- gn_args.append('is_debug=false')
-
cc, cxx = 'cc', 'c++'
- cflags = []
+ extra_cflags = []
if compiler == 'Clang':
cc, cxx = 'clang', 'clang++'
@@ -38,19 +34,24 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils):
cc, cxx = '%s %s' % (ccache, cc), '%s %s' % (ccache, cxx)
if compiler == 'Clang':
# Stifle "argument unused during compilation: ..." warnings.
- cflags.append('-Qunused-arguments')
+ extra_cflags.append('-Qunused-arguments')
if extra_config == 'Fast':
- cflags.extend(['-march=native', '-fomit-frame-pointer'])
+ extra_cflags.extend(['-march=native', '-fomit-frame-pointer', '-O3'])
if extra_config.startswith('SK'):
- cflags.append('-D' + extra_config)
+ extra_cflags.append('-D' + extra_config)
- cflags = ' '.join(cflags)
- gn_args += [ 'cc="%s %s"' % (cc, cflags), 'cxx="%s %s"' % (cxx, cflags) ]
+ quote = lambda x: '"%s"' % x
+ gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in {
+ 'cc': quote(cc),
+ 'cxx': quote(cxx),
+ 'extra_cflags': quote(' '.join(extra_cflags)),
+ 'is_debug': 'true' if configuration == 'Debug' else 'false',
+ }.iteritems())
run = lambda title, cmd: self.m.run(self.m.step, title, cmd=cmd,
cwd=self.m.vars.skia_dir, **kwargs)
run('fetch-gn', [self.m.vars.skia_dir.join('bin', 'fetch-gn')])
- run('gn gen', ['gn', 'gen', self.out_dir, '--args=%s' % ' '.join(gn_args)])
+ run('gn gen', ['gn', 'gen', self.out_dir, '--args=' + gn_args])
run('ninja', ['ninja', '-C', self.out_dir])
« 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