build_deps.cmd 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. @echo off
  2. if NOT "%1" == "" (
  3. if "%1" == "2013" (
  4. echo "Building for VS2013"
  5. set VSVER=12.0
  6. set VSVER_SHORT=12
  7. set BuildDir=VS12
  8. goto par2
  9. )
  10. if "%1" == "2015" (
  11. echo "Building for VS2015"
  12. set VSVER=14.0
  13. set VSVER_SHORT=14
  14. set BuildDir=VS14
  15. goto par2
  16. )
  17. if "%1" == "2017" (
  18. echo "Building for VS2017"
  19. set VSVER=15.0
  20. set VSVER_SHORT=15
  21. set BuildDir=VS15
  22. goto par2
  23. )
  24. )
  25. :usage
  26. Echo Usage build_deps 2013/2015/2017 x64/x86
  27. goto exit
  28. :par2
  29. if NOT "%2" == "" (
  30. if "%2" == "x86" (
  31. echo "Building for x86"
  32. set HARVESTROOT=Windows_vc
  33. set ARCH=86
  34. if "%1" == "2013" (
  35. set CMAKE_BUILDER=Visual Studio 12 2013
  36. )
  37. if "%1" == "2015" (
  38. set CMAKE_BUILDER=Visual Studio 14 2015
  39. )
  40. if "%1" == "2017" (
  41. set CMAKE_BUILDER=Visual Studio 15 2017
  42. )
  43. goto start
  44. )
  45. if "%2" == "x64" (
  46. echo "Building for x64"
  47. set HARVESTROOT=Win64_vc
  48. set ARCH=64
  49. if "%1" == "2013" (
  50. set CMAKE_BUILDER=Visual Studio 12 2013 Win64
  51. )
  52. if "%1" == "2015" (
  53. set CMAKE_BUILDER=Visual Studio 14 2015 Win64
  54. )
  55. if "%1" == "2017" (
  56. set CMAKE_BUILDER=Visual Studio 15 2017 Win64
  57. )
  58. goto start
  59. )
  60. )
  61. goto usage
  62. :start
  63. setlocal ENABLEEXTENSIONS
  64. set CMAKE_DEBUG_OPTIONS=-DWITH_OPTIMIZED_DEBUG=On
  65. if "%3" == "debug" set CMAKE_DEBUG_OPTIONS=-DWITH_OPTIMIZED_DEBUG=Off
  66. set dobuild=1
  67. if "%4" == "nobuild" set dobuild=0
  68. set SOURCE_DIR=%~dp0\..
  69. set BUILD_DIR=%cd%\build
  70. set HARVEST_DIR=%BUILD_DIR%\output
  71. set STAGING=%BUILD_DIR%\S
  72. rem for python module build
  73. set MSSdk=1
  74. set DISTUTILS_USE_SDK=1
  75. rem for python externals source to be shared between the various archs and compilers
  76. mkdir %BUILD_DIR%\downloads\externals
  77. REM Detect MSVC Installation
  78. if DEFINED VisualStudioVersion goto msvc_detect_finally
  79. set VALUE_NAME=ProductDir
  80. REM Check 64 bits
  81. set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%VSVER%\Setup\VC"
  82. for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO set MSVC_VC_DIR=%%C
  83. if DEFINED MSVC_VC_DIR goto msvc_detect_finally
  84. REM Check 32 bits
  85. set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\%VSVER%\Setup\VC"
  86. for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO set MSVC_VC_DIR=%%C
  87. if DEFINED MSVC_VC_DIR goto msvc_detect_finally
  88. :msvc_detect_finally
  89. if DEFINED MSVC_VC_DIR call "%MSVC_VC_DIR%\vcvarsall.bat"
  90. echo on
  91. REM Sanity Checks
  92. where /Q msbuild
  93. if %ERRORLEVEL% NEQ 0 (
  94. echo Error: "MSBuild" command not in the PATH.
  95. echo You must have MSVC installed and run this from the "Developer Command Prompt"
  96. echo ^(available from Visual Studio's Start menu entry^), aborting!
  97. goto EOF
  98. )
  99. where /Q cmake
  100. if %ERRORLEVEL% NEQ 0 (
  101. echo Error: "CMake" command not in the PATH.
  102. echo You must have CMake installed and added to your PATH, aborting!
  103. goto EOF
  104. )
  105. set StatusFile=%BUILD_DIR%\%1_%2.log
  106. set path=%BUILD_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%BUILD_DIR%\downloads\nasm-2.12.01\;%path%
  107. mkdir %STAGING%\%BuildDir%%ARCH%R
  108. cd %Staging%\%BuildDir%%ARCH%R
  109. echo %DATE% %TIME% : Start > %StatusFile%
  110. cmake -G "%CMAKE_BUILDER%" %SOURCE_DIR% -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DBUILD_MODE=Release -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/
  111. echo %DATE% %TIME% : Release Configuration done >> %StatusFile%
  112. if "%dobuild%" == "1" (
  113. msbuild /m "ll.vcxproj" /p:Configuration=Release /fl /flp:logfile=BlenderDeps_llvm.log;Verbosity=normal
  114. msbuild /m "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log;Verbosity=minimal /verbosity:minimal
  115. echo %DATE% %TIME% : Release Build done >> %StatusFile%
  116. cmake --build . --target Harvest_Release_Results > Harvest_Release.txt
  117. )
  118. echo %DATE% %TIME% : Release Harvest done >> %StatusFile%
  119. cd %BUILD_DIR%
  120. mkdir %STAGING%\%BuildDir%%ARCH%D
  121. cd %Staging%\%BuildDir%%ARCH%D
  122. cmake -G "%CMAKE_BUILDER%" %SOURCE_DIR% -DDOWNLOAD_DIR=%BUILD_DIR%/downloads -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=Debug -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ %CMAKE_DEBUG_OPTIONS%
  123. echo %DATE% %TIME% : Debug Configuration done >> %StatusFile%
  124. if "%dobuild%" == "1" (
  125. msbuild /m "ll.vcxproj" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps_llvm.log;;Verbosity=normal
  126. msbuild /m "BlenderDependencies.sln" /p:Configuration=Debug /verbosity:n /fl /flp:logfile=BlenderDeps.log;;Verbosity=normal
  127. echo %DATE% %TIME% : Debug Build done >> %StatusFile%
  128. cmake --build . --target Harvest_Debug_Results> Harvest_Debug.txt
  129. )
  130. echo %DATE% %TIME% : Debug Harvest done >> %StatusFile%
  131. cd %BUILD_DIR%
  132. :exit
  133. Echo .