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