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, SVN, 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).
\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
29 set package_version=10.0.0-r%revision%
\r
30 set clang_format_vs_version=10.0.0.%revision%
\r
31 set build_dir=llvm_package_%revision%
\r
33 echo Branch: %branch%
\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 %branch% at r%revision%...
\r
45 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/llvm/%branch% llvm || exit /b
\r
46 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/cfe/%branch% llvm/tools/clang || exit /b
\r
47 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/clang-tools-extra/%branch% llvm/tools/clang/tools/extra || exit /b
\r
48 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/lld/%branch% llvm/tools/lld || exit /b
\r
49 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/compiler-rt/%branch% llvm/projects/compiler-rt || exit /b
\r
50 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/openmp/%branch% llvm/projects/openmp || exit /b
\r
51 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/lldb/%branch% llvm/tools/lldb || exit /b
\r
54 REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226.
\r
56 -DCMAKE_BUILD_TYPE=Release ^
\r
57 -DLLVM_ENABLE_ASSERTIONS=ON ^
\r
58 -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
\r
59 -DLLVM_BUILD_LLVM_C_DYLIB=ON ^
\r
60 -DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^
\r
61 -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% ^
\r
62 -DPACKAGE_VERSION=%package_version% ^
\r
63 -DLLDB_RELOCATABLE_PYTHON=1 ^
\r
64 -DLLDB_TEST_COMPILER=%cd%\build32_stage0\bin\clang.exe ^
\r
65 -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: "
\r
67 REM TODO: Run the "check-all" tests.
\r
69 set "VSCMD_START_DIR=%CD%"
\r
70 call "%vsdevcmd%" -arch=x86
\r
73 mkdir build32_stage0
\r
75 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm || exit /b
\r
76 ninja all || ninja all || ninja all || exit /b
\r
77 ninja check || ninja check || ninja check || exit /b
\r
78 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
79 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
80 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
81 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
82 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
87 set CC=..\build32_stage0\bin\clang-cl
\r
88 set CXX=..\build32_stage0\bin\clang-cl
\r
89 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm || exit /b
\r
90 ninja all || ninja all || ninja all || exit /b
\r
91 ninja check || ninja check || ninja check || exit /b
\r
92 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
93 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
94 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
95 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
96 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
97 ninja package || exit /b
\r
100 REM The plug-in is built separately as it uses a statically linked clang-format.exe.
\r
103 REM Having VSSDKINSTALL set makes devenv *not* find the SDK for some reason.
\r
105 set CC=..\build32_stage0\bin\clang-cl
\r
106 set CXX=..\build32_stage0\bin\clang-cl
\r
107 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 || exit /b
\r
108 ninja clang_format_vsix || exit /b
\r
109 copy ..\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangFormat.vsix ClangFormat-r%revision%.vsix
\r
113 set "VSCMD_START_DIR=%CD%"
\r
114 call "%vsdevcmd%" -arch=amd64
\r
117 mkdir build64_stage0
\r
119 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe ..\llvm || exit /b
\r
120 ninja all || ninja all || ninja all || exit /b
\r
121 ninja check || ninja check || ninja check || exit /b
\r
122 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
123 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
124 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
125 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
126 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
131 set CC=..\build64_stage0\bin\clang-cl
\r
132 set CXX=..\build64_stage0\bin\clang-cl
\r
133 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe ..\llvm || exit /b
\r
134 ninja all || ninja all || ninja all || exit /b
\r
135 ninja check || ninja check || ninja check || exit /b
\r
136 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
137 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
138 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
139 ninja check-clang-tools || ninja check-clang-tools || ninja check-clang-tools || exit /b
\r
140 ninja check-clangd || ninja check-clangd || ninja check-clangd || exit /b
\r
141 ninja package || exit /b
\r