4 REM Script for building the LLVM installer on Windows,
\r
5 REM used for the the weekly snapshots at http://www.llvm.org/builds.
\r
7 REM Usage: build_llvm_package.bat <revision>
\r
11 REM Visual Studio 2019, CMake, Ninja, GNUWin32, SWIG, Python 3,
\r
12 REM NSIS with the strlen_8192 patch,
\r
13 REM Visual Studio 2019 SDK and Nuget (for the clang-format plugin),
\r
14 REM Perl (for the OpenMP run-time), 7Zip.
\r
17 REM For LLDB, SWIG version <= 3.0.8 needs to be used to work around
\r
18 REM https://github.com/swig/swig/issues/769
\r
21 REM You need to modify the paths below:
\r
22 set vsdevcmd=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\Tools\VsDevCmd.bat
\r
24 set python32_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36-32
\r
25 set python64_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36
\r
27 for /f "usebackq" %%i in (`PowerShell ^(Get-Date^).ToString^('yyyyMMdd'^)`) do set datestamp=%%i
\r
30 set package_version=14.0.0-%revision:~0,8%
\r
31 set clang_format_vs_version=14.0.0.%datestamp%
\r
32 set build_dir=llvm_package_%revision:~0,8%
\r
34 echo Revision: %revision%
\r
35 echo Package version: %package_version%
\r
36 echo Clang format plugin version: %clang_format_vs_version%
\r
37 echo Build dir: %build_dir%
\r
44 echo Checking out %revision%
\r
45 curl -L https://github.com/llvm/llvm-project/archive/%revision%.zip -o src.zip || exit /b
\r
46 7z x src.zip || exit /b
\r
47 mv llvm-project-* llvm-project || exit /b
\r
49 REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226.
\r
51 -DCMAKE_BUILD_TYPE=Release ^
\r
52 -DLLVM_ENABLE_ASSERTIONS=ON ^
\r
53 -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
\r
54 -DLLVM_BUILD_LLVM_C_DYLIB=ON ^
\r
55 -DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^
\r
56 -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% ^
\r
57 -DPACKAGE_VERSION=%package_version% ^
\r
58 -DLLDB_RELOCATABLE_PYTHON=1 ^
\r
59 -DLLDB_TEST_COMPILER=%cd%\build32_stage0\bin\clang.exe ^
\r
60 -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: " ^
\r
61 -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;compiler-rt;openmp;lldb"
\r
63 REM TODO: Run the "check-all" tests.
\r
65 set "VSCMD_START_DIR=%CD%"
\r
66 call "%vsdevcmd%" -arch=x86
\r
69 mkdir build32_stage0
\r
71 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm-project\llvm || exit /b
\r
72 ninja all || ninja all || ninja all || exit /b
\r
73 ninja check || ninja check || ninja check || exit /b
\r
74 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
75 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
76 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
77 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
78 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
83 set CC=..\build32_stage0\bin\clang-cl
\r
84 set CXX=..\build32_stage0\bin\clang-cl
\r
85 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm-project\llvm || exit /b
\r
86 ninja all || ninja all || ninja all || exit /b
\r
87 ninja check || ninja check || ninja check || exit /b
\r
88 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
89 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
90 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
91 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
92 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
93 ninja package || exit /b
\r
95 7z x LLVM-%package_version%-win32.exe -orepack
\r
96 rmdir /s /q repack\$PLUGINSDIR
\r
97 del repack\Uninstall.exe
\r
98 7z a LLVM-%package_version%-win32.zip .\repack\* -mx9
\r
102 REM The plug-in is built separately as it uses a statically linked clang-format.exe.
\r
105 REM Having VSSDKINSTALL set makes devenv *not* find the SDK for some reason.
\r
107 set CC=..\build32_stage0\bin\clang-cl
\r
108 set CXX=..\build32_stage0\bin\clang-cl
\r
109 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
\r
110 ninja clang_format_vsix || exit /b
\r
111 copy ..\llvm-project\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangFormat.vsix ClangFormat-r%revision%.vsix
\r
115 set "VSCMD_START_DIR=%CD%"
\r
116 call "%vsdevcmd%" -arch=amd64
\r
119 mkdir build64_stage0
\r
121 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe ..\llvm-project\llvm || exit /b
\r
122 ninja all || ninja all || ninja all || exit /b
\r
123 ninja check || ninja check || ninja check || exit /b
\r
124 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
125 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
126 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
127 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
128 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
133 set CC=..\build64_stage0\bin\clang-cl
\r
134 set CXX=..\build64_stage0\bin\clang-cl
\r
135 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe ..\llvm-project\llvm || exit /b
\r
136 ninja all || ninja all || ninja all || exit /b
\r
137 ninja check || ninja check || ninja check || exit /b
\r
138 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
139 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
140 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
141 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
142 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
143 ninja package || exit /b
\r
145 7z x LLVM-%package_version%-win64.exe -orepack
\r
146 rmdir /s /q repack\$PLUGINSDIR
\r
147 del repack\Uninstall.exe
\r
148 7z a LLVM-%package_version%-win64.zip .\repack\* -mx9
\r