[Solved] Windows MSVC build taking long even without any files changed


I have noticed that Blender takes around 15-20 seconds to compile despite not having changed any files between two compilations. The attached log also makes it seem like it’s also going through the vcxproj list twice, which does not seem right to me:

blender-compile-log.txt (33.7 KB)

Is there some configuration that I’m missing to make it skip redundant recompiles of unchanged code, and to avoid it seemingly compiling everything twice?

Alternatively, I would appreciate some advice on more quickly developing and testing Python changes (besides copy-pasting the script into the Text Editor and running it), as it’s that workflow where I usually notice this delay the most.

Thanks for any help! :slight_smile:

It’s good to be aware of what make.bat goals are, it sets up a project and builds it in a way, so that even the most novice user can use it to build blender. It’s goals and the goals of a daily developer do not align super well…

To make building as bullet proof as possible, it runs cmake every time by force, does the build and install steps separately and runs install every time by force. Great ways to make sure blender builds and runs properly for almost everyone, less great for daily development.

I recommend for daily development, to run make.bat once to setup your project files, and not run it again, the Visual studio IDE is the easiest from there, since it goes though the project list only once and by default doesn’t build the install project.

If you are set on using a command line build, In your build folder there will be a rebuild.cmd that you can customize to your liking and as an added bonus does the build/install phase as a single step (you can make it build blender.sln rather than INSTALL.vcproj to skip the install phase there as well) another option would be to use ninja as your build system for cli builds, it’s much faster than msbuild.

Also turning off WITH_BUILDINFO in the cmakecache.txt will save you a lots of time since it won’t relink the blender executable every time just to get an updated date/time in there.

1 Like

Thanks a lot for your response!

Seems like running the compile from Visual Studio is the best way to go (it’s basically an instant build).
Meanwhile, using a slightly modified rebuild.cmd (no more cmake invocation, and targetting blender.sln), it still takes around 6 seconds, so I assume VS runs MSBuild differently still (or does the up-to-date checks itself?)…

Anyway, I’ll be able to work a lot better like this, even if there isn’t a simple command line to replicate VS’ build times. :slight_smile:

the ide build should be on par with building blender.sln in rebuild.cmd, however the IDE will not run the environment setup and cmake stages that rebuild.cmd by default ships with.

if you haven’t already tried, give ninja a go, install the ninja executable somewhere in your path and run make ninja builddir my_ninja_build to give it a separate build folder (cmake does not like to switch between msbuild and ninja once the project is created, to best to give it its own folder) see what that gets you.

1 Like

Yeah, I tried to simplify the rebuild.cmd as best I can, but not sure what’s wrong.
Either way, I tried out Ninja and it’s exactly as fast as builds from Visual Studio, so this is perfect for me! Many thanks for the tip! :partying_face:

Btw, the latest version of Ninja comes bundled with VS2019 if you install the “CMake tools” feature, so I didn’t even need to download it by hand (the make script loads the VS environment setup, which includes it in the PATH as well).