Can I set Build options in the Blender git repository?

I am following Building Blender/GPU Binaries - Blender Developer Wiki to build Blender with GPU binaries which states:

Change the CMake configuration to enable building with OptiX and point to the OptiX installation directory

and links to Building Blender/Options - Blender Developer Wiki which states:

By default, the CMakeCache.txt configuration file will be in …/build_.

I can’t find the …/build_ directory, but I did find the CMakeCache.txt file in …/build_windows_x64_vc17_Release directory.

Is that it?

What I also noticed is that the …/build_windows_x64_vc17_Release directory is created after running make the first time.

This is a problem for me because I like to delete the …/build_windows_x64_vc17_Release directory when I screw up very badly to get a fresh start. However then every time I want to build Blender with GPU binaries I have to compile Blender twice, once to create the …/build_windows_x64_vc17_Release directory and once after modifying CMakeCache.txt, which on my PC takes about an hour.

Is there a way to set Build options ,especially CMakeCache.txt, in the Blender git repository to avoid having to compile twice?

No, the only place to edit those options is in your build folder

What you can do however add nobuild to your make invocation, that way it will only configure your build folder but not build blender. You can then go in, fiddle with whatever option you desire in CMakeCache.txt and run rebuild.cmd in your build folder to build with the updated settings.

Three questions:

  1. Does …/build_ platform> in Building Blender/Options - Blender Developer Wiki refer to …/build_windows_x64_vc17_Release?

  2. You just mentioned rebuild.cmd. Up until now I always used to just use make in cmd.exe or Local Windows Debugger in Visual Studio. Should I use rebuild.cmd instead and if so for what reasons?

  3. Sometimes after editing CMakeCache.txt and using make in cmd.exe I will see messages like OptiX found in ... when update it to I specify a path to OptiX SDK or OptiX not found when I update it to not specify a path to OptiX SDK. Other times I don’t see these messages. Does that mean that the changes failed to apply or does CMake simply not give a message that some Build options have changed?

  1. the build folder name is rather flexible and can be customized, it’s hard to give a fixed name for this folder, so we used build ../build_<platform> hoping people would figure out what we meant, judging by this we could probably do better here.

  2. Use whatever you want, I got the impression you only used make.bat which would reconfigure your build folder possibly when you re-run it undoing some of your changes. But you can use the IDE if you want, or use rebuild.cmd or call msbuild or ninja (given configured for ninja or msbuild) your self, whatever you prefer.

  3. Some messages are only shown once while cmake searches for something, if you later go in and change things it will not give another status message

I got the impression you only used make.bat which would reconfigure your build folder possibly when you re-run it undoing some of your changes. But you can use the IDE if you want

  1. I don’t see a make.bat in my build directory is it the same as using make in cmd.exe?

  2. Does that mean that if I make a change in CMakeCache.txt and build in Visual Studio then Visual Studio will figure out what changes I made in CMakeCache.txt on it’s own?

Some messages are only shown once while cmake searches for something, if you later go in and change things it will not give another status message

  1. But the changes made in CMakeCache.txt apply nonetheless right?
  1. Use whatever you are most comfortable with to build.

  2. Yes

  3. Yes

Thanks for your replies!

One final thing: Where is that make.bat that you mentioned?

It’s in the root of the source folder