@@ -329,15 +329,16 @@ def to_gn_args(args):
329329 gn_args['target_cpu'] = get_target_cpu(args)
330330 gn_args['dart_target_arch'] = gn_args['target_cpu']
331331
332- # No cross-compilation on Windows (for now). Use host toolchain that
333- # matches the bit-width of the target architecture.
334- if sys.platform.startswith(('cygwin', 'win')) and args.target_os != 'win':
335- cpu = cpu_for_target_arch(gn_args['target_cpu'])
336- # We explicitly allow arm64 native build. 'host_cpu' key may not exist.
337- if gn_args.get('host_cpu') == 'arm64' and gn_args['target_cpu'] == 'arm64':
338- cpu = 'arm64'
339- gn_args['host_cpu'] = cpu
340- gn_args['target_cpu'] = cpu
332+ # We cannot cross-compile for 32 bit arm on a Windows host. We work around
333+ # this by leaving 'target_cpu' and 'dart_target_arch' set to 'arm' so that
334+ # Dart tools like gen_snapshot that are built for the host will correctly
335+ # target arm, but we hardcode the 'current_cpu' to always be the host arch
336+ # so that the GN build doesn't go looking for a Windows arm toolchain, which
337+ # does not exist. Further, we set the 'host_cpu' so that it shares the
338+ # bitwidth of the 32-bit arm target.
339+ if sys.platform.startswith(('cygwin', 'win')) and args.target_os == 'android' and gn_args['target_cpu'] == 'arm':
340+ gn_args['host_cpu'] = 'x86'
341+ gn_args['current_cpu'] = 'x86'
341342
342343 if is_host_build(args) and gn_args['host_os'] == 'mac':
343344 # macOS host builds (whether x64 or arm64) must currently be built under
0 commit comments