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

Side by Side Diff: tools/gn.py

Issue 2892413002: Fix ARMv6 Linux cross-build (Closed)
Patch Set: Add an argument to specifiy the float ABI Created 3 years, 7 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 | « third_party/tcmalloc/BUILD.gn ('k') | no next file » | 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/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Dart project authors. All rights reserved. 2 # Copyright 2016 The Dart project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import argparse 6 import argparse
7 import multiprocessing 7 import multiprocessing
8 import os 8 import os
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 62
63 def GetOutDir(mode, arch, target_os): 63 def GetOutDir(mode, arch, target_os):
64 return utils.GetBuildRoot(HOST_OS, mode, arch, target_os) 64 return utils.GetBuildRoot(HOST_OS, mode, arch, target_os)
65 65
66 66
67 def ToCommandLine(gn_args): 67 def ToCommandLine(gn_args):
68 def merge(key, value): 68 def merge(key, value):
69 if type(value) is bool: 69 if type(value) is bool:
70 return '%s=%s' % (key, 'true' if value else 'false') 70 return '%s=%s' % (key, 'true' if value else 'false')
71 elif type(value) is int:
72 return '%s=%d' % (key, value)
71 return '%s="%s"' % (key, value) 73 return '%s="%s"' % (key, value)
72 return [merge(x, y) for x, y in gn_args.iteritems()] 74 return [merge(x, y) for x, y in gn_args.iteritems()]
73 75
74 76
75 def HostCpuForArch(arch): 77 def HostCpuForArch(arch):
76 if arch in ['ia32', 'arm', 'armv6', 'armv5te', 'mips', 78 if arch in ['ia32', 'arm', 'armv6', 'armv5te', 'mips',
77 'simarm', 'simarmv6', 'simarmv5te', 'simmips', 'simdbc', 79 'simarm', 'simarmv6', 'simarmv5te', 'simmips', 'simdbc',
78 'armsimdbc']: 80 'armsimdbc']:
79 return 'x86' 81 return 'x86'
80 if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']: 82 if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']:
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 gn_args['dart_use_fallback_root_certificates'] = True 169 gn_args['dart_use_fallback_root_certificates'] = True
168 170
169 gn_args['dart_zlib_path'] = "//runtime/bin/zlib" 171 gn_args['dart_zlib_path'] = "//runtime/bin/zlib"
170 172
171 # Use tcmalloc only when targeting Linux and when not using ASAN. 173 # Use tcmalloc only when targeting Linux and when not using ASAN.
172 gn_args['dart_use_tcmalloc'] = ((gn_args['target_os'] == 'linux') 174 gn_args['dart_use_tcmalloc'] = ((gn_args['target_os'] == 'linux')
173 and not UseSanitizer(args)) 175 and not UseSanitizer(args))
174 176
175 if gn_args['target_os'] == 'linux': 177 if gn_args['target_os'] == 'linux':
176 if gn_args['target_cpu'] == 'arm': 178 if gn_args['target_cpu'] == 'arm':
177 # Force -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're 179 # Default to -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're
178 # specifying a gnueabihf compiler in //build/toolchain/linux BUILD.gn. 180 # specifying a gnueabihf compiler in //build/toolchain/linux/BUILD.gn.
179 gn_args['arm_arch'] = 'armv7' 181 floatabi = 'hard' if args.arm_float_abi == '' else args.arm_float_abi
180 gn_args['arm_float_abi'] = 'hard' 182 gn_args['arm_version'] = 7
183 gn_args['arm_float_abi'] = floatabi
181 gn_args['arm_use_neon'] = True 184 gn_args['arm_use_neon'] = True
182 elif gn_args['target_cpu'] == 'armv6': 185 elif gn_args['target_cpu'] == 'armv6':
183 raise Exception("GN support for armv6 unimplemented") 186 floatabi = 'softfp' if args.arm_float_abi == '' else args.arm_float_abi
187 gn_args['target_cpu'] = 'arm'
188 gn_args['arm_version'] = 6
189 gn_args['arm_float_abi'] = floatabi
184 elif gn_args['target_cpu'] == 'armv5te': 190 elif gn_args['target_cpu'] == 'armv5te':
185 raise Exception("GN support for armv5te unimplemented") 191 raise Exception("GN support for armv5te unimplemented")
186 192
187 gn_args['is_debug'] = mode == 'debug' 193 gn_args['is_debug'] = mode == 'debug'
188 gn_args['is_release'] = mode == 'release' 194 gn_args['is_release'] = mode == 'release'
189 gn_args['is_product'] = mode == 'product' 195 gn_args['is_product'] = mode == 'product'
190 gn_args['dart_debug'] = mode == 'debug' 196 gn_args['dart_debug'] = mode == 'debug'
191 197
192 # This setting is only meaningful for Flutter. Standalone builds of the VM 198 # This setting is only meaningful for Flutter. Standalone builds of the VM
193 # should leave this set to 'develop', which causes the build to defer to 199 # should leave this set to 'develop', which causes the build to defer to
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 help='Build variants (comma-separated).', 322 help='Build variants (comma-separated).',
317 metavar='[all,debug,release,product]', 323 metavar='[all,debug,release,product]',
318 default='debug') 324 default='debug')
319 common_group.add_argument('--os', 325 common_group.add_argument('--os',
320 type=str, 326 type=str,
321 help='Target OSs (comma-separated).', 327 help='Target OSs (comma-separated).',
322 metavar='[all,host,android]', 328 metavar='[all,host,android]',
323 default='host') 329 default='host')
324 common_group.add_argument("-v", "--verbose", 330 common_group.add_argument("-v", "--verbose",
325 help='Verbose output.', 331 help='Verbose output.',
326 default=False, action="store_true") 332 default=False,
333 action="store_true")
327 334
335 other_group.add_argument('--arm-float-abi',
336 type=str,
337 help='The ARM float ABI (soft, softfp, hard)',
338 metavar='[soft,softfp,hard]',
339 default='')
328 other_group.add_argument('--asan', 340 other_group.add_argument('--asan',
329 help='Build with ASAN', 341 help='Build with ASAN',
330 default=UseASAN(), 342 default=UseASAN(),
331 action='store_true') 343 action='store_true')
332 other_group.add_argument('--no-asan', 344 other_group.add_argument('--no-asan',
333 help='Disable ASAN', 345 help='Disable ASAN',
334 dest='asan', 346 dest='asan',
335 action='store_false') 347 action='store_false')
336 other_group.add_argument('--clang', 348 other_group.add_argument('--clang',
337 help='Use Clang', 349 help='Use Clang',
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 return 1 465 return 1
454 466
455 endtime = time.time() 467 endtime = time.time()
456 if args.verbose: 468 if args.verbose:
457 print ("GN Time: %.3f seconds" % (endtime - starttime)) 469 print ("GN Time: %.3f seconds" % (endtime - starttime))
458 return 0 470 return 0
459 471
460 472
461 if __name__ == '__main__': 473 if __name__ == '__main__':
462 sys.exit(Main(sys.argv)) 474 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « third_party/tcmalloc/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698