Converting VisualGDB Make projects to MSBuild

This tutorial shows how to convert Makefile-based projects created with previous versions of VisualGDB to the new MSBuild backend. We will create a GNU Make-based project and convert it to the new MSBuild backend that supports faster building, precompiled headers, per-file settings and other advanced features. The steps shown in this tutorial will also work for CMake projects.

Before you begin, install VisualGDB 5.2R2 or later.

  1. Start Visual Studio and open the VisualGDB Embedded Project Wizard. The same steps will also work for the Linux Project Wizard:01-prjname
  2. On the first page select “Create a new project” and switch the build system to “GNU Make”:02-makeSelecting “GNU Make” will create an old-style Makefile-based project so that we can then convert it to the new MSBuild system.
  3. Select your embedded device. The steps shown in this tutorial will work for any supported device, so select the one you typically use:03-device
  4. Proceed with the default project sample:04-sample
  5. If you want to test your project under debugger, select your debugging settings on the last page. Otherwise simply click “Finish”:05-debug
  6. VisualGDB will now create a project for you. Before we begin converting it to MSBuild, open the VisualGDB Project Properties and add some extra include directories, preprocessor macros and library directories to see how those settings will be converted:06-settings
  7. Build the project and ensure it succeeds:07-makefileNote how the extra settings we entered in the previous step got saved to the debug.mak file.
  8. Now we will proceed with the conversion. Right-click on the project in Solution Explorer and select “Convert project to MSBuild”:08-convert
  9. If you are doing this with a real-world project, make a good backup. The conversion is irreversible and may cause strange errors if your Makefile has modifications that VisualGDB cannot recognize. Once you are done, proceed with the conversion:09-confirm
  10. VisualGDB will report that the conversion is complete. Note how the current platform got switched to “VisualGDB”. Build the project to ensure that conversion was successful:10-platform
  11.     Open VisualGDB Project Properties. Note how instead of Makefile Settings page VisualGDB now shows MSBuild Settings and the manually added settings were automatically converted:11-settings
  12. If you open the Visual Studio project properties, you will see settings similar to the normal Visual Studio projects for Windows. The settings imported from the Makefile project will be present there:12-settings2
  13. Review the Visual Studio project properties to ensure that all the relevant settings got automatically converted. If some of them do not match the Makefile project, adjust them manually:16-review
  14. If you now try to switch the configuration back to x86 (or Win32), the build will fail, as the .vgdbsettings files got converted to the new MSBuild system and don’t support launching GNU Make anymore:13-buildfail
  15. To avoid confusion we recommend removing the non-VisualGDB platforms from your solution and projects on you can confirm that the MSBuild platform works:14-remove
  16. You can now also remove the Makefile and .mak files from Solution Explorer and physically delete them. The MSBuild system does not use them:15-removemak