package dune-compiledb

  1. Overview
  2. Docs
Generate compile_commands.json from dune rules

Install

Dune Dependency

Authors

Maintainers

Sources

dune-compiledb-0.5.0.tbz
sha256=fb91db789db4c25e6339d955158fa227cb9547279f4e35acd132e715889686ca
sha512=59c8b94fb1270b7fe5c315eedb26da8d9b6041f64e6863571eb550420c17dd6b5a8b042dff9c934c2f0e4e43dff8912f4cbda007bce5de1a22c27b931ffa6509

README.md.html

README.md

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).

OCaml

Innovation. Community. Security.