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,
\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 You need to modify the paths below:
\r
18 set vsdevcmd=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat
\r
22 set package_version=8.0.0-r%revision%
\r
23 set clang_format_vs_version=8.0.0.%revision%
\r
24 set build_dir=llvm_package_%revision%
\r
26 echo Branch: %branch%
\r
27 echo Revision: %revision%
\r
28 echo Package version: %package_version%
\r
29 echo Clang format plugin version: %clang_format_vs_version%
\r
30 echo Build dir: %build_dir%
\r
37 echo Checking out %branch% at r%revision%...
\r
38 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/llvm/%branch% llvm || exit /b
\r
39 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/cfe/%branch% llvm/tools/clang || exit /b
\r
40 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/clang-tools-extra/%branch% llvm/tools/clang/tools/extra || exit /b
\r
41 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/lld/%branch% llvm/tools/lld || exit /b
\r
42 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/compiler-rt/%branch% llvm/projects/compiler-rt || exit /b
\r
43 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/openmp/%branch% llvm/projects/openmp || exit /b
\r
46 REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226.
\r
47 set cmake_flags=-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_USE_CRT_RELEASE=MT -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% -DPACKAGE_VERSION=%package_version% -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: "
\r
49 REM TODO: Run all tests, including lld and compiler-rt.
\r
51 set "VSCMD_START_DIR=%CD%"
\r
52 call "%vsdevcmd%" -arch=x86
\r
55 mkdir build32_stage0
\r
57 REM Work around VS2017 bug by using MinSizeRel.
\r
58 cmake -GNinja %cmake_flags% -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b
\r
59 ninja all || ninja all || ninja all || exit /b
\r
60 ninja check || ninja check || ninja check || exit /b
\r
61 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
66 set CC=..\build32_stage0\bin\clang-cl
\r
67 set CXX=..\build32_stage0\bin\clang-cl
\r
68 cmake -GNinja %cmake_flags% ..\llvm || exit /b
\r
69 ninja all || ninja all || ninja all || exit /b
\r
70 ninja check || ninja check || ninja check || exit /b
\r
71 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
72 ninja package || exit /b
\r
75 REM The plug-in is built separately as it uses a statically linked clang-format.exe.
\r
78 set CC=..\build32_stage0\bin\clang-cl
\r
79 set CXX=..\build32_stage0\bin\clang-cl
\r
80 cmake -GNinja %cmake_flags% -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON ..\llvm || exit /b
\r
81 ninja clang_format_vsix || exit /b
\r
82 copy ..\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangFormat.vsix ClangFormat-r%revision%.vsix
\r
86 set "VSCMD_START_DIR=%CD%"
\r
87 call "%vsdevcmd%" -arch=amd64
\r
90 mkdir build64_stage0
\r
92 REM Work around VS2017 bug by using MinSizeRel.
\r
93 cmake -GNinja %cmake_flags% -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b
\r
94 ninja all || ninja all || ninja all || exit /b
\r
95 ninja check || ninja check || ninja check || exit /b
\r
96 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
101 set CC=..\build64_stage0\bin\clang-cl
\r
102 set CXX=..\build64_stage0\bin\clang-cl
\r
103 cmake -GNinja %cmake_flags% ..\llvm || exit /b
\r
104 ninja all || ninja all || ninja all || exit /b
\r
105 ninja check || ninja check || ninja check || exit /b
\r
106 ninja check-clang || ninja check-clang || ninja check-clang || exit /b
\r
107 ninja package || exit /b
\r