• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo off
2setlocal
3
4REM Script for building the LLVM installer on Windows,
5REM used for the the weekly snapshots at http://www.llvm.org/builds.
6REM
7REM Usage: build_llvm_package.bat <revision>
8
9REM Prerequisites:
10REM
11REM   Visual Studio 2013, CMake, Ninja, SVN, GNUWin32,
12REM   NSIS with the strlen_8192 patch,
13REM   Visual Studio 2013 SDK (for the clang-format plugin).
14
15
16REM You may need to modify the paths below:
17set vcdir=c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
18set PATH=%PATH%;c:\gnuwin32\bin
19
20set revision=%1
21set branch=trunk
22set package_version=3.9.0-r%revision%
23set clang_format_vs_version=3.9.0.%revision%
24set build_dir=llvm_package_%revision%
25
26echo Branch: %branch%
27echo Revision: %revision%
28echo Package version: %package_version%
29echo Clang format plugin version: %clang_format_vs_version%
30echo Build dir: %build_dir%
31echo.
32pause
33
34mkdir %build_dir%
35cd %build_dir%
36
37echo Checking out %branch% at r%revision%...
38svn.exe export -r %revision% http://llvm.org/svn/llvm-project/llvm/%branch% llvm || exit /b
39svn.exe export -r %revision% http://llvm.org/svn/llvm-project/cfe/%branch% llvm/tools/clang || exit /b
40svn.exe export -r %revision% http://llvm.org/svn/llvm-project/clang-tools-extra/%branch% llvm/tools/clang/tools/extra || exit /b
41svn.exe export -r %revision% http://llvm.org/svn/llvm-project/lld/%branch% llvm/tools/lld || exit /b
42svn.exe export -r %revision% http://llvm.org/svn/llvm-project/compiler-rt/%branch% llvm/projects/compiler-rt || exit /b
43svn.exe export -r %revision% http://llvm.org/svn/llvm-project/openmp/%branch% llvm/projects/openmp || exit /b
44
45
46REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226.
47set cmake_flags=-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON -DLLVM_USE_CRT_RELEASE=MT -DCLANG_FORMAT_VS_VERSION=%clang_format_vs_version% -DPACKAGE_VERSION=%package_version% -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: "
48
49REM TODO: Run all tests, including lld and compiler-rt.
50
51call "%vcdir%/vcvarsall.bat" x86
52set CC=
53set CXX=
54mkdir build32_stage0
55cd build32_stage0
56cmake -GNinja %cmake_flags% ..\llvm || exit /b
57ninja all || exit /b
58ninja check || exit /b
59ninja check-clang || exit /b
60cd..
61
62mkdir build32
63cd build32
64set CC=..\build32_stage0\bin\clang-cl
65set CXX=..\build32_stage0\bin\clang-cl
66cmake -GNinja %cmake_flags% -DBUILD_CLANG_FORMAT_VS_PLUGIN=ON ..\llvm || exit /b
67ninja all || exit /b
68ninja check || exit /b
69ninja check-clang || exit /b
70copy ..\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangFormat.vsix ClangFormat-r%revision%.vsix
71ninja package || exit /b
72cd ..
73
74
75call "%vcdir%/vcvarsall.bat" amd64
76set CC=
77set CXX=
78mkdir build64_stage0
79cd build64_stage0
80cmake -GNinja %cmake_flags%  ..\llvm || exit /b
81ninja all || exit /b
82ninja check || exit /b
83ninja check-clang || exit /b
84cd..
85
86mkdir build64
87cd build64
88set CC=..\build64_stage0\bin\clang-cl
89set CXX=..\build64_stage0\bin\clang-cl
90cmake -GNinja %cmake_flags% ..\llvm || exit /b
91ninja all || exit /b
92ninja check || exit /b
93ninja check-clang || exit /b
94ninja package || exit /b
95cd ..
96