-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add compile-commands.json generation for Managed Build Projects #689
Comments
How can we ensure that We could simply overwrite An alternative would be to write multiple compilation database files to the relevant MBS build configuration folder(s). We could then update the I would suggest enabling generation of the compilation database by default only in cases where the CDT-LSP C/C++ editor is installed in the first instance. At present, only a small minority of CDT users will make use of this file. |
You're right. That's exactly what the CDT-LSP project does in the |
Following the discussion on #692 , there are also other features that would be useful to have an worth discuss in the future :
|
IMO that should be done by the Builder. |
The last builder run != the current config all the time - the mismatch seems more common in practice on referenced library projects. It is close though and may be a suitable shortcut in the short term |
I wonder if that affects where the generation should be hooked into? |
I bring this conversation back to the bug because I don't think it is a blocker for merging #692 and progressing that work The generation of compile_commands.json is being done into a new "build" directory (see #692 (comment)) This is done so that .clangd can be checked into source control without user settings (e.g. active config) affecting it. Instead it relies on the standard discovery process of clangd to find compile_commands.json in This leads to an open problem, that the compile_commands.json, which is written on build, relies on the last build run to be the correct one for the active configuration. CDT has lots of bells and whistles, including the option to build all configurations and not just the active one. This can lead to mismatch in compile_commands.json. I don't have a better suggestion yet on how to resolve this, but IIUC the clangd-contexts project has tackled similar issues and considering what it has done, and what has been done in cdt-lsp to automatically update .clangd files all needs to be considered so we get a cohesive solution. The open question I have is can we make projects interoperable with other tools seamlessly. In particular can the project work with both VSCode and Eclipse "as expected" (for some still to be defined value for "as expected") |
Usage of .clangd for this purpose is problematic. As per the clangd documentation that file is for shared configuration and so is expected to be checked in to any version control system in use. There are many other settings in that file beyond the compile-commands.json location and if we start writing to it on config changes we would make it hard to version control CDT MBS projects. |
IIUC an alternative would be to use clangd-contexts as menditoned by @jonahgraham? |
my 2 cents: The plugin also provides a LanguageSettingsProvider which parses the file and feeds include paths and macros to the indexer. |
There's some interesting background discussion on options for tackling the per-build configuration compilation database requirement on the clangd side at clangd/clangd#116. A clangd plugin that could allow switching between compilation databases by interrogating the active CDT build configuration just in time would be ideal. |
Includes: - Created a new extension point to provide the opportunity to incorporate additional information into the file - New tests for the generator - Preference page to enable/disable generator Fixes eclipse-cdt#689
Includes: - Created a new extension point to provide the opportunity to incorporate additional information into the file - New tests for the generator - Preference page to enable/disable generator Fixes eclipse-cdt#689
Includes: - Created a new extension point to provide the opportunity to incorporate additional information into the file - New tests for the generator - Preference page to enable/disable generator Fixes eclipse-cdt#689
Includes: - Created a new extension point to provide the opportunity to incorporate additional information into the file - New tests for the generator - Preference page to enable/disable generator Fixes #689
The main code is submitted, now to create additional tickets for the next steps, such as #787 |
To support the CDT-LSP editor & other uses of language servers or external tools that expect a cmake compilation database we should add support for generating "compile-commands.json" to managed build projects.
There is already enough data in the existing managed build system to generate the file, so long as any extenders are using the command generator interfaces where they needed to customise tool commands.
Should be enabled by default, but have an option to disable on a per-project basis.
Need to consider how multiple configurations, probably just 1 file which matches active project unless we can make the language launcher aware of them.
File should be placed where ClangD expects to find it, so either in the project root or "build" directory. I suggest the "build" directory.
Renesas already has an internal version of this feature, we will contribute this & work with the community to modify as needed to fit CDTs requirements.
The text was updated successfully, but these errors were encountered: