OSDN Git Service

Update build_llvm_package.bat
authorHans Wennborg <hans@hanshq.net>
Thu, 25 Jan 2018 14:43:10 +0000 (14:43 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 25 Jan 2018 14:43:10 +0000 (14:43 +0000)
I moved to a new machine and had to adjust a few things:

- Use %USERNAME% instead of %USER% (not sure why %USER% didn't work anymore)
- Update paths for using Python 3.6 instead of 3.5
- Skip building OpenMP which seems broken on Windows
- Work around new vsdevcmd.bat changing paths:
  https://developercommunity.visualstudio.com/content/problem/26780/vsdevcmdbat-changes-the-current-working-directory.html
- Build stage-0 compiler with MinSizeRel to work around VS 2017 bug:
  https://developercommunity.visualstudio.com/content/problem/139043/miscompile-in-trivial-c-program-with-155-preview-2.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323427 91177308-0d34-0410-b5e6-96231b3b80d8

utils/release/build_llvm_package.bat

index 30b245f..4842dd4 100755 (executable)
@@ -21,8 +21,8 @@ REM   https://github.com/swig/swig/issues/769
 REM You need to modify the paths below:\r
 set vsdevcmd=C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\Tools\VsDevCmd.bat\r
 \r
-set python32_dir=C:\Users\%USER%\AppData\Local\Programs\Python\Python35-32\r
-set python64_dir=C:\Users\%USER%\AppData\Local\Programs\Python\Python35\r
+set python32_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36-32\r
+set python64_dir=C:\Users\%USERNAME%\AppData\Local\Programs\Python\Python36\r
 \r
 set revision=%1\r
 set branch=trunk\r
@@ -47,7 +47,7 @@ svn.exe export -r %revision% http://llvm.org/svn/llvm-project/cfe/%branch% llvm/
 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/clang-tools-extra/%branch% llvm/tools/clang/tools/extra || exit /b\r
 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/lld/%branch% llvm/tools/lld || exit /b\r
 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/compiler-rt/%branch% llvm/projects/compiler-rt || exit /b\r
-svn.exe export -r %revision% http://llvm.org/svn/llvm-project/openmp/%branch% llvm/projects/openmp || exit /b\r
+REM svn.exe export -r %revision% http://llvm.org/svn/llvm-project/openmp/%branch% llvm/projects/openmp || exit /b\r
 svn.exe export -r %revision% http://llvm.org/svn/llvm-project/lldb/%branch% llvm/tools/lldb || exit /b\r
 \r
 \r
@@ -56,12 +56,14 @@ set cmake_flags=-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_IN
 \r
 REM TODO: Run all tests, including lld and compiler-rt.\r
 \r
+set "VSCMD_START_DIR=%CD%"\r
 call "%vsdevcmd%" -arch=x86\r
 set CC=\r
 set CXX=\r
 mkdir build32_stage0\r
 cd build32_stage0\r
-cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% ..\llvm || exit /b\r
+REM Work around VS2017 bug by using MinSizeRel.\r
+cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python32_dir% -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b\r
 ninja all || exit /b\r
 ninja check || ninja check || ninja check || exit /b\r
 ninja check-clang || ninja check-clang || ninja check-clang ||  exit /b\r
@@ -89,12 +91,14 @@ copy ..\llvm\tools\clang\tools\clang-format-vs\ClangFormat\bin\Release\ClangForm
 cd ..\r
 \r
 \r
+set "VSCMD_START_DIR=%CD%"\r
 call "%vsdevcmd%" -arch=amd64\r
 set CC=\r
 set CXX=\r
 mkdir build64_stage0\r
 cd build64_stage0\r
-cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% ..\llvm || exit /b\r
+REM Work around VS2017 bug by using MinSizeRel.\r
+cmake -GNinja %cmake_flags% -DPYTHON_HOME=%python64_dir% -DCMAKE_BUILD_TYPE=MinSizeRel ..\llvm || exit /b\r
 ninja all || exit /b\r
 ninja check || ninja check || ninja check || exit /b\r
 ninja check-clang || ninja check-clang || ninja check-clang ||  exit /b\r