{"id":27444,"date":"2021-01-27T15:00:18","date_gmt":"2021-01-27T15:00:18","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cppblog\/?p=27444"},"modified":"2021-01-27T17:58:07","modified_gmt":"2021-01-27T17:58:07","slug":"seamlessly-accelerate-cmake-projects-in-visual-studio-with-incredibuild","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/seamlessly-accelerate-cmake-projects-in-visual-studio-with-incredibuild\/","title":{"rendered":"Seamlessly Accelerate CMake Projects in Visual Studio with Incredibuild"},"content":{"rendered":"<p>Visual Studio 2017 shipped with <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/cmake-support-in-visual-studio\/\">first-class CMake support<\/a>. Since then, we\u2019ve continued to improve our CMake support by adding new features based on your feedback. We previously blogged about the <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/visualize-your-build-with-incredibuilds-build-monitor-and-visual-studio-2019\/\">built-in Incredibuild support for accelerating and visualizing your vcxproj projects<\/a>, and many of you asked to get this same level of support for your CMake projects. We\u2019re happy to announce that Incredibuild can now be used to accelerate the Windows builds of your CMake projects from within Visual Studio.<\/p>\n<h3><strong>Incredibuild Recap<\/strong><\/h3>\n<p>The backbone of Incredibuild\u2019s offering, <a href=\"https:\/\/www.incredibuild.com\/technology?utm_source=visual_studio_blog&amp;utm_medium=referral\">Virtualized Distributed Processing<\/a>\u2122 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.<\/p>\n<p>Virtualized Distributed Processing\u2122 can even use idle CPUs on remote machines while users are working on them \u2013 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.<\/p>\n<p>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. <strong>This means all you need to install on remote machines is the Incredibuild Agent \u2013 there\u2019s no need to install Visual Studio, nor your source code or any other build tools.<\/strong> Any output generated by the remotely executed process &#8211; std output, errors, return codes, files generated, etc. \u2013 is automatically synched back to the local host, as if the process had been executed locally.<\/p>\n<h3><strong>Using Visual Studio + CMake + Incredibuild<\/strong><\/h3>\n<p>In the Visual Studio Installer, ensure that the checkboxes for \u201cC++ CMake tools for Windows\u201d and \u201cIncrediBuild \u2013 Build Acceleration\u201d are selected:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/installer.png\"><img decoding=\"async\" class=\"alignnone wp-image-27445 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/installer.png\" alt=\"The checklist of optional features to install, including CMake Tools and Incredibuild\" width=\"416\" height=\"497\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/installer.png 416w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/installer-251x300.png 251w\" sizes=\"(max-width: 416px) 100vw, 416px\" \/><\/a><\/p>\n<p>Once installed, an Incredibuild toolbar and menu appear in the Visual Studio development environment, offering Incredibuild\u2019s distributed Build and Rebuild operations.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/buildIDE.gif\"><img decoding=\"async\" class=\"alignnone wp-image-27446 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/buildIDE.gif\" alt=\"Animated gif showing Incredibuild building a project in a distributed fashion on many cores \" width=\"1552\" height=\"818\" \/><\/a><\/p>\n<h3><strong>Visualizing your build with Incredibuild\u2019s Build Monitor<\/strong><\/h3>\n<p>Another benefit of Incredibuild that you can take advantage of from directly within the IDE is the\u00a0<a href=\"https:\/\/www.incredibuild.com\/the-build-monitor?utm_source=visual_studio_blog&amp;utm_medium=referral\">Incredibuild Build Monitor<\/a>\u00a0tool. 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.<\/p>\n<p>Let\u2019s take a look at the standard text output we\u2019re all used to working with:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/terminal.jpg\"><img decoding=\"async\" class=\"alignnone wp-image-27447 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/terminal.jpg\" alt=\"Plain text output\" width=\"618\" height=\"215\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/terminal.jpg 618w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/terminal-300x104.jpg 300w\" sizes=\"(max-width: 618px) 100vw, 618px\" \/><\/a><\/p>\n<p>Now take a look at how a build looks like with Incredibuild\u2019s Build Monitor tool, seamlessly integrated into the Visual Studio experience:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitor.jpg\"><img decoding=\"async\" class=\"alignnone wp-image-27448 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitor.jpg\" alt=\"Visual build monitor, showing passed tasks, tasks with warning, and a system utilization graph on a timeline\" width=\"1430\" height=\"754\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitor.jpg 1430w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitor-300x158.jpg 300w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitor-1024x540.jpg 1024w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitor-768x405.jpg 768w\" sizes=\"(max-width: 1430px) 100vw, 1430px\" \/><\/a><\/p>\n<p>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.<\/p>\n<p>For more information, refer to the <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/visualize-your-build-with-incredibuilds-build-monitor-and-visual-studio-2019\/\">previous blog post on Incredibuild\u2019s Build Monitor<\/a>.<\/p>\n<h3><strong>How much faster are CMake builds with Incredibuild? <\/strong><\/h3>\n<p>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:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/chart.png\"><img decoding=\"async\" class=\"alignnone wp-image-27449 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/chart.png\" alt=\"Graph showing the following results of number of machines and cores against build time: 1 machine, 8 cores took 16 minutes. 4 machines, 22 cores took 6:26. 5 machines, 30 cores took 4:42. 10 machines, 112 cores took 1:42.\" width=\"713\" height=\"271\" srcset=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/chart.png 713w, https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/chart-300x114.png 300w\" sizes=\"(max-width: 713px) 100vw, 713px\" \/><\/a><\/p>\n<p>Here is what the CMake OpenCV build looks like in the Build Monitor.<\/p>\n<p><strong> <a href=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitorgif.gif\"><img decoding=\"async\" class=\"alignnone wp-image-27450 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cppblog\/wp-content\/uploads\/sites\/9\/2021\/01\/monitorgif.gif\" alt=\"Animated gif showing the build monitor for a large build, with the tasks being distributed across many machines\" width=\"600\" height=\"338\" \/><\/a><\/strong><\/p>\n<p>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.<\/p>\n<h3><strong>Continuous integration, Continuous improvement<\/strong><\/h3>\n<p>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.<\/p>\n<h3>Talk To Us<\/h3>\n<p>We encourage you to\u00a0<a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">download Visual Studio 2019<\/a>\u00a0and try the <a href=\"https:\/\/www.incredibuild.com\/?utm_source=visual_studio_blog&amp;utm_medium=referral\">Incredibuild<\/a>\u00a0functionality. We can be reached via the comments below or via email (visualcpp@microsoft.com). If you encounter other problems with Visual Studio or have other suggestions you can use the\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio?view=vs-2019\">Report a Problem<\/a>\u00a0tool in Visual Studio or head over to the\u00a0<a href=\"https:\/\/developercommunity.visualstudio.com\/spaces\/62\/index.html\">Visual Studio Developer Community<\/a>. You can also find us on Twitter (<a href=\"https:\/\/twitter.com\/visualc\">@VisualC<\/a>).<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visual Studio 2017 shipped with first-class CMake support. Since then, we\u2019ve 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 [&hellip;]<\/p>\n","protected":false},"author":329,"featured_media":27448,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[270,1],"tags":[],"class_list":["post-27444","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcement","category-cplusplus"],"acf":[],"blog_post_summary":"<p>Visual Studio 2017 shipped with first-class CMake support. Since then, we\u2019ve 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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/27444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/329"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=27444"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/27444\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/27448"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=27444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=27444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=27444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}