Seamlessly Accelerate CMake Projects in Visual Studio with Incredibuild
Visual Studio 2017 shipped with first-class CMake support. Since then, we’ve continued to improve our CMake support by adding new features based on your feedback. We previously blogged about the built-in Incredibuild support for accelerating and visualizing your vcxproj projects, and many of you asked to get this same level of support for your CMake projects. We’re happy to announce that Incredibuild can now be used to accelerate the Windows builds of your CMake projects from within Visual Studio.
The backbone of Incredibuild’s offering, Virtualized Distributed Processing™ enables a workload that consists of multiple, concurrent processes to be automatically and dynamically distributed to hundreds, and even thousands of idle CPUs on remote machine across your network or public cloud. Because CMake builds consist of hundreds of compilation tasks that can be executed in parallel, having hundreds of cores at your disposal can highly accelerate build times, which is exactly what distributed computing offers.
Virtualized Distributed Processing™ can even use idle CPUs on remote machines while users are working on them – operating in the background. In organizations that have hundreds of machines, the aggregated number of idle CPUs in any given moment can easily be in the thousands. These are wasted cores that Incredibuild recaptures to accelerate time consuming workloads in need of computing power.
Incredibuild runs processes on remote machines in a secure sandbox. Everything a process requires to run properly is dynamically emulated by Incredibuild from the local host to the remote machine. This means all you need to install on remote machines is the Incredibuild Agent – there’s no need to install Visual Studio, nor your source code or any other build tools. Any output generated by the remotely executed process – std output, errors, return codes, files generated, etc. – is automatically synched back to the local host, as if the process had been executed locally.
Using Visual Studio + CMake + Incredibuild
In the Visual Studio Installer, ensure that the checkboxes for “C++ CMake tools for Windows” and “IncrediBuild – Build Acceleration” are selected:
Once installed, an Incredibuild toolbar and menu appear in the Visual Studio development environment, offering Incredibuild’s distributed Build and Rebuild operations.
Visualizing your build with Incredibuild’s Build Monitor
Another benefit of Incredibuild that you can take advantage of from directly within the IDE is the Incredibuild Build Monitor tool. This build visualization tool replaces your old text output with a sleek, intuitive graphic UI, transforming your build into a visual entity you can easily engage with, and helps you spot long durations, errors, warnings, bottlenecks, and dependencies.
Let’s take a look at the standard text output we’re all used to working with:
Now take a look at how a build looks like with Incredibuild’s Build Monitor tool, seamlessly integrated into the Visual Studio experience:
Each color represents the build task status, allowing you to immediately identify which build tasks were executed without a problem and which require your attention. The bar width represents the duration of a specific task, and the side navigation bar lays out the specific machine and core on which the task was executed.
For more information, refer to the previous blog post on Incredibuild’s Build Monitor.
How much faster are CMake builds with Incredibuild?
The following data is based on running CMake with MSBuild by compiling the popular core OpenCV open-source project to establish a known base line. This example uses the Ninja generator, but all the Visual Studio generators are supported. Here are the results with Incredibuild:
Here is what the CMake OpenCV build looks like in the Build Monitor.
All in all, there is a 9.5X performance boost which means developers can spend more time building great code in the zone and less time waiting for code to build. In this specific use-case, adding additional cores to the Incredibuild pool, on top of the 100 cores used in this example, will result in even better compile time.
Continuous integration, Continuous improvement
You can use the same Incredibuild infrastructure to accelerate your CMake project under your CI/CD of choice for the full experience and to also accelerate unit tests that are part of your build or other compute intensive processes such as code analysis, code signing, various test types and more.
Talk To Us
We encourage you to download Visual Studio 2019 and try the Incredibuild functionality. We can be reached via the comments below or via email (email@example.com). If you encounter other problems with Visual Studio or have other suggestions you can use the Report a Problem tool in Visual Studio or head over to the Visual Studio Developer Community. You can also find us on Twitter (@VisualC).