support passing the arm cpu variant to the build system (#176917)
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->
Support passing the ARM cpu variant through to the engine build from the
`tools/gn` front end.
Fixes #176870
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
diff --git a/engine/src/flutter/tools/gn b/engine/src/flutter/tools/gn
index 51ad8e2..452df18 100755
--- a/engine/src/flutter/tools/gn
+++ b/engine/src/flutter/tools/gn
@@ -684,6 +684,9 @@
if args.arm_float_abi:
gn_args['arm_float_abi'] = args.arm_float_abi
+ if args.arm_tune:
+ gn_args['arm_tune'] = args.arm_tune
+
if args.dart_dynamic_modules:
gn_args['dart_dynamic_modules'] = True
@@ -992,6 +995,16 @@
parser.add_argument('--windows-cpu', type=str, choices=['x64', 'arm64', 'x86'], default='x64')
parser.add_argument('--simulator-cpu', type=str, choices=['x64', 'arm64'], default='x64')
parser.add_argument('--arm-float-abi', type=str, choices=['hard', 'soft', 'softfp'])
+ parser.add_argument(
+ '--arm-tune',
+ type=str,
+ help='The specific cpu variant for which to generate code. '
+ 'This value is passed directly to the compiler `-mtune` flag, '
+ 'and is currently only supported for ARM. '
+ 'See your compiler documentation for valid values to pass to this option, '
+ 'for example for clang run `clang --target=aarch64-unknown-linux-gnu -mtune=?`. '
+ 'The default is a generic cpu variant selected by the build system.'
+ )
# Whether to compile in backtrace support.
# Available for Windows and POSIX platforms whose libc includes execinfo.h.