2015-12-11 01:43:42 +01:00
|
|
|
@echo off
|
|
|
|
setlocal
|
|
|
|
|
|
|
|
REM Script for building the LLVM installer on Windows,
|
|
|
|
REM used for the the weekly snapshots at http://www.llvm.org/builds.
|
|
|
|
REM
|
|
|
|
REM Usage: build_llvm_package.bat <revision>
|
|
|
|
|
|
|
|
REM Prerequisites:
|
|
|
|
REM
|
2019-11-27 09:04:04 +01:00
|
|
|
REM Visual Studio 2019, CMake, Ninja, GNUWin32, SWIG, Python 3,
|
2015-12-11 01:43:42 +01:00
|
|
|
REM NSIS with the strlen_8192 patch,
|
2019-09-26 16:57:55 +02:00
|
|
|
REM Visual Studio 2019 SDK and Nuget (for the clang-format plugin),
|
2020-02-25 12:13:09 +01:00
|
|
|
REM Perl (for the OpenMP run-time), 7Zip.
|
2019-01-16 09:38:28 +01:00
|
|
|
REM
|
|
|
|
REM
|
|
|
|
REM For LLDB, SWIG version <= 3.0.8 needs to be used to work around
|
|
|
|
REM https://github.com/swig/swig/issues/769
|
2015-12-11 01:43:42 +01:00
|
|
|
|
|
|
|
|
2016-09-16 01:01:03 +02:00
|
|
|
REM You need to modify the paths below:
|
2019-09-26 16:57:55 +02:00
|
|
|
set vsdevcmd=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat
|
2017-04-14 01:13:23 +02:00
|
|
|
|
2019-01-16 09:38:28 +01:00
|
|
|
set python32_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36-32
|
|
|
|
set python64_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36
|
|
|
|
|
2019-11-27 09:04:04 +01:00
|
|
|
for /f "usebackq" %%i in (`PowerShell ^(Get-Date^).ToString^('yyyyMMdd'^)`) do set datestamp=%%i
|
|
|
|
|
2015-12-11 01:43:42 +01:00
|
|
|
set revision=%1
|
2020-02-03 16:39:18 +01:00
|
|
|
set package_version=11.0.0-%revision:~0,8%
|
2020-01-15 10:02:56 +01:00
|
|
|
set clang_format_vs_version=11.0.0.%datestamp%
|
2020-02-03 16:39:18 +01:00
|
|
|
set build_dir=llvm_package_%revision:~0,8%
|
2015-12-11 01:43:42 +01:00
|
|
|
|
|
|
|
echo Revision: %revision%
|
|
|
|
echo Package version: %package_version%
|
|
|
|
echo Clang format plugin version: %clang_format_vs_version%
|
|
|
|
echo Build dir: %build_dir%
|
|
|
|
echo.
|
|
|
|
pause
|
|
|
|
|
|
|
|
mkdir %build_dir%
|
|
|
|
cd %build_dir%
|
|
|
|
|
2019-11-27 09:04:04 +01:00
|
|
|
echo Checking out %revision%
|
|
|
|
curl -L https://github.com/llvm/llvm-project/archive/%revision%.zip -o src.zip || exit /b
|
|
|
|
7z x src.zip || exit /b
|
|
|
|
mv llvm-project-* llvm-project || exit /b
|
2015-12-11 01:43:42 +01:00
|
|
|
|
2016-05-03 18:43:40 +02:00
|
|
|
REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226.
|
2019-03-19 10:14:09 +01:00
|
|
|
set cmake_flags=^
|
2019-11-27 09:04:04 +01:00
|
|
|
-DCMAKE_BUILD_TYPE=Release ^
|
|
|
|
-DLLVM_ENABLE_ASSERTIONS=ON ^
|
|
|
|
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
|
|
|
|
-DLLVM_BUILD_LLVM_C_DYLIB=ON ^
|
|
|
|
-DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^
|
|
|
|
-DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% ^
|
|
|
|
-DPACKAGE_VERSION=%package_version% ^
|
|
|
|
-DLLDB_RELOCATABLE_PYTHON=1 ^
|
|
|
|
-DLLDB_TEST_COMPILER=%cd%\build32_stage0\bin\clang.exe ^
|
|
|
|
-DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: " ^
|
|
|
|
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;compiler-rt;openmp;lldb"
|
2018-11-09 23:05:51 +01:00
|
|
|
|
2019-01-17 14:11:15 +01:00
|
|
|
REM TODO: Run the "check-all" tests.
|
2015-12-11 01:43:42 +01:00
|
|
|
|
2018-01-25 15:43:10 +01:00
|
|
|
set "VSCMD_START_DIR=%CD%"
|
2017-04-14 01:13:23 +02:00
|
|
|
call "%vsdevcmd%" -arch=x86
|
2015-12-11 01:43:42 +01:00
|
|
|
set CC=
|
|
|
|
set CXX=
|
|
|
|
mkdir build32_stage0
|
|
|
|
cd build32_stage0
|
2019-11-27 09:04:04 +01:00
|
|
|
cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm-project\llvm || exit /b
|
2018-07-03 13:30:01 +02:00
|
|
|
ninja all || ninja all || ninja all || exit /b
|
2016-07-27 22:38:01 +02:00
|
|
|
ninja check || ninja check || ninja check || exit /b
|
2019-01-17 14:11:15 +01:00
|
|
|
ninja check-clang || ninja check-clang || ninja check-clang || exit /b
|
|
|
|
ninja check-lld || ninja check-lld || ninja check-lld || exit /b
|
|
|
|
ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
|
2019-10-14 19:52:31 +02:00
|
|
|
ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
|
|
|
|
ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
|
2015-12-11 01:43:42 +01:00
|
|
|
cd..
|
|
|
|
|
|
|
|
mkdir build32
|
|
|
|
cd build32
|
|
|
|
set CC=..\build32_stage0\bin\clang-cl
|
|
|
|
set CXX=..\build32_stage0\bin\clang-cl
|
2019-11-27 09:04:04 +01:00
|
|
|
cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm-project\llvm || exit /b
|
2018-07-03 13:30:01 +02:00
|
|
|
ninja all || ninja all || ninja all || exit /b
|
2016-07-27 22:38:01 +02:00
|
|
|
ninja check || ninja check || ninja check || exit /b
|
2019-01-17 14:11:15 +01:00
|
|
|
ninja check-clang || ninja check-clang || ninja check-clang || exit /b
|
|
|
|
ninja check-lld || ninja check-lld || ninja check-lld || exit /b
|
|
|
|
ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
|
2019-10-14 19:52:31 +02:00
|
|
|
ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
|
|
|
|
ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
|
2015-12-11 01:43:42 +01:00
|
|
|
ninja package || exit /b
|
2020-02-25 12:13:09 +01:00
|
|
|
|
|
|
|
7z x LLVM-%package_version%-win32.exe -orepack
|
|
|
|
rmdir /s /q repack\$PLUGINSDIR
|
|
|
|
del repack\Uninstall.exe
|
|
|
|
7z a LLVM-%package_version%-win32.zip .\repack\* -mx9
|
2015-12-11 01:43:42 +01:00
|
|
|
cd ..
|
|
|
|
|
2020-02-25 12:13:09 +01:00
|
|
|
|
2017-04-14 01:13:23 +02:00
|
|
|
REM The plug-in is built separately as it uses a statically linked clang-format.exe.
|
2017-02-08 21:58:33 +01:00
|
|
|
mkdir build_vsix
|
|
|
|
cd build_vsix
|
2019-09-26 16:57:55 +02:00
|
|
|
REM Having VSSDKINSTALL set makes devenv *not* find the SDK for some reason.
|
|
|
|
set VSSDKINSTALL=
|
2017-02-08 21:58:33 +01:00
|
|
|
set CC=..\build32_stage0\bin\clang-cl
|
|
|
|
set CXX=..\build32_stage0\bin\clang-cl
|
2019-11-27 09:04:04 +01:00
|
|
|
cmake -GNinja %cmake_flags% -DLLVM_USE_CRT_RELEASE=MT -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm-project\llvm || exit /b
|
2017-02-08 21:58:33 +01:00
|
|
|
ninja clang_format_vsix || exit /b
|
2019-11-27 09:04:04 +01:00
|
|
|
copy ..\llvm-project\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangFormat.vsix ClangFormat-r%revision%.vsix
|
2017-02-08 21:58:33 +01:00
|
|
|
cd ..
|
|
|
|
|
2015-12-11 01:43:42 +01:00
|
|
|
|
2018-01-25 15:43:10 +01:00
|
|
|
set "VSCMD_START_DIR=%CD%"
|
2017-04-14 01:13:23 +02:00
|
|
|
call "%vsdevcmd%" -arch=amd64
|
2015-12-11 01:43:42 +01:00
|
|
|
set CC=
|
|
|
|
set CXX=
|
|
|
|
mkdir build64_stage0
|
|
|
|
cd build64_stage0
|
2019-11-27 09:04:04 +01:00
|
|
|
cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe ..\llvm-project\llvm || exit /b
|
2018-07-03 13:30:01 +02:00
|
|
|
ninja all || ninja all || ninja all || exit /b
|
2016-07-27 22:38:01 +02:00
|
|
|
ninja check || ninja check || ninja check || exit /b
|
2019-01-17 14:11:15 +01:00
|
|
|
ninja check-clang || ninja check-clang || ninja check-clang || exit /b
|
|
|
|
ninja check-lld || ninja check-lld || ninja check-lld || exit /b
|
|
|
|
ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
|
2019-10-14 19:52:31 +02:00
|
|
|
ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
|
|
|
|
ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
|
2015-12-11 01:43:42 +01:00
|
|
|
cd..
|
|
|
|
|
|
|
|
mkdir build64
|
|
|
|
cd build64
|
|
|
|
set CC=..\build64_stage0\bin\clang-cl
|
|
|
|
set CXX=..\build64_stage0\bin\clang-cl
|
2019-11-27 09:04:04 +01:00
|
|
|
cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe ..\llvm-project\llvm || exit /b
|
2018-07-03 13:30:01 +02:00
|
|
|
ninja all || ninja all || ninja all || exit /b
|
2016-07-27 22:38:01 +02:00
|
|
|
ninja check || ninja check || ninja check || exit /b
|
2019-01-17 14:11:15 +01:00
|
|
|
ninja check-clang || ninja check-clang || ninja check-clang || exit /b
|
|
|
|
ninja check-lld || ninja check-lld || ninja check-lld || exit /b
|
|
|
|
ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
|
2019-10-14 19:52:31 +02:00
|
|
|
ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
|
|
|
|
ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
|
2015-12-11 01:43:42 +01:00
|
|
|
ninja package || exit /b
|
2020-02-25 12:13:09 +01:00
|
|
|
|
|
|
|
7z x LLVM-%package_version%-win64.exe -orepack
|
|
|
|
rmdir /s /q repack\$PLUGINSDIR
|
|
|
|
del repack\Uninstall.exe
|
|
|
|
7z a LLVM-%package_version%-win64.zip .\repack\* -mx9
|
2015-12-11 01:43:42 +01:00
|
|
|
cd ..
|