Skip to content

Commit

Permalink
win,msi: download x64 node executable when cross-compiling for arm64
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dennisameling committed Aug 8, 2020
1 parent e1eb56f commit d60e8a9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ _UpgradeReport_Files/
# Ignore dependencies fetched by deps/v8/tools/node/fetch_deps.py
/deps/.cipd

# === Rules for Windows vcbuild.bat ===
/temp-vcbuild

# === Global Rules ===
# Keep last to avoid being excluded
*.pyc
Expand Down
14 changes: 14 additions & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ if defined package set stage_package=1

:: assign path to node_exe
set "node_exe=%config%\node.exe"
if "%target_arch%"=="arm64" if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
if not defined "%x64_node_exe%" set "x64_node_exe=temp-vcbuild\node-x64-cross-compiling.exe"
if not exist "%x64_node_exe%" (
echo Downloading x64 node.exe...
if not exist "temp-vcbuild" mkdir temp-vcbuild
powershell -c "Invoke-WebRequest -Uri 'https://nodejs.org/dist/latest/win-x64/node.exe' -OutFile 'temp-vcbuild\node-x64-cross-compiling.exe'"
)
if not exist "%x64_node_exe%" (
echo Could not find the Node executable at the given x64_node_exe path. Aborting.
goto exit
)
echo Using x64 Node executable because we're cross-compiling for arm64: %x64_node_exe%
set "node_exe=%x64_node_exe%"
)
set "node_gyp_exe="%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp"
set "npm_exe="%~dp0%node_exe%" %~dp0deps\npm\bin\npm-cli.js"
if "%target_env%"=="vs2019" set "node_gyp_exe=%node_gyp_exe% --msvs_version=2019"
Expand Down

0 comments on commit d60e8a9

Please sign in to comment.