doc,build,win: update docs with clang

Updated BUILDING.md to make ClangCL mandatory for new versions of Node.
Forcing clang-cl flag in vcbuild if not specified, thus disabling MSVC.

PR-URL: https://github.com/nodejs/node/pull/57991
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Stefan Stojanovic 2025-04-30 13:35:41 +02:00 committed by GitHub
parent e61aa0c356
commit 2244a09774
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 9 deletions

View file

@ -634,7 +634,10 @@ Refs:
[Visual Studio 2022 (17.6 or newer)](https://visualstudio.microsoft.com/downloads/)
or the "C++ build tools" workload from the
[Build Tools](https://aka.ms/vs/17/release/vs_buildtools.exe),
with the default optional components
with the default optional components. Starting with Node.js v24, ClangCL is required to compile
on Windows. To enable it, two additional components are needed:
* C++ Clang Compiler for Windows (Microsoft.VisualStudio.Component.VC.Llvm.Clang)
* MSBuild support for LLVM toolset (Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset)
* Basic Unix tools required for some tests,
[Git for Windows](https://git-scm.com/download/win) includes Git Bash
and tools which can be included in the global `PATH`.
@ -658,13 +661,6 @@ Optional requirements for compiling for Windows on ARM (ARM64):
* Visual C++ ATL for ARM64
* Windows 10 SDK 10.0.17763.0 or newer
Optional requirements for compiling with ClangCL (search for `clang` in Visual Studio
Installer's "individual component" tab):
* Visual Studio individual components
* C++ Clang Compiler for Windows
* MSBuild support for LLVM toolset
NOTE: Currently we only support compiling with Clang that comes from Visual Studio.
When building with ClangCL, if the output from `vcbuild.bat` shows that the components are not installed

View file

@ -18,7 +18,7 @@ choco install python3 -y
# Installs VS 2022 Build Tools
choco install visualstudio2022buildtools -y
choco install visualstudio2022-workload-vctools -y --params="--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64"
choco install visualstudio2022-workload-vctools -y --params="--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --add Microsoft.NetCore.Component.SDK --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset"
# NASM
choco install nasm -y

View file

@ -237,6 +237,14 @@ if errorlevel 1 echo Could not find NASM, install it or build with openssl-no-as
call :getnodeversion || exit /b 1
@REM Forcing ClangCL usage for version 24 and above
set NODE_MAJOR_VERSION=
for /F "tokens=1 delims=." %%i in ("%NODE_VERSION%") do set "NODE_MAJOR_VERSION=%%i"
if %NODE_MAJOR_VERSION% GEQ 24 (
echo Using ClangCL because the Node.js version being compiled is >= 24.
set clang_cl=1
)
if defined TAG set configure_flags=%configure_flags% --tag=%TAG%
if not "%target%"=="Clean" goto skip-clean