Add helper make.bat file for ms-windows builders
[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
9 :argv_loop
10 if NOT "%1" == "" (
11
12         REM Help Message
13         if "%1" == "--help" (
14                 echo.
15                 echo Convenience targets
16                 echo - debug
17                 echo - full
18                 echo - lite
19                 echo - headless
20                 echo - cycles
21                 echo - bpy
22                 echo.
23                 echo Utilities ^(not associated with building^)
24                 echo - update
25                 goto EOF
26         )
27
28         REM Build Types
29         if "%1" == "debug" (
30                 set BUILD_DIR=%BUILD_DIR%_debug
31                 set BUILD_TYPE=Debug
32
33         REM Build Configurations
34         ) else if "%1" == "full" (
35                 set BUILD_DIR=%BUILD_DIR%_full
36                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
37                     -C"%BLENDER_DIR%\blender\build_files\cmake\config\blender_full.cmake"
38         ) else if "%1" == "lite" (
39                 set BUILD_DIR=%BUILD_DIR%_lite
40                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
41                     -C"%BLENDER_DIR%\blender\build_files\cmake\config\blender_lite.cmake"
42         ) else if "%1" == "cycles_standalone" (
43                 set BUILD_DIR=%BUILD_DIR%_cycles
44                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
45                     -C"%BLENDER_DIR%\blender\build_files\cmake\config\cycles_standalone.cmake"
46         ) else if "%1" == "headless" (
47                 set BUILD_DIR=%BUILD_DIR%_headless
48                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
49                     -C"%BLENDER_DIR%\blender\build_files\cmake\config\blender_headless.cmake"
50         ) else if "%1" == "bpy" (
51                 set BUILD_DIR=%BUILD_DIR%_bpy
52                 set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% ^
53                     -C"%BLENDER_DIR%\blender\build_files\cmake\config\bpy_module.cmake"
54
55         REM Non-Build Commands
56         ) else if "%1" == "update" (
57                 svn up ../lib/*
58                 git pull --rebase
59                 git submodule foreach git pull --rebase origin master
60                 goto EOF
61         ) else (
62                 echo Command "%1" unknown, aborting!
63                 goto EOF
64         )
65
66         shift /1
67         goto argv_loop
68 )
69
70 if "%PROCESSOR_ARCHITECTURE%" == "x86" (
71         set WINDOWS_ARCH=
72 ) else (
73         set WINDOWS_ARCH=Win64
74 )
75
76 set BUILD_CMAKE_ARGS=-G "Visual Studio 12 2013 %WINDOWS_ARCH%"
77 mkdir %BUILD_DIR%
78
79 cmake ^
80         %BUILD_CMAKE_ARGS% ^
81         -H%BLENDER_DIR% ^
82         -B%BUILD_DIR% ^
83         %BUILD_CMAKE_ARGS%
84
85 if %ERRORLEVEL% NEQ 0 (
86         ECHO "CMake Failed"
87         GOTO :EOF
88         )
89
90 msbuild ^
91         %BUILD_DIR%\Blender.sln ^
92         /target:build ^
93         /property:Configuration=%BUILD_TYPE%
94
95 :EOF
96