Easiest way to build different branches of Blender

Hi there,

I’m not a coder at all, but building Blender on Linux and Windows is so easy that I usually compile it, before I start Blender :wink:

Now if I want to give the very latest Cycles-X branch a try without having to wait for the Buildbot doing its magic, I usually do this:

  • Switch branch with “git checkout cycles-x”
  • make update
  • make full

Then I copy the contents of the “/build_linux_full/bin” folder to another folder and switch back to master with

  • git checkout master

This works but apart from the manual work, the builds take quite a while because they’re built from scratch and all the CUDA kernels etc. have to be rebuilt.

There has to be an easier way. I already found that using the “BUILD_DIR=/folder_to_build_blender” command line option for make kind of helps me avoid to build everything into the same folder, but maybe there is a much easier and cleaner way of doing this.

Thanks.

1 Like

Hi,
You can pass the builddir to make. (Tested on Windows at least):

make builddir cycles-x

Then it builds inside a folder called cycles-x instead of the default (e.g. build_windows_x64_vc16_Release).

So instead of typing make full, you type make builddir master or make builddir cycles-x and voila. :slight_smile:

2 Likes

OK, thanks for this info.

I guess I will have to manually switch to the Cycles-X branch with the “git checkout cycles-x” command, right?

So using “make builddir cycles-x” is basically the short version of “make full BUILD_DIR=~/blender-git/build_cycles-x” ?

Yes, you still have to switch to the branch or master.

It’s not necessarily doing a full build. If the folder you pass is already there and you built before to it, it will do a partial (and quicker) rebuild.

3 Likes

A, nice to know. Thanks :ok_hand:

OK, I just checked it on Linux and it looks like this is a Windows-only feature:

make builddir cycles-x
make: *** No rule to make target 'builddir'.  Stop.

So, I’ll stick with the slightly longer

BUILD_DIR=<Folder>

syntax

ccache on Linux can help with the rebuild from scratch. make full ccache. Windows has sccache but is probably buggy.

2 Likes

@ThomasDinges make.bat is a helper script on windows, it is not and is not intending to be on 1:1 feature parity with the actual make program and makefile on other platforms. most major commands are implemented (ie lite/full/release) but not all, it offers options other platforms don’t, and some options work slightly different between the two.

make help works on both platforms though and should show the options available for that platform you’re currently on.

2 Likes

Ah, cool. I was already using “make help” and wondered why I couldn’t find the “builddir” option in Linux.

I normally create a separate checkout directory from my main source directory, with .git symlinked to the real one. Then I can git checkout whatever commit/branch I want (followed by git reset to restore the index to some sane state for the main source directory).

It’s easy enough to create any number of these checkout directories, for different builds, and also to wipe them and start again if I hit any problems.

2 Likes

Sounds pretty neat to me :wink:

Hey,
I made a little program where you can pick the branch you want, from all the branches that are available, and it builds it for you in a specific folder.
I am on holiday right now but when I come back home I can share it here so you can give it a try.

3 Likes

This is very interesting. What platforms does it run on?

It runs only on windows for now, but it is python for the most part, so it could definitely work on other platforms with a few changes

2 Likes

Hey,

Here is the script, the only thing you have to change is the self.base_path variable in blender_updater.py, it should be the absolute path to your blender project (should end with “/blender_git/blender/” if you followed the building tutorial from the wiki).

Let me know if you have any other questions :slight_smile:

Cheers !

5 Likes

Thanks for this! I tweaked your code to run on Linux. I haven’t had a chance to test it on mac but it should work (maybe with a little tweaking to get the build directory set). Here* is the code and an installation helper file.

*With @thornydre 's permission I uploaded this to github.

2 Likes

Great! This is about as simple as it gets!

Hey,

I published my windows version so feel free to download it if you want, feel free to contribute for mac and linux support, or even report any issues :slight_smile:

Cheer !

1 Like

Forgot to put the link sorry, here it is

1 Like