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

Side by Side Diff: platform_tools/android/bin/android_framework_gyp.py

Issue 140503007: Scripts to generate Android.mk for framework Skia. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Respond to Elliot's comments in patch set 20. Created 6 years, 10 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 | « no previous file | platform_tools/android/bin/gyp_to_android.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
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.abspath(os.path.dirname(__file__))
16
17 # Unlike gyp_skia, this file is nested deep inside Skia. Find Skia's trunk dir.
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 # Ensure we import our current gyp source's module, not any version
29 # pre-installed in your PYTHONPATH.
30 sys.path.insert(0, os.path.join(GYP_SOURCE_DIR, 'pylib'))
31
32 import gyp
33
34 def main(target_dir, target_file, skia_arch_type, have_neon):
35 """
36 Create gypd files based on target_file.
37 @param target_dir Directory containing all gyp files, including common.gypi
38 @param target_file Gyp file to start on. Other files within target_dir will
39 be read if target_file depends on them.
40 @param skia_arch_type Target architecture to pass to gyp.
41 @param have_neon Whether to generate files including neon optimizations.
42 Only meaningful if skia_arch_type is 'arm'.
43 @return path Path to root gypd file created by running gyp.
44 """
45 # Set GYP_DEFINES for building for the android framework.
46 gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s '
47 % skia_arch_type)
48 if skia_arch_type == 'arm':
49 # Always use thumb and version 7 for arm
50 gyp_defines += 'arm_thumb=1 arm_version=7 '
51 if have_neon:
52 gyp_defines += 'arm_neon=1 '
53 else:
54 gyp_defines += 'arm_neon=0 '
55
56 os.environ['GYP_DEFINES'] = gyp_defines
57
58 args = []
59 args.extend(['--depth', '.'])
60 full_path = os.path.join(target_dir, target_file)
61 args.extend([full_path])
62 # Common conditions
63 args.extend(['-I', os.path.join(target_dir, 'common.gypi')])
64 # Use the debugging format. We'll use these to create one master make file.
65 args.extend(['-f', 'gypd'])
66
67 # Off we go...
68 ret = gyp.main(args)
69
70 if ret != 0:
71 raise Exception("gyp failed!")
72
73 # Running gyp should have created a gypd file, with the same name as
74 # full_path but with a 'd' on the end.
75 gypd_file = full_path + 'd'
76 if not os.path.exists(gypd_file):
77 raise Exception("gyp failed to produce gypd file!")
78
79 return gypd_file
OLDNEW
« no previous file with comments | « no previous file | platform_tools/android/bin/gyp_to_android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698