OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium 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 """A simple script to make building/testing Mojo components easier.""" | 6 """A simple script to make building/testing Mojo components easier.""" |
7 | 7 |
8 import argparse | 8 import argparse |
9 from copy import deepcopy | 9 from copy import deepcopy |
10 import logging | 10 import logging |
(...skipping 13 matching lines...) Expand all Loading... |
24 _verbose_count = 0 | 24 _verbose_count = 0 |
25 | 25 |
26 | 26 |
27 def _args_to_config(args): | 27 def _args_to_config(args): |
28 # Default to host OS. | 28 # Default to host OS. |
29 target_os = None | 29 target_os = None |
30 if args.android: | 30 if args.android: |
31 target_os = Config.OS_ANDROID | 31 target_os = Config.OS_ANDROID |
32 elif args.ios: | 32 elif args.ios: |
33 target_os = Config.OS_IOS | 33 target_os = Config.OS_IOS |
| 34 elif args.fnl: |
| 35 target_os = Config.OS_FNL |
34 | 36 |
35 target_cpu = args.target_cpu | 37 target_cpu = args.target_cpu |
36 | 38 |
37 additional_args = {} | 39 additional_args = {} |
38 | 40 |
39 if 'clang' in args: | 41 if 'clang' in args: |
40 additional_args['is_clang'] = args.clang | 42 additional_args['is_clang'] = args.clang |
41 | 43 |
42 if 'asan' in args and args.asan: | 44 if 'asan' in args and args.asan: |
43 additional_args['sanitizer'] = Config.SANITIZER_ASAN | 45 additional_args['sanitizer'] = Config.SANITIZER_ASAN |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if 'master_name' in args: | 83 if 'master_name' in args: |
82 additional_args['master_name'] = args.master_name | 84 additional_args['master_name'] = args.master_name |
83 if 'test_results_server' in args: | 85 if 'test_results_server' in args: |
84 additional_args['test_results_server'] = args.test_results_server | 86 additional_args['test_results_server'] = args.test_results_server |
85 | 87 |
86 if 'gn_args' in args: | 88 if 'gn_args' in args: |
87 additional_args['gn_args'] = args.gn_args | 89 additional_args['gn_args'] = args.gn_args |
88 | 90 |
89 is_debug = args.debug and not args.official | 91 is_debug = args.debug and not args.official |
90 | 92 |
| 93 if 'target_sysroot' in args and args.target_sysroot: |
| 94 additional_args['target_sysroot'] = os.path.abspath(args.target_sysroot) |
| 95 |
| 96 if 'toolchain_prefix' in args and args.toolchain_prefix: |
| 97 additional_args['toolchain_prefix'] = args.toolchain_prefix |
| 98 |
91 return Config(target_os=target_os, target_cpu=target_cpu, | 99 return Config(target_os=target_os, target_cpu=target_cpu, |
92 is_debug=is_debug, is_official_build=args.official, | 100 is_debug=is_debug, is_official_build=args.official, |
93 dcheck_always_on=args.dcheck_always_on, | 101 dcheck_always_on=args.dcheck_always_on, |
94 is_simulator=args.simulator, **additional_args) | 102 is_simulator=args.simulator, **additional_args) |
95 | 103 |
96 | 104 |
97 def _get_out_dir(config): | 105 def _get_out_dir(config): |
98 """Gets the build output directory (e.g., out/Debug), relative to src, for the | 106 """Gets the build output directory (e.g., out/Debug), relative to src, for the |
99 given config.""" | 107 given config.""" |
100 | 108 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 # The official build is a release build suitable for distribution, with a | 245 # The official build is a release build suitable for distribution, with a |
238 # different package name. | 246 # different package name. |
239 debug_group.add_argument('--official', help='Official build', default=False, | 247 debug_group.add_argument('--official', help='Official build', default=False, |
240 dest='official', action='store_true') | 248 dest='official', action='store_true') |
241 | 249 |
242 os_group = parent_parser.add_mutually_exclusive_group() | 250 os_group = parent_parser.add_mutually_exclusive_group() |
243 os_group.add_argument('--android', help='Build for Android', | 251 os_group.add_argument('--android', help='Build for Android', |
244 action='store_true') | 252 action='store_true') |
245 os_group.add_argument('--ios', help='Build for iOS', | 253 os_group.add_argument('--ios', help='Build for iOS', |
246 action='store_true') | 254 action='store_true') |
| 255 os_group.add_argument('--fnl', help='Build for FNL', |
| 256 action='store_true') |
247 | 257 |
248 parent_parser.add_argument('--simulator', | 258 parent_parser.add_argument('--simulator', |
249 help='Build for a simulator of the target', | 259 help='Build for a simulator of the target', |
250 action='store_true') | 260 action='store_true') |
251 | 261 |
252 parent_parser.add_argument('--target-cpu', | 262 parent_parser.add_argument('--target-cpu', |
253 help='CPU architecture to build for.', | 263 help='CPU architecture to build for.', |
254 choices=['x64', 'x86', 'arm']) | 264 choices=['x64', 'x86', 'arm']) |
255 | 265 |
| 266 parent_parser.add_argument('--target-sysroot', |
| 267 help='Location of sysroot for target', |
| 268 default='', |
| 269 dest='target_sysroot') |
| 270 |
| 271 parent_parser.add_argument('--toolchain-prefix', |
| 272 help='Toolchain prefix', |
| 273 default='', |
| 274 dest='toolchain_prefix') |
| 275 |
256 subparsers = parser.add_subparsers() | 276 subparsers = parser.add_subparsers() |
257 | 277 |
258 sync_parser = subparsers.add_parser('sync', parents=[parent_parser], | 278 sync_parser = subparsers.add_parser('sync', parents=[parent_parser], |
259 help='Sync using gclient (does not run gn).') | 279 help='Sync using gclient (does not run gn).') |
260 sync_parser.set_defaults(func=_sync) | 280 sync_parser.set_defaults(func=_sync) |
261 | 281 |
262 gn_parser = subparsers.add_parser('gn', parents=[parent_parser], | 282 gn_parser = subparsers.add_parser('gn', parents=[parent_parser], |
263 help='Run gn for mojo (does not sync).') | 283 help='Run gn for mojo (does not sync).') |
264 gn_parser.set_defaults(func=_gn) | 284 gn_parser.set_defaults(func=_gn) |
265 gn_parser.add_argument('--args', help='Specify extra args', | 285 gn_parser.add_argument('--args', help='Specify extra args', |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 InitLogging(_verbose_count) | 329 InitLogging(_verbose_count) |
310 | 330 |
311 if args.simulator and not args.ios: | 331 if args.simulator and not args.ios: |
312 sys.exit("Currently, the simulator target is only configured for iOS") | 332 sys.exit("Currently, the simulator target is only configured for iOS") |
313 | 333 |
314 return args.func(_args_to_config(args)) | 334 return args.func(_args_to_config(args)) |
315 | 335 |
316 | 336 |
317 if __name__ == '__main__': | 337 if __name__ == '__main__': |
318 sys.exit(main()) | 338 sys.exit(main()) |
OLD | NEW |