Add cross-compilation support for Windows on Arm
Fixes https://github.com/nodejs/node/issues/32582. CC @richardlau @joaocgreis @jkunkee
This PR fixes the Windows on Arm build of Node.js by applying all the necessary command line flags and workarounds, then adds cross-compilation support for the MSVC backend of node-gyp alongside supporting changes. The way this is implemented is that host GYP targets now end with _host.exe (e.g. mksnapshot_host.exe) and actions are re-written accordingly. In addition to the standard node.sln
, a special node_host.sln
is also generated with the host-only targets (this because MSBuild doesn't like building solutions with projects targeted at a mix of different architectures).
Current issues
- Declaring support for cross-compilation means that some host-only projects are generated for x64/x64 too. The current solution is to compile host tools for all architectures, which increases build time and isn't strictly necessary (although a benefit is that somebody will definitely notice if they break cross-compilation in this setup). Possible changes may be needed to remove _host.exe tools before distribution.
- node-gyp changes will need to be contributed upstream (?) and sent back down here.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines