Skip to content

[llvm] Build Windows release package with clang-cl if possible #135446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion llvm/utils/release/build_llvm_release.bat
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ goto begin
echo Script for building the LLVM installer on Windows,
echo used for the releases at https://github.com/llvm/llvm-project/releases
echo.
echo Usage: build_llvm_release.bat --version ^<version^> [--x86,--x64, --arm64] [--skip-checkout] [--local-python]
echo Usage: build_llvm_release.bat --version ^<version^> [--x86,--x64, --arm64] [--skip-checkout] [--local-python] [--force-msvc]
echo.
echo Options:
echo --version: [required] version to build
@@ -17,6 +17,7 @@ echo --x64: build and test x64 variant
echo --arm64: build and test arm64 variant
echo --skip-checkout: use local git checkout instead of downloading src.zip
echo --local-python: use installed Python and does not try to use a specific version (3.10)
echo --force-msvc: use MSVC compiler for stage0, even if clang-cl is present
echo.
echo Note: At least one variant to build is required.
echo.
@@ -34,6 +35,7 @@ set x64=
set arm64=
set skip-checkout=
set local-python=
set force-msvc=
call :parse_args %*

if "%help%" NEQ "" goto usage
@@ -165,6 +167,24 @@ set common_cmake_flags=^
-DLLVM_ENABLE_RPMALLOC=ON ^
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;compiler-rt;lldb;openmp"

if "%force-msvc%" == "" (
where /q clang-cl
if errorlevel 0 (
where /q lld-link
if errorlevel 0 (
set common_compiler_flags=%common_compiler_flags% -fuse-ld=lld

set common_cmake_flags=%common_cmake_flags%^
-DCMAKE_C_COMPILER=clang-cl.exe ^
-DCMAKE_CXX_COMPILER=clang-cl.exe ^
-DCMAKE_LINKER=lld-link.exe ^
-DLLVM_ENABLE_LLD=ON ^
-DCMAKE_C_FLAGS="%common_compiler_flags%" ^
-DCMAKE_CXX_FLAGS="%common_compiler_flags%"
)
)
)

set cmake_profile_flags=""

REM Preserve original path