This is how to build Blender from its source using Microsoft compiler:
Here you find information about how to build Blender on recent ms-windows systems using MSVC 2013/2015
In case you run into problems at any point during the build process, see: troubleshooting page
While MSVC2015 is supported, and has no known issues, official builds are still done using 2013.
To have latest Blender successfully on your system, follow these steps.
This is not as hard as most people would think if you follow these instructions.
- Install necessary dependencies.
- Download Blender source & libraries.
- Compile Blender.
Install the dependencies
THIS SECTION NEEDS TO BE COMPLETED
You must install Subversion to get access to the pre compiled Blender Libraries (see further down). The following links are just two possible resources for getting Subversion. You may prefer your own way (like using cygwin for example).
- SlikSVN A version of SVN for windows
- TortoiseSvn for an easy to use GUI, with Windows Explorer integration.
You must install Git to get access to the Blender sources.
- Git for Windows if you just want a command line Git. This is needed in the Blender compiling process, see box below
- TortoiseGit for an easy to use GUI, with Windows Explorer integration (equivalent of TortoiseSVN).
Revision information in splash
Make sure you have git.exe in your PATH when starting the build. It ensures you have it in your splash in in the Blenders Python API part related to application info. If you fail to do so, you'll see UNKNOWN printed in the place of a revision hash and date.
You must install CMake to create the Build environment.
Download the installer (If you have a 64 bits Windows, you can use 32 or 64bit versions).
- For Install Options, set the system path option to:
Add CMake to the system PATH for all users.
You only need to install the CUDA development kit if you intend to use Cycles with Cuda support.
Get Cuda 8.0 from:
Visual Studio (MSVC)
This is the compiler needed to build Blender releases. Currently Blender depends on Visual Studio 2013 Update 4/5 or Visual Studio 2015 Update 3 .
Both the PRO and Community versions can be used, but only the Community version can be downloaded for free:
- VS-2013 Community (used for official Blender builds) can be downloaded from the [old Downloads] section at Microsoft (you need to register first).
- VS-2015 Community (compiles faster, but not much tested so far) can be downloaded from the [current versions] section at Microsoft.
Community seems identical to Pro edition with license restrictions:
An unlimited number of users within an organization can use Visual Studio Community for the following scenarios: in a classroom learning environment, for academic research, or for contributing to open source projects. [Q & A on Visual Studio Community 2013 and 2015 Preview]
Set up your Repository
Create a folder to store your copy of the Blender source code. This guide will assume your chosen folder is
C:\blender-git. Then use the command-line to download the Blender source code via git and precompiled libraries via SVN.
Note, to get the precompiled libraries you can use the command-line OR TortoiseSVN, no need to do both, however the command-line is relatively easy to do.
Using the Command line
Open the command prompt window by hitting Windows+R, and then typing cmd, or by searching for it in the start menu.
At the command prompt type the following commands:
cd C:\blender-git git clone git://git.blender.org/blender.git cd blender git submodule update --init --recursive git submodule foreach git checkout master git submodule foreach git pull --rebase origin master
This will checkout the source files to blender/
For additional information on using Git with Blender's sources, see: Tools/Git
+ Checkout 32 Bit libraries...
Make sure the current working directory is the top-level Blender dev directory, so
If you plan on building 32-bit binaries with Microsoft VS-2013, checkout the pre-compiled library files by typing:
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/windows_vc12 lib/windows_vc12
If you plan on building 32-bit binaries with Microsoft VS-2015, checkout the pre-compiled library files by typing:
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/windows_vc14 lib/windows_vc14
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/mingw32 lib/mingw32
This will checkout the libraries to lib/windows/ or lib/mingw32/ respectively.
+ Checkout 64 Bit libraries...
Make sure the current working directory is the top-level Blender dev directory, so
If you plan on building 64-bit binaries with Microsoft VS-2013, checkout the precompiled library files by typing:
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/win64_vc12 lib/win64_vc12
If you plan on building 64-bit binaries with Microsoft VS-2015, checkout the precompiled library files by typing:
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/win64_vc14 lib/win64_vc14
svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/mingw64 lib/mingw64
Again, this will check the libraries out in lib/win64/ or lib/mingw64/ respectively.
Checkout multiple branches from one repository
When you want to checkout 2 Blender versions in parallel, you can use git worktree. Here is an example for how to setup a worktree for another branch (blender2.8 in this case). We assume you have already cloned the repository and you have moved your commandline tool into the main folder of the blender sources.
git worktree add -b blender2.8 ../blender2.8 origin/blender2.8 cd ../blender2.8 git submodule update --init --recursive
Now you can use the new folder just like you use the main repository (git pull, git push, git add, ...)
Under no circumstances should you set the SVN repository for the
C:\blender-git folder, because it could cause major conflicts with the git repository. If you want to update each precompiled library folder with the explorer context menu, you can do so by clicking on the requisite folders under lib/ and going to SVN checkout. After the checkout finishes you will see a revision and are able to close the dialog out.
The only safe folders that you should use this feature on are the following:
+ Safe Folders for 32 Bit libraries...
+ Safe Folders for 64 Bit libraries...
Update your repository
To keep your local Blender source code and precompiled libraries up to date, you will need to do a git and SVN update once in a while. The most convenient way of doing this is to make a batch file containing the necessary commands.
Create this batch (.bat) file in
+ Update 32 Bit libraries...
For Microsoft VS-2013 32-bit:
cd lib\windows_vc12 svn update cd ..\..\blender git pull --rebase git submodule foreach git pull --rebase origin master pause
For MinGW (32-bit):
cd lib\mingw32 svn update cd ..\..\blender git pull --rebase git submodule foreach git pull --rebase origin master pause
+ Update 64 Bit libraries...
For Microsoft VS-2013 64-bit:
cd lib\win64_vc12 svn update cd ..\..\blender git pull --rebase git submodule foreach git pull --rebase origin master pause
cd lib\mingw64 svn update cd ..\..\blender git pull --rebase git submodule foreach git pull --rebase origin master pause
Run this newly created .bat file whenever you want to update.
TortoiseSVN Explorer Menu
If you plan to compile different versions of Blender with different compilers or targets, and need to have more than one of the precompiled libraries, you can update them individually by right clicking on the requsite library under
C:/blender-git/lib/PRECOMPILED-LIB where "PRECOMPILED-LIB" are the following:
Once you right click on the
C:/blender-git/lib/PRECOMPILED-LIB folder you should choose the
SVN Update option. A TortoiseSVN window will appear listing the files that are updating.
Once the process is finished it will print Completed At Revision: xxxxx at the end of the list.
Just click the OK button to dismiss the dialog.
Compile Blender with CMake
Automatic CMake Setup
If you're not interested in manually setting up CMake build directory, configuring, building and installing in separate steps, we provide a convenience batch file in Blender's source directory which sets up CMake for you.
From the command line, run:
cd C:\blender-git\blender make full
Once the build finishes you'll get a message like..
Blender successfully built, run from: C:\blender-git\build_windows_Full_x64_vc12_Release\bin\Release
Updating your local checkout and rebuilding is as simple as:
cd C:\blender-git\blender make update make full
(this requires git and svn to be in your systems PATH).
There are some pre-defined build targets:
- make - some are turned off by default because they can be difficult to correctly configure for newer developers and aren't essential to use & develop Blender in most cases.
- make lite - the quickest way to get a Blender build up & running, can also help to avoid installing a lot of dependencies if you don't need video-codecs, physics-sim & cycles rendering.
- make full - this makes a complete build with all options enabled but without the cuda kernels.
- make release - this makes a complete build with all options enabled including cuda kernels, matching the releases on blender.org.
For a full list of the optional targets type...
Building from within the Visual Studio IDE
+ Building from within the Visual Studio IDE (optional)
If you want to work within the visual studio IDE instead of building from the command prompt.
We provide a convenience batch file in Blender's source directory which can generate a visual studio project for you
From the command line, run:
cd C:\blender-git\blender make full nobuild
if you want to customize your build, (ie select a visual studio version, platform architecture, of blender feature set) you can get a list of customizable options by typing
Once the batch file finishes it should tell you where the project files have been written, for example:
-- Build files have been written to: c:/blender-git/build_windows_Full_x64_vc12_Release
In that folder you should now find a blender.sln which you can open with the visual studio IDE.
Once opened it's very important the following steps are taken:
Once these settings are done, you can work with the code as usual in visual studio.
Manual CMake Setup
+ Manual CMake Setup (optional)
If you want to have more control over your build configuration or have multiple build directories for a single source directory. You can follow these steps.
Create Project Files
This step you only have to do once when first setting up the build.
Install CMake and run the CMake application, you will have to point its source path to the location you downloaded blenders GIT source to.
You will need to select a Build Path outside the source directory.
Press Configure, then Generate.
Note. any changes to the build-system will re-generate project files automatically from within MSVC when building.
Compiling the Project Files
You can build Blender from the graphical application or the command line.
Compile from MSVC (graphical user interface)
Note that if you are already familier with MSVC, Then the following steps are are much the same as building any other project file (nothing Blender specific here).
Compile from MSVC (command line)
You can also compile from the command line.
In the following command just substitute [TARGET] with one of:
devenv Blender.sln /Build [TARGET] /Project INSTALL
If you only have VC 2013 express, you have no devenv. You can then use MSBuild:
MSBuild INSTALL.vcxproj /p:Configuration=[TARGET] /t:Build /m