@@ -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