@echo off\r
setlocal enabledelayedexpansion\r
\r
-if "%1"=="" goto usage\r
goto begin\r
\r
:usage\r
echo Script for building the LLVM installer on Windows,\r
echo used for the releases at https://github.com/llvm/llvm-project/releases\r
echo.\r
-echo Usage: build_llvm_release.bat ^<version^>\r
+echo Usage: build_llvm_release.bat --version ^<version^> [--x86,--x64]\r
echo.\r
-echo Example: build_llvm_release.bat 14.0.4\r
+echo Options:\r
+echo --version: [required] version to build\r
+echo --help: display this help\r
+echo --x86: build and test x86 variant\r
+echo --x64: build and test x64 variant\r
echo.\r
+echo Note: At least one variant to build is required.\r
+echo.\r
+echo Example: build_llvm_release.bat --version 15.0.0 --x86 --x64\r
exit /b 1\r
\r
:begin\r
\r
+::==============================================================================\r
+:: parse args\r
+set version=\r
+set help=\r
+set x86=\r
+set x64=\r
+call :parse_args %*\r
+\r
+if "%help%" NEQ "" goto usage\r
+\r
+if "%version%" == "" (\r
+ echo --version option is required\r
+ echo =============================\r
+ goto usage\r
+)\r
+\r
+if "%x64%" == "" if "%x86%" == "" (\r
+ echo nothing to build!\r
+ echo choose one or several variants from: --x86 --x64\r
+ exit /b 1\r
+)\r
+\r
+::==============================================================================\r
+:: check prerequisites\r
REM Note:\r
REM 7zip versions 21.x and higher will try to extract the symlinks in\r
REM llvm's git archive, which requires running as administrator.\r
\r
REM Check 7-zip version and/or administrator permissions.\r
-for /f "delims=" %%i in ('7z.exe ^| findstr /r "2[1-9].[0-9][0-9]"') do set version=%%i\r
-if not "%version%"=="" (\r
+for /f "delims=" %%i in ('7z.exe ^| findstr /r "2[1-9].[0-9][0-9]"') do set version_7z=%%i\r
+if not "%version_7z%"=="" (\r
REM Unique temporary filename to use by the 'mklink' command.\r
set "link_name=%temp%\%username%_%random%_%random%.tmp"\r
\r
if errorlevel 1 (\r
echo.\r
echo Script requires administrator permissions, or a 7-zip version 20.x or older.\r
- echo Current version is "%version%"\r
+ echo Current version is "%version_7z%"\r
exit /b 1\r
) else (\r
REM Remove the temporary symbolic link.\r
REM\r
REM For LLDB, SWIG version <= 3.0.8 needs to be used to work around\r
REM https://github.com/swig/swig/issues/769\r
+REM\r
\r
-\r
+:: Detect Visual Studio\r
set vsdevcmd=\r
set vs_2019_prefix=C:\Program Files (x86)\Microsoft Visual Studio\2019\r
:: try potential activated visual studio, then 2019, with different editions\r
)\r
echo Using VS devcmd: %vsdevcmd%\r
\r
+::==============================================================================\r
:: start echoing what we do\r
@echo on\r
+\r
set python32_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python310-32\r
set python64_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python310\r
\r
-set revision=llvmorg-%1\r
-set package_version=%1\r
+set revision=llvmorg-%version%\r
+set package_version=%version%\r
set build_dir=%cd%\llvm_package_%package_version%\r
\r
echo Revision: %revision%\r
set OLDPATH=%PATH%\r
\r
REM Build the 32-bits and/or 64-bits binaries.\r
-call :do_build_32 || exit /b 1\r
-call :do_build_64 || exit /b 1\r
+if "%x86%" == "true" call :do_build_32 || exit /b 1\r
+if "%x64%" == "true" call :do_build_64 || exit /b 1\r
exit /b 0\r
\r
::==============================================================================\r