eee21f568bea5d35509b4f3c422ae4fc3d773c0d
[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 "%WITH_CLANG%"=="1" (
14         set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -T"LLVM-vs2017"
15         if "%WITH_ASAN%"=="1" (
16                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
17         )
18 ) else (
19         if "%WITH_ASAN%"=="1" (
20                 echo ASAN is only supported with clang.
21                 exit /b 1 
22         )
23 )
24
25 if NOT EXIST %BUILD_DIR%\nul (
26         mkdir %BUILD_DIR%
27 )
28
29 if "%MUST_CLEAN%"=="1" (
30         echo Cleaning %BUILD_DIR%
31         msbuild ^
32                 %BUILD_DIR%\Blender.sln ^
33                 /target:clean ^
34                 /property:Configuration=%BUILD_TYPE% ^
35                 /verbosity:minimal ^
36                 /p:platform=%MSBUILD_PLATFORM%
37 )
38
39 if NOT EXIST %BUILD_DIR%\Blender.sln set MUST_CONFIGURE=1
40 if "%NOBUILD%"=="1" set MUST_CONFIGURE=1
41
42 if "%MUST_CONFIGURE%"=="1" (
43
44         if NOT "%verbose%" == "" (
45                 echo %CMAKE% %BUILD_CMAKE_ARGS% -H%BLENDER_DIR% -B%BUILD_DIR% 
46         )
47
48         cmake ^
49                 %BUILD_CMAKE_ARGS% ^
50                 -H%BLENDER_DIR% ^
51                 -B%BUILD_DIR% 
52
53         if %ERRORLEVEL% NEQ 0 (
54                 echo "Configuration Failed"
55                 exit /b 1
56         )
57 )
58
59 echo call "%VCVARS%" %BUILD_ARCH% > %BUILD_DIR%\rebuild.cmd
60 echo "%CMAKE%" . >> %BUILD_DIR%\rebuild.cmd
61 echo echo %%TIME%% ^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd
62 echo msbuild ^
63         %BUILD_DIR%\Blender.sln ^
64         /target:build ^
65         /property:Configuration=%BUILD_TYPE% ^
66         /maxcpucount:2 ^
67         /verbosity:minimal ^
68         /p:platform=%MSBUILD_PLATFORM% ^
69         /flp:Summary;Verbosity=minimal;LogFile=%BUILD_DIR%\Build.log >> %BUILD_DIR%\rebuild.cmd
70 echo msbuild ^
71         %BUILD_DIR%\INSTALL.vcxproj ^
72         /property:Configuration=%BUILD_TYPE% ^
73         /verbosity:minimal ^
74         /p:platform=%MSBUILD_PLATFORM% >> %BUILD_DIR%\rebuild.cmd
75 echo echo %%TIME%% ^>^> buildtime.txt >> %BUILD_DIR%\rebuild.cmd