Skip to content

Commit 03293aa

Browse files
dennisamelingjoaocgreis
authored andcommitted
build,win: use x64 Node when building for ARM64
Uses x64 node executable for running .js files in arm64 cross-compilation scenarios. MSI can now be created by running `vcbuild.bat release msi arm64` Refs: nodejs#25998 Refs: nodejs#32582 PR-URL: nodejs#34009 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 5acc69c commit 03293aa

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ _UpgradeReport_Files/
131131
# Ignore dependencies fetched by deps/v8/tools/node/fetch_deps.py
132132
/deps/.cipd
133133

134+
# === Rules for Windows vcbuild.bat ===
135+
/temp-vcbuild
136+
134137
# === Global Rules ===
135138
# Keep last to avoid being excluded
136139
*.pyc

BUILDING.md

+2
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,8 @@ Optional requirements to build the MSI installer package:
544544

545545
* The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the
546546
[Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension).
547+
* The [WiX Toolset v3.14](https://wixtoolset.org/releases/) if
548+
building for Windows 10 on ARM (ARM64).
547549

548550
Optional requirements for compiling for Windows 10 on ARM (ARM64):
549551

vcbuild.bat

+20-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,26 @@ if errorlevel 1 echo Failed to sign exe&goto exit
362362
@rem Skip license.rtf generation if not requested.
363363
if not defined licensertf goto stage_package
364364

365-
%node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf
365+
set "use_x64_node_exe=false"
366+
if "%target_arch%"=="arm64" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set "use_x64_node_exe=true"
367+
if "%use_x64_node_exe%"=="true" (
368+
echo Cross-compilation to ARM64 detected. We'll use the x64 Node executable for license2rtf.
369+
if not defined "%x64_node_exe%" set "x64_node_exe=temp-vcbuild\node-x64-cross-compiling.exe"
370+
if not exist "%x64_node_exe%" (
371+
echo Downloading x64 node.exe...
372+
if not exist "temp-vcbuild" mkdir temp-vcbuild
373+
powershell -c "Invoke-WebRequest -Uri 'https://nodejs.org/dist/latest/win-x64/node.exe' -OutFile 'temp-vcbuild\node-x64-cross-compiling.exe'"
374+
)
375+
if not exist "%x64_node_exe%" (
376+
echo Could not find the Node executable at the given x64_node_exe path. Aborting.
377+
set exit_code=1
378+
goto exit
379+
)
380+
%x64_node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf
381+
) else (
382+
%node_exe% tools\license2rtf.js < LICENSE > %config%\license.rtf
383+
)
384+
366385
if errorlevel 1 echo Failed to generate license.rtf&goto exit
367386

368387
:stage_package

0 commit comments

Comments
 (0)