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

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

Issue 2359793002: Add mips dsp arch variants to gyp_to_android.py. (Closed)
Patch Set: Created 4 years, 3 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/gyp_gen/android_framework_gyp.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 """ 8 """
9 Script for generating the Android framework's version of Skia from gyp 9 Script for generating the Android framework's version of Skia from gyp
10 files. 10 files.
(...skipping 19 matching lines...) Expand all
30 import gyp_gen.generate_user_config as generate_user_config 30 import gyp_gen.generate_user_config as generate_user_config
31 import gyp_gen.makefile_writer as makefile_writer 31 import gyp_gen.makefile_writer as makefile_writer
32 import gyp_gen.tool_makefile_writer as tool_makefile_writer 32 import gyp_gen.tool_makefile_writer as tool_makefile_writer
33 import gyp_gen.vars_dict_lib as vars_dict_lib 33 import gyp_gen.vars_dict_lib as vars_dict_lib
34 34
35 # Folder containing all gyp files and generated gypd files. 35 # Folder containing all gyp files and generated gypd files.
36 GYP_FOLDER = 'gyp' 36 GYP_FOLDER = 'gyp'
37 37
38 38
39 def generate_var_dict(target_dir, target_file, skia_arch_type, have_neon, 39 def generate_var_dict(target_dir, target_file, skia_arch_type, have_neon,
40 gyp_source_dir): 40 have_mips_dspr2, have_mips_dspr1, gyp_source_dir):
41 """Create a VarsDict for a particular arch type. 41 """Create a VarsDict for a particular arch type.
42 42
43 Each paramater is passed directly to android_framework_gyp.main(). 43 Each paramater is passed directly to android_framework_gyp.main().
44 44
45 Args: 45 Args:
46 target_dir: Directory containing gyp files. 46 target_dir: Directory containing gyp files.
47 target_file: Target gyp file. 47 target_file: Target gyp file.
48 skia_arch_type: Target architecture. 48 skia_arch_type: Target architecture.
49 have_neon: Whether the target should build for neon. 49 have_neon: Whether the target should build for neon.
50 have_mips_dspr2: Whether the target should build for mips_dspr2.
51 have_mips_dspr1: Whether the target should build for mips_dspr1.
50 gyp_source_dir: Directory for gyp source. 52 gyp_source_dir: Directory for gyp source.
51 Returns: 53 Returns:
52 A VarsDict containing the variable definitions determined by gyp. 54 A VarsDict containing the variable definitions determined by gyp.
53 """ 55 """
54 result_file = android_framework_gyp.main(target_dir, target_file, 56 result_file = android_framework_gyp.main(target_dir, target_file,
55 skia_arch_type, have_neon, 57 skia_arch_type, have_neon,
58 have_mips_dspr2, have_mips_dspr1,
56 gyp_source_dir) 59 gyp_source_dir)
57 var_dict = vars_dict_lib.VarsDict() 60 var_dict = vars_dict_lib.VarsDict()
58 gypd_parser.parse_gypd(var_dict, result_file, '.') 61 gypd_parser.parse_gypd(var_dict, result_file, '.')
59 android_framework_gyp.clean_gypd_files(target_dir) 62 android_framework_gyp.clean_gypd_files(target_dir)
60 print '.', 63 print '.',
61 return var_dict 64 return var_dict
62 65
63 def main(target_dir=None, require_sk_user_config=False, gyp_source_dir=None): 66 def main(target_dir=None, require_sk_user_config=False, gyp_source_dir=None):
64 """Create Android.mk for the Android framework's external/skia. 67 """Create Android.mk for the Android framework's external/skia.
65 68
(...skipping 27 matching lines...) Expand all
93 # 2. call parse_gypd to read those gypd files into the VarsDict 96 # 2. call parse_gypd to read those gypd files into the VarsDict
94 # 3. delete the gypd files 97 # 3. delete the gypd files
95 # 98 #
96 # Once we have the VarsDict for each architecture type, we combine them all 99 # Once we have the VarsDict for each architecture type, we combine them all
97 # into a single Android.mk file, which can build targets of any 100 # into a single Android.mk file, which can build targets of any
98 # architecture type. 101 # architecture type.
99 102
100 # The default uses a non-existant archtype, to find all the general 103 # The default uses a non-existant archtype, to find all the general
101 # variable definitions. 104 # variable definitions.
102 default_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'other', 105 default_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'other',
103 False, gyp_source_dir) 106 False, False, False, gyp_source_dir)
104 arm_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm', False, 107 arm_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm', False,
105 gyp_source_dir) 108 False, False, gyp_source_dir)
106 arm_neon_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm', 109 arm_neon_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm',
107 True, gyp_source_dir) 110 True, False, False, gyp_source_dir)
108 x86_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'x86', False, 111 x86_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'x86', False,
109 gyp_source_dir) 112 False, False, gyp_source_dir)
110 x86_64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'x86_64', 113 x86_64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'x86_64',
111 False, gyp_source_dir) 114 False, False, False, gyp_source_dir)
112 115
113 mips_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips', False, 116 mips_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips', False,
114 gyp_source_dir) 117 False, False, gyp_source_dir)
118
119 mips_dspr2_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips',
120 False, True, False, gyp_source_dir)
121
122 mips_dspr1_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips',
123 False, False, True, gyp_source_dir)
115 124
116 mips64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips64', 125 mips64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips64',
117 False, gyp_source_dir) 126 False, False, False, gyp_source_dir)
118 127
119 arm64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm64', 128 arm64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm64',
120 False, gyp_source_dir) 129 False, False, False, gyp_source_dir)
121 130
122 # Compute the intersection of all targets. All the files in the intersection 131 # Compute the intersection of all targets. All the files in the intersection
123 # should be part of the makefile always. Each dict will now contain trimmed 132 # should be part of the makefile always. Each dict will now contain trimmed
124 # lists containing only variable definitions specific to that configuration. 133 # lists containing only variable definitions specific to that configuration.
125 var_dict_list = [default_var_dict, arm_var_dict, arm_neon_var_dict, 134 var_dict_list = [default_var_dict, arm_var_dict, arm_neon_var_dict,
126 x86_var_dict, x86_64_var_dict, mips_var_dict, 135 x86_var_dict, x86_64_var_dict, mips_var_dict,
127 mips64_var_dict, arm64_var_dict] 136 mips_dspr1_var_dict, mips_dspr2_var_dict, mips64_var_dict,
137 arm64_var_dict]
128 common = vars_dict_lib.intersect(var_dict_list) 138 common = vars_dict_lib.intersect(var_dict_list)
129 139
130 common.LOCAL_MODULE.add('libskia') 140 common.LOCAL_MODULE.add('libskia')
131 141
132 # Create SkUserConfig 142 # Create SkUserConfig
133 user_config = os.path.join(SKIA_DIR, 'include', 'config', 'SkUserConfig.h') 143 user_config = os.path.join(SKIA_DIR, 'include', 'config', 'SkUserConfig.h')
134 if target_dir: 144 if target_dir:
135 dst_dir = target_dir 145 dst_dir = target_dir
136 else: 146 else:
137 dst_dir = os.path.join(SKIA_DIR, 'include', 'core') 147 dst_dir = os.path.join(SKIA_DIR, 'include', 'core')
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 deviations_from_common = [] 186 deviations_from_common = []
177 deviations_from_common.append(makefile_writer.VarsDictData( 187 deviations_from_common.append(makefile_writer.VarsDictData(
178 arm_var_dict, 'arm')) 188 arm_var_dict, 'arm'))
179 deviations_from_common.append(makefile_writer.VarsDictData( 189 deviations_from_common.append(makefile_writer.VarsDictData(
180 arm_neon_var_dict, 'arm', 'ARCH_ARM_HAVE_NEON')) 190 arm_neon_var_dict, 'arm', 'ARCH_ARM_HAVE_NEON'))
181 deviations_from_common.append(makefile_writer.VarsDictData(x86_var_dict, 191 deviations_from_common.append(makefile_writer.VarsDictData(x86_var_dict,
182 'x86')) 192 'x86'))
183 deviations_from_common.append(makefile_writer.VarsDictData(x86_64_var_dict, 193 deviations_from_common.append(makefile_writer.VarsDictData(x86_64_var_dict,
184 'x86_64')) 194 'x86_64'))
185 195
196 deviations_from_common.append(makefile_writer.VarsDictData(
197 mips_dspr2_var_dict, 'mips', 'mips32r2dspr2-fp'))
198
199 deviations_from_common.append(makefile_writer.VarsDictData(
200 mips_dspr1_var_dict, 'mips', 'mips32r2dsp-fp'))
201
186 deviations_from_common.append(makefile_writer.VarsDictData(mips_var_dict, 202 deviations_from_common.append(makefile_writer.VarsDictData(mips_var_dict,
187 'mips')) 203 'mips'))
188 204
189 deviations_from_common.append(makefile_writer.VarsDictData(mips64_var_dict, 205 deviations_from_common.append(makefile_writer.VarsDictData(mips64_var_dict,
190 'mips64')) 206 'mips64'))
191 207
192 deviations_from_common.append(makefile_writer.VarsDictData(arm64_var_dict, 208 deviations_from_common.append(makefile_writer.VarsDictData(arm64_var_dict,
193 'arm64')) 209 'arm64'))
194 210
195 makefile_writer.write_android_mk(target_dir=target_dir, 211 makefile_writer.write_android_mk(target_dir=target_dir,
196 common=common, deviations_from_common=deviations_from_common) 212 common=common, deviations_from_common=deviations_from_common)
197 213
198 makefile_writer.write_static_deps_mk(target_dir=target_dir, 214 makefile_writer.write_static_deps_mk(target_dir=target_dir,
199 common=common, deviations_from_common=deviations_from_common) 215 common=common, deviations_from_common=deviations_from_common)
200 216
201 finally: 217 finally:
202 shutil.rmtree(tmp_folder) 218 shutil.rmtree(tmp_folder)
203 219
204 if __name__ == '__main__': 220 if __name__ == '__main__':
205 parser = argparse.ArgumentParser() 221 parser = argparse.ArgumentParser()
206 parser.add_argument('--gyp_source_dir', help='Source of gyp program. ' 222 parser.add_argument('--gyp_source_dir', help='Source of gyp program. '
207 'e.g. <path_to_skia>/third_party/externals/gyp') 223 'e.g. <path_to_skia>/third_party/externals/gyp')
208 args = parser.parse_args() 224 args = parser.parse_args()
209 225
210 main(gyp_source_dir=args.gyp_source_dir) 226 main(gyp_source_dir=args.gyp_source_dir)
OLDNEW
« no previous file with comments | « no previous file | platform_tools/android/gyp_gen/android_framework_gyp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698