Fix for make.bat
[blender.git] / make.bat
1 @echo off
2 REM This batch file does an out-of-source CMake build in ../build_windows
3 REM This is for users who like to configure & build Blender with a single command.
4
5 set BLENDER_DIR=%~dp0
6 set BUILD_DIR=%BLENDER_DIR%..\build_windows
7 set BUILD_TYPE=Release
8 set BUILD_CMAKE_ARGS=
9
10 :argv_loop
11 if NOT "%1" == "" (
12
13         REM Help Message
14         if "%1" == "--help" (
15                 echo.
16                 echo Convenience targets
17                 echo - debug
18                 echo - full
19                 echo - lite
20                 echo - headless
21                 echo - cycles
22                 echo - bpy
23                 echo.
24                 echo Utilities ^(not associated with building^)
25                 echo - update
26                 goto EOF
27         )
28
29         REM Build Types
30         if "%1" == "debug" (
31                 set BUILD_DIR=%BUILD_DIR%_debug
32                 set BUILD_TYPE=Debug
33
34         REM Build Configurations
35         ) else if "%1" == "full" (
36                 set BUILD_DIR=%BUILD_DIR%_full
37                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
38                     -C"%BLENDER_DIR%\build_files\cmake\config\blender_full.cmake"
39         ) else if "%1" == "lite" (
40                 set BUILD_DIR=%BUILD_DIR%_lite
41                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
42                     -C"%BLENDER_DIR%\build_files\cmake\config\blender_lite.cmake"
43         ) else if "%1" == "cycles_standalone" (
44                 set BUILD_DIR=%BUILD_DIR%_cycles
45                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
46                     -C"%BLENDER_DIR%\build_files\cmake\config\cycles_standalone.cmake"
47         ) else if "%1" == "headless" (
48                 set BUILD_DIR=%BUILD_DIR%_headless
49                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
50                     -C"%BLENDER_DIR%\build_files\cmake\config\blender_headless.cmake"
51         ) else if "%1" == "bpy" (
52                 set BUILD_DIR=%BUILD_DIR%_bpy
53                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
54                     -C"%BLENDER_DIR%\build_files\cmake\config\bpy_module.cmake"
55
56         REM Non-Build Commands
57         ) else if "%1" == "update" (
58                 svn up ../lib/*
59                 git pull --rebase
60                 git submodule foreach git pull --rebase origin master
61                 goto EOF
62         ) else (
63                 echo Command "%1" unknown, aborting!
64                 goto EOF
65         )
66
67         shift /1
68         goto argv_loop
69 )
70
71 if "%PROCESSOR_ARCHITECTURE%" == "x86" (
72         set WINDOWS_ARCH=
73 ) else (
74         set WINDOWS_ARCH=Win64
75 )
76
77 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -G "Visual Studio 12 2013 %WINDOWS_ARCH%"
78 mkdir %BUILD_DIR%
79
80 cmake ^
81         %BUILD_CMAKE_ARGS% ^
82         -H%BLENDER_DIR% ^
83         -B%BUILD_DIR% ^
84         %BUILD_CMAKE_ARGS%
85
86 if %ERRORLEVEL% NEQ 0 (
87         ECHO "CMake Failed"
88         GOTO :EOF
89         )
90
91 msbuild ^
92         %BUILD_DIR%\Blender.sln ^
93         /target:build ^
94         /property:Configuration=%BUILD_TYPE% ^
95         /maxcpucount ^
96         /verbosity:minimal
97
98 if %ERRORLEVEL% NEQ 0 (
99         ECHO "Build Failed"
100         GOTO :EOF
101         )
102
103 msbuild ^
104         %BUILD_DIR%\INSTALL.vcxproj ^
105         /property:Configuration=%BUILD_TYPE% ^
106         /verbosity:minimal
107
108 echo.
109 echo Your build is complete at: "%BUILD_DIR%\bin\%BUILD_TYPE%"
110 echo.
111
112 :EOF
113