Windows: Add support for building with clang.
[blender.git] / build_files / windows / configure_msbuild.cmd
1 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio %BUILD_VS_VER% %BUILD_VS_YEAR%%WINDOWS_ARCH%" %TESTS_CMAKE_ARGS%
2
3 if "%BUILD_ARCH%"=="x64" (
4         set MSBUILD_PLATFORM=x64
5 ) else if "%BUILD_ARCH%"=="x86" (
6         set MSBUILD_PLATFORM=win32
7         if "%WITH_CLANG%"=="1" (
8                 echo Clang not supported for X86
9                 exit /b 1
10         )
11 )
12
13 if NOT EXIST %BUILD_DIR%\nul (
14         mkdir %BUILD_DIR%
15 )
16
17 if "%MUST_CLEAN%"=="1" (
18         echo Cleaning %BUILD_DIR%
19         msbuild ^
20                 %BUILD_DIR%\Blender.sln ^
21                 /target:clean ^
22                 /property:Configuration=%BUILD_TYPE% ^
23                 /verbosity:minimal ^
24                 /p:platform=%MSBUILD_PLATFORM%
25 )
26
27 if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1
28 if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
29
30 if "%MUST_CONFIGURE%"=="1" (
31
32         if NOT "%verbose%" == "" (
33                 echo %CMAKE% %BUILD_CMAKE_ARGS% -H%BLENDER_DIR% -B%BUILD_DIR% 
34         )
35
36         cmake ^
37                 %BUILD_CMAKE_ARGS% ^
38                 -H%BLENDER_DIR% ^
39                 -B%BUILD_DIR% 
40
41         if %ERRORLEVEL% NEQ 0 (
42                 echo "Configuration Failed"
43                 exit /b 1
44         )
45 )
46
47 echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
48 echo "%CMAKE%" . >> %BUILD_DIR%\rebuild.cmd
49 echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
50 echo msbuild ^
51         %BUILD_DIR%\Blender.sln ^
52         /target:build ^
53         /property:Configuration=%BUILD_TYPE% ^
54         /maxcpucount:2 ^
55         /verbosity:minimal ^
56         /p:platform=%MSBUILD_PLATFORM% ^
57         /flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log >> %BUILD_DIR%\rebuild.cmd
58 echo msbuild ^
59         %BUILD_DIR%\INSTALL.vcxproj ^
60         /property:Configuration=%BUILD_TYPE% ^
61         /verbosity:minimal ^
62         /p:platform=%MSBUILD_PLATFORM% >> %BUILD_DIR%\rebuild.cmd
63 echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd