-
Notifications
You must be signed in to change notification settings - Fork 448
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
Emit compile_commands.json #497
Comments
I was thinking and the problem is, what happens with multiple Option 1: be explicit. Create a All options have something to dislike, I am not sure which is better. Or maybe there is an option 4. |
@alexeyr, what do you think about following option: let mut database = CompilationDatabase::new();
cc::Build::new().file("blobstore.c").compile_and_store("blobstore", &mut database);
// … more builds
database.store(/* maybe with a path */); If we find a nice API I'm happy to contribute that API. |
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
This commit adds API to record the compilation invocations in order to emit compile_commands.json a.k.a. JSON compilation database. Fixes rust-lang#497
Came here to request this very same feature! In the meantime I think I may be able to capture the compiler commands by wrapping the compiler with a shell script... |
That was ultimately our solution in shadow, which is in the process of incrementally migrating from C to Rust. We already had a setup script to wrap our build process, so we changed it to use the bear wrapper to generate compile_commands.json. |
@sporksmith Could you point to how you setup the bear wrapper for cc::Build? |
https://github.com/shadow/shadow/blob/main/setup#L249 Our build system has accumulated a number of layers. We use a custom python script Instead of running just For a project that doesn't have the cmake layer, I think you could run |
Many editors and IDEs work better on C code when provided with a compilation database (
compile_commands.json
) because it tells the editor where to look for include files, the values of defines, etc.. Here are tools to generate compilation databases when using Make or cmake to build a C code base. For projects where the C code is embedded a Rust project and built with this crate, it would be helpful to be able to get a compilation database.The text was updated successfully, but these errors were encountered: