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.
- Start Visual Studio and open the VisualGDB Embedded Project Wizard. The same steps will also work for the Linux Project Wizard:
- On the first page select “Create a new project” and switch the build system to “GNU Make”:Selecting “GNU Make” will create an old-style Makefile-based project so that we can then convert it to the new MSBuild system.
- Select your embedded device. The steps shown in this tutorial will work for any supported device, so select the one you typically use:
- Proceed with the default project sample:
- If you want to test your project under debugger, select your debugging settings on the last page. Otherwise simply click “Finish”:
- 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:
- Build the project and ensure it succeeds:Note how the extra settings we entered in the previous step got saved to the debug.mak file.
- Now we will proceed with the conversion. Right-click on the project in Solution Explorer and select “Convert project to MSBuild”:
- 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:
- 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:
- Open VisualGDB Project Properties. Note how instead of Makefile Settings page VisualGDB now shows MSBuild Settings and the manually added settings were automatically converted:
- 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:
- 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:
- 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:
- To avoid confusion we recommend removing the non-VisualGDB platforms from your solution and projects on you can confirm that the MSBuild platform works:
- You can now also remove the Makefile and .mak files from Solution Explorer and physically delete them. The MSBuild system does not use them: