ar = "ar"
cc = "cc"
cxx = "c++"
+
+ extra_cflags = ""
+ extra_cflags_c = ""
+ extra_cflags_cc = ""
}
config("no_rtti") {
tool("cc") {
depfile = "{{output}}.d"
- command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
+ command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} $extra_cflags $extra_cflags_c -c {{source}} -o {{output}}"
depsformat = "gcc"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
tool("cxx") {
depfile = "{{output}}.d"
- command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
+ command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} $extra_cflags $extra_cflags_cc -c {{source}} -o {{output}}"
depsformat = "gcc"
outputs = [
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
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++'
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])