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=9.0.0-r%revision%
\r
30 set clang_format_vs_version=9.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
55 set cmake_flags=-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=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: "
\r
57 REM TODO: Run the "check-all" tests.
\r
59 set "VSCMD_START_DIR=%CD%"
\r
60 call "%vsdevcmd%" -arch=x86
\r
63 mkdir build32_stage0
\r
65 REM Work around VS2017 bug by using MinSizeRel.
\r
66 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b
\r
67 ninja all || ninja all || ninja all || exit /b
\r
68 ninja check || ninja check || ninja check || exit /b
\r
69 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
70 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
71 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
76 set CC=..\build32_stage0\bin\clang-cl
\r
77 set CXX=..\build32_stage0\bin\clang-cl
\r
78 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% ..\llvm || exit /b
\r
79 ninja all || ninja all || ninja all || exit /b
\r
80 ninja check || ninja check || ninja check || exit /b
\r
81 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
82 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
83 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
84 ninja package || exit /b
\r
87 REM The plug-in is built separately as it uses a statically linked clang-format.exe.
\r
90 set CC=..\build32_stage0\bin\clang-cl
\r
91 set CXX=..\build32_stage0\bin\clang-cl
\r
92 cmake -GNinja %cmake_flags% -DLLVM_USE_CRT_RELEASE=MT -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON -DPYTHON_HOME=%python32_dir% ..\llvm || exit /b
\r
93 ninja clang_format_vsix || exit /b
\r
94 copy ..\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangFormat.vsix ClangFormat-r%revision%.vsix
\r
98 set "VSCMD_START_DIR=%CD%"
\r
99 call "%vsdevcmd%" -arch=amd64
\r
102 mkdir build64_stage0
\r
104 REM Work around VS2017 bug by using MinSizeRel.
\r
105 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b
\r
106 ninja all || ninja all || ninja all || exit /b
\r
107 ninja check || ninja check || ninja check || exit /b
\r
108 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
109 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
110 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
115 set CC=..\build64_stage0\bin\clang-cl
\r
116 set CXX=..\build64_stage0\bin\clang-cl
\r
117 cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% ..\llvm || exit /b
\r
118 ninja all || ninja all || ninja all || exit /b
\r
119 ninja check || ninja check || ninja check || exit /b
\r
120 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
121 ninja check-lld || ninja check-lld || ninja check-lld || exit /b
\r
122 ninja check-sanitizer || ninja check-sanitizer || ninja check-sanitizer || exit /b
\r
123 ninja package || exit /b
\r