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 2017, CMake, Ninja, SVN, GNUWin32, SWIG, Python 3,
\r
12 REM NSIS with the strlen_8192 patch,
\r
13 REM Visual Studio 2017 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\2017\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 REM Work around VS2017 bug by using MinSizeRel.
\r
76 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b
\r
77 ninja all || ninja all || ninja all || exit /b
\r
78 ninja check || ninja check || ninja check || exit /b
\r
79 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
80 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
81 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
86 set CC=..\build32_stage0\bin\clang-cl
\r
87 set CXX=..\build32_stage0\bin\clang-cl
\r
88 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DPYTHON_EXECUTABLE=%python32_dir%\python.exe ..\llvm || exit /b
\r
89 ninja all || ninja all || ninja all || exit /b
\r
90 ninja check || ninja check || ninja check || exit /b
\r
91 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
92 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
93 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
94 ninja package || exit /b
\r
97 REM The plug-in is built separately as it uses a statically linked clang-format.exe.
\r
100 set CC=..\build32_stage0\bin\clang-cl
\r
101 set CXX=..\build32_stage0\bin\clang-cl
\r
102 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
103 ninja clang_format_vsix || exit /b
\r
104 copy ..\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangFormat.vsix ClangFormat-r%revision%.vsix
\r
108 set "VSCMD_START_DIR=%CD%"
\r
109 call "%vsdevcmd%" -arch=amd64
\r
112 mkdir build64_stage0
\r
114 REM Work around VS2017 bug by using MinSizeRel.
\r
115 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b
\r
116 ninja all || ninja all || ninja all || exit /b
\r
117 ninja check || ninja check || ninja check || exit /b
\r
118 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
119 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
120 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
125 set CC=..\build64_stage0\bin\clang-cl
\r
126 set CXX=..\build64_stage0\bin\clang-cl
\r
127 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DPYTHON_EXECUTABLE=%python64_dir%\python.exe ..\llvm || exit /b
\r
128 ninja all || ninja all || ninja all || exit /b
\r
129 ninja check || ninja check || ninja check || exit /b
\r
130 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
131 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
132 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
133 ninja package || exit /b
\r