CoatiSoftware / Sourcetrail

Sourcetrail - free and open-source interactive source explorer
https://www.sourcetrail.com/
GNU General Public License v3.0
14.94k stars 1.41k forks source link

VS: 'create compilation database' greyed out in VS2019 #1173

Open PhilipOakley opened 3 years ago

PhilipOakley commented 3 years ago

I have just update my VS install and Sourcetrail after a period of non-use. I now have Sourcetrail 2021.1.30 and Visual Studio 2019 Community 16.9.3. I installed the Sourcetrail extension via the market place (the menu sequence is different to that advertised in the docs https://github.com/CoatiSoftware/Sourcetrail/issues/1172)

I have the source code of Git for Windows (GfW) which is the target for the compilation. GfW has changed from using a .sln project file to using a cmake file (see https://github.com/git-for-windows/git/tree/vs/master), which VS detects and will build from.

I'm checked out at https://github.com/git-for-windows/git/commit/0489a04b6d, VS did compile, & test, the revision.

However I cannot find any way to get Sourcetrail to integrate with the VS Code. I opened Sourcetrail first, then started VS, loading and build/rebuilding the project, and then tried to create a Sourcetrail project to follow it.

This fails at the 'add source group' step as I can't manage to get a Compilation database created, either from the Sourcetrail button "Create Compilation Database" (the INFO message about 'requesting IDE to create Compilation Database via plug-in' is generated but never returns), or from the VS menus: Extension > Sourcetrail > Create Compilation Database (which is greyed out). The Sourcetrail 'Open Log Directory' works.

Any suggestions or help? How do I check that the plug-in is installed properly - how can I tell? Does the use of a cmake build confuse the Sourcetrail integration? Do I have a PEBCAK problem?

mlangkabel commented 3 years ago

I don't think that the SourcetrailExtension for VS supports cmake projects. You could try the Clang Power Tools extension. After installing that one, right-click your solution inside the Solution Explorer of VS and there should be a "Clang Power Tools -> Export Compilation Database" option. Using the exported CDB, just create a CDB based project in Sourcetrail. You should still be able to use the Sourcetrail Extension to synchronize ST and VS.

PhilipOakley commented 3 years ago

@mlangkabel Thank you for the suggestion. I loaded the extension into VS, but it (VS & Clang) is still not detecting the 'project'. I.e. the Clang Power Tools options aren't showing when I right click.

I did get the attached warning saying that the CMake support is still in beta image The latest Git for Windows project (being pure cmake), doesn't have any vcxproj associated with it, which could be part of the problem.

I did notice that VS Tools there is a "Generate Sourcetrail Database" option (2nd from top) but it doesn't appear to do anything except give a warning "Could not find selected project. Make sure...". image The option may have been there all the time without me noticing.

I may try the Creating traditional Visual Studio sln from CMake converter. Or may try other routes via the GfW SDK, but I'm cautious about jumping between fails 😉

The VS view image if that's any help for suggestions.