configure_ninja.cmd 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ninja --version 1>NUL 2>&1
  2. if %ERRORLEVEL% NEQ 0 (
  3. echo "Ninja not detected in the path"
  4. exit /b 1
  5. )
  6. set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
  7. if "%WITH_CLANG%" == "1" (
  8. set LLVM_DIR=
  9. for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
  10. if DEFINED LLVM_DIR (
  11. if NOT "%verbose%" == "" (
  12. echo LLVM Detected at "%LLVM_DIR%"
  13. )
  14. goto DetectionComplete
  15. )
  16. REM Check 32 bits
  17. for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\LLVM" /ve 2^>nul`) DO set LLVM_DIR=%%C
  18. if DEFINED LLVM_DIR (
  19. if NOT "%verbose%" == "" (
  20. echo LLVM Detected at "%LLVM_DIR%"
  21. )
  22. goto DetectionComplete
  23. )
  24. echo LLVM not found
  25. exit /b 1
  26. :DetectionComplete
  27. set CC=%LLVM_DIR%\bin\clang-cl
  28. set CXX=%LLVM_DIR%\bin\clang-cl
  29. rem build and tested against 2017 15.7
  30. set CFLAGS=-m64 -fmsc-version=1914
  31. set CXXFLAGS=-m64 -fmsc-version=1914
  32. if "%WITH_ASAN%"=="1" (
  33. set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
  34. )
  35. )
  36. if "%WITH_ASAN%"=="1" (
  37. if "%WITH_CLANG%" == "" (
  38. echo ASAN is only supported with clang.
  39. exit /b 1
  40. )
  41. )
  42. if NOT "%verbose%" == "" (
  43. echo BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS%
  44. )
  45. if NOT EXIST %BUILD_DIR%\nul (
  46. mkdir %BUILD_DIR%
  47. )
  48. if "%MUST_CLEAN%"=="1" (
  49. echo Cleaning %BUILD_DIR%
  50. cd %BUILD_DIR%
  51. %CMAKE% cmake --build . --config Clean
  52. )
  53. if NOT EXIST %BUILD_DIR%\build.ninja set MUST_CONFIGURE=1
  54. if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
  55. if "%MUST_CONFIGURE%"=="1" (
  56. cmake ^
  57. %BUILD_CMAKE_ARGS% ^
  58. -H%BLENDER_DIR% ^
  59. -B%BUILD_DIR%
  60. if %ERRORLEVEL% NEQ 0 (
  61. echo "Configuration Failed"
  62. exit /b 1
  63. )
  64. )
  65. echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
  66. echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
  67. echo ninja install >> %BUILD_DIR%\rebuild.cmd
  68. echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd