@@ -7,7 +7,7 @@ goto begin
77echo Script for building the LLVM installer on Windows,
88echo used for the releases at https://github.com/llvm/llvm-project/releases
99echo .
10- echo Usage: build_llvm_release.bat --version ^ < version^ > [--x86,--x64, --arm64] [--skip-checkout] [--local-python]
10+ echo Usage: build_llvm_release.bat --version ^ < version^ > [--x86,--x64, --arm64] [--skip-checkout] [--local-python] [--force-msvc]
1111echo .
1212echo Options:
1313echo --version: [required] version to build
@@ -17,6 +17,7 @@ echo --x64: build and test x64 variant
1717echo --arm64: build and test arm64 variant
1818echo --skip-checkout: use local git checkout instead of downloading src.zip
1919echo --local-python: use installed Python and does not try to use a specific version (3.10)
20+ echo --force-msvc: use MSVC compiler for stage0, even if clang-cl is present
2021echo .
2122echo Note: At least one variant to build is required.
2223echo .
@@ -34,6 +35,7 @@ set x64=
3435set arm64 =
3536set skip-checkout =
3637set local-python =
38+ set force-msvc =
3739call :parse_args %*
3840
3941if " %help% " NEQ " " goto usage
@@ -165,6 +167,24 @@ set common_cmake_flags=^
165167 -DLLVM_ENABLE_RPMALLOC=ON ^
166168 -DLLVM_ENABLE_PROJECTS=" clang;clang-tools-extra;lld;compiler-rt;lldb;openmp"
167169
170+ if " %force-msvc% " == " " (
171+ where /q clang-cl
172+ if errorlevel 0 (
173+ where /q lld-link
174+ if errorlevel 0 (
175+ set common_compiler_flags = %common_compiler_flags% -fuse-ld=lld
176+
177+ set common_cmake_flags = %common_cmake_flags% ^
178+ -DCMAKE_C_COMPILER=clang-cl.exe ^
179+ -DCMAKE_CXX_COMPILER=clang-cl.exe ^
180+ -DCMAKE_LINKER=lld-link.exe ^
181+ -DLLVM_ENABLE_LLD=ON ^
182+ -DCMAKE_C_FLAGS=" %common_compiler_flags% " ^
183+ -DCMAKE_CXX_FLAGS=" %common_compiler_flags% "
184+ )
185+ )
186+ )
187+
168188set cmake_profile_flags = " "
169189
170190REM Preserve original path
0 commit comments