Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f86b487

Browse files
committed
Narrow the scope of the Windows Android arm hack
1 parent 2f8b4e7 commit f86b487

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ allowed_hosts = [
118118
]
119119

120120
deps = {
121-
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ad96f00615dc306c22cc09d433eee50392f8033c',
121+
'src': 'https://github.com/zanderso/buildroot.git' + '@' + '37f0ef84bfd2121d126cd6226d440e8228a79a1a',
122122

123123
# Fuchsia compatibility
124124
#

tools/gn

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,16 @@ def to_gn_args(args):
325325
gn_args['target_cpu'] = get_target_cpu(args)
326326
gn_args['dart_target_arch'] = gn_args['target_cpu']
327327

328-
# No cross-compilation on Windows (for now). Use host toolchain that
329-
# matches the bit-width of the target architecture.
330-
if sys.platform.startswith(('cygwin', 'win')) and args.target_os != 'win':
331-
cpu = cpu_for_target_arch(gn_args['target_cpu'])
332-
# We explicitly allow arm64 native build. 'host_cpu' key may not exist.
333-
if gn_args.get('host_cpu') == 'arm64' and gn_args['target_cpu'] == 'arm64':
334-
cpu = 'arm64'
335-
gn_args['host_cpu'] = cpu
336-
gn_args['target_cpu'] = cpu
328+
# We cannot cross-compile for 32 bit arm on a Windows host. We work around
329+
# this by leaving 'target_cpu' and 'dart_target_arch' set to 'arm' so that
330+
# Dart tools like gen_snapshot that are built for the host will correctly
331+
# target arm, but we hardcode the 'current_cpu' to always be the host arch
332+
# so that the GN build doesn't go looking for a Windows arm toolchain, which
333+
# does not exist. Further, we set the 'host_cpu' so that it shares the
334+
# bitwidth of the 32-bit arm target.
335+
if sys.platform.startswith(('cygwin', 'win')) and args.target_os == 'android' and gn_args['target_cpu'] == 'arm':
336+
gn_args['host_cpu'] = 'x86'
337+
gn_args['current_cpu'] = 'x86'
337338

338339
# macOS host builds (whether x64 or arm64) must currently be built under
339340
# Rosetta on Apple Silicon Macs.

0 commit comments

Comments
 (0)