Skip to content

edwintorok/dune-compiledb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build and test OCaml-CI Build Status

Dune-compiledb — generate compile_commands.json

The compile_commands.json is used by language servers like clangd to determine what flags to use when analysing C source code. It is also used by static analysers such as goblint to determine how to preprocess C files.

Using the correct include flags is important, otherwise the <caml/...> headers won't be found by these tools.

Installation

opam install dune-compiledb

Requires OCaml 4.08+ and Dune 2.7+.

Usage

Run this to create a compile-commands.json:

dune rules | dune-compiledb

Now clangd integration with your editor should work.

Alternatives

bear can be used if your project doesn't have header files generated at build time:

dune clean && bear -- dune build @check --cache=disabled

However, the generated compile_commands.json lacks the -iquote flag and clangd won't be able to find the generated header files (if any).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors