Merge remote-tracking branch 'origin/master' into blender2.8
[blender.git] / build_files / windows / configure_ninja.cmd
1 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Ninja" %TESTS_CMAKE_ARGS% -DCMAKE_BUILD_TYPE=%BUILD_TYPE%
2
3 if "%WITH_CLANG%" == "1" (
4 set LLVM_DIR=
5         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
6         if DEFINED LLVM_DIR (
7                 if NOT "%verbose%" == "" (
8                         echo LLVM Detected at "%LLVM_DIR%"
9                 )
10         goto DetectionComplete
11         )
12
13         REM Check 32 bits
14         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
15         if DEFINED LLVM_DIR (
16                 if NOT "%verbose%" == "" (
17                         echo LLVM Detected at "%LLVM_DIR%"
18                 )
19                 goto DetectionComplete
20         )
21         echo LLVM not found 
22         exit /b 1
23         
24 :DetectionComplete      
25         set CC=%LLVM_DIR%\bin\clang-cl
26         set CXX=%LLVM_DIR%\bin\clang-cl
27         rem build and tested against 2017 15.7
28         set CFLAGS=-m64 -fmsc-version=1914
29         set CXXFLAGS=-m64 -fmsc-version=1914
30 )
31
32 if NOT "%verbose%" == "" (
33         echo BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% 
34 )
35
36 if NOT EXIST %BUILD_DIR%\nul (
37         mkdir %BUILD_DIR%
38 )
39
40 if "%MUST_CLEAN%"=="1" (
41         echo Cleaning %BUILD_DIR%
42         cd %BUILD_DIR%
43         %CMAKE% cmake --build . --config Clean
44 )
45
46 if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1
47 if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
48
49 if "%MUST_CONFIGURE%"=="1" (
50         cmake ^
51                 %BUILD_CMAKE_ARGS% ^
52                 -H%BLENDER_DIR% ^
53                 -B%BUILD_DIR% 
54
55         if %ERRORLEVEL% NEQ 0 (
56                 echo "Configuration Failed"
57                 exit /b 1
58         )
59 )
60
61 echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
62 echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
63 echo ninja install >> %BUILD_DIR%\rebuild.cmd 
64 echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd