| 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 compile(self, target): | 9 def compile(self, target, **kwargs): |
| 10 """Build Skia with GN.""" | 10 """Build Skia with GN.""" |
| 11 # Get the gn executable. | 11 # Get the gn executable. |
| 12 fetch_gn = self.m.vars.skia_dir.join('bin', 'fetch-gn') | 12 fetch_gn = self.m.vars.skia_dir.join('bin', 'fetch-gn') |
| 13 self.m.run(self.m.step, 'fetch-gn', | 13 self.m.run(self.m.step, 'fetch-gn', |
| 14 cmd=[fetch_gn], | 14 cmd=[fetch_gn], |
| 15 cwd=self.m.vars.skia_dir) | 15 cwd=self.m.vars.skia_dir, |
| 16 **kwargs) |
| 16 | 17 |
| 17 is_debug = 'is_debug=true' | 18 is_debug = 'is_debug=true' |
| 18 if self.m.vars.configuration != 'Debug': | 19 if self.m.vars.configuration != 'Debug': |
| 19 is_debug = 'is_debug=false' | 20 is_debug = 'is_debug=false' |
| 20 gn_args = [is_debug] | 21 gn_args = [is_debug] |
| 21 | 22 |
| 22 is_clang = 'Clang' in self.m.vars.builder_name | 23 is_clang = 'Clang' in self.m.vars.builder_name |
| 23 is_gcc = 'GCC' in self.m.vars.builder_name | 24 is_gcc = 'GCC' in self.m.vars.builder_name |
| 24 | 25 |
| 25 cc, cxx = 'cc', 'c++' | 26 cc, cxx = 'cc', 'c++' |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 cc, cxx = '%s %s' % (cc, stifle), '%s %s' % (cxx, stifle) | 38 cc, cxx = '%s %s' % (cc, stifle), '%s %s' % (cxx, stifle) |
| 38 | 39 |
| 39 gn_args += [ 'cc="%s"' % cc, 'cxx="%s"' % cxx ] | 40 gn_args += [ 'cc="%s"' % cc, 'cxx="%s"' % cxx ] |
| 40 | 41 |
| 41 # Run gn gen. | 42 # Run gn gen. |
| 42 gn_exe = 'gn' | 43 gn_exe = 'gn' |
| 43 if self.m.platform.is_win: | 44 if self.m.platform.is_win: |
| 44 gn_exe = 'gn.exe' | 45 gn_exe = 'gn.exe' |
| 45 gn_gen = [gn_exe, 'gen', self.out_dir, '--args=%s' % ' '.join(gn_args)] | 46 gn_gen = [gn_exe, 'gen', self.out_dir, '--args=%s' % ' '.join(gn_args)] |
| 46 self.m.run(self.m.step, 'gn_gen', cmd=gn_gen, | 47 self.m.run(self.m.step, 'gn_gen', cmd=gn_gen, |
| 47 cwd=self.m.vars.skia_dir) | 48 cwd=self.m.vars.skia_dir, **kwargs) |
| 48 | 49 |
| 49 # Run ninja. | 50 # Run ninja. |
| 50 ninja_cmd = ['ninja', '-C', self.out_dir] | 51 ninja_cmd = ['ninja', '-C', self.out_dir] |
| 51 self.m.run(self.m.step, 'compile %s' % target, | 52 self.m.run(self.m.step, 'compile %s' % target, |
| 52 cmd=ninja_cmd, | 53 cmd=ninja_cmd, |
| 53 cwd=self.m.vars.skia_dir) | 54 cwd=self.m.vars.skia_dir, |
| 55 **kwargs) |
| OLD | NEW |