OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/python | |
djsollen
2014/01/22 21:02:44
not sure I'm the best person to review python. Can
scroggo
2014/01/22 23:52:41
Adding elliot, who has been looking at https://cod
| |
2 | |
3 # Copyright 2014 Google Inc. | |
4 # | |
5 # Use of this source code is governed by a BSD-style license that can be | |
6 # found in the LICENSE file. | |
7 | |
8 """ | |
9 Modified version of gyp_skia, used by gyp_to_android.py to generate Android.mk | |
10 """ | |
11 | |
12 import os | |
13 import sys | |
14 | |
15 script_dir = os.path.dirname(__file__) | |
16 | |
17 # Unlike gyp_skia, this file is nested deep inside Skia. Move to Skia trunk. | |
18 # This line depends on the fact that the script is three levels deep | |
19 # (specifically, it is in platform_tools/android/bin). | |
20 skia_dir = os.path.normpath(os.path.join(script_dir, os.pardir, os.pardir, | |
21 os.pardir)) | |
22 dir_contents = os.listdir(skia_dir) | |
23 assert 'third_party' in dir_contents and 'gyp' in dir_contents | |
24 | |
25 # Directory within which we can find the gyp source. | |
26 gyp_source_dir = os.path.join(skia_dir, 'third_party', 'externals', 'gyp') | |
27 | |
28 # Directory within which we can find most of Skia's gyp configuration files. | |
29 gyp_config_dir = os.path.join(skia_dir, 'gyp') | |
30 | |
31 # Ensure we import our current gyp source's module, not any version | |
32 # pre-installed in your PYTHONPATH. | |
33 sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib')) | |
34 | |
35 import gyp | |
36 | |
37 def main(skia_arch_type, have_neon): | |
38 # Set GYP_DEFINES for building for the android framework. | |
39 gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s ' | |
40 % skia_arch_type) | |
41 if skia_arch_type == 'arm': | |
42 # Always use thumb and version 7 for arm | |
43 gyp_defines = gyp_defines + 'arm_thumb=1 arm_version=7 ' | |
44 if have_neon: | |
45 gyp_defines = gyp_defines + 'arm_neon=1 ' | |
46 else: | |
47 gyp_defines = gyp_defines + 'arm_neon=0 ' | |
48 | |
49 os.environ['GYP_DEFINES'] = gyp_defines | |
50 | |
51 args = [] | |
52 args.extend(['--depth', '.']) | |
53 # Use the android_framework_lib file instead of skia.gyp | |
54 args.extend([os.path.join(gyp_config_dir, 'android_framework_lib.gyp')]) | |
55 # Common conditions | |
56 args.extend(['-I', 'gyp/common.gypi']) | |
57 # Use the debugging format. We'll use these to create one master make file. | |
58 args.extend(['-f', 'gypd']) | |
59 | |
60 # Off we go... | |
61 return gyp.main(args) | |
OLD | NEW |