package dune-compiledb

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

Install

Dune Dependency

Authors

Maintainers

Sources

dune-compiledb-0.4.0.tbz
sha256=54160a321a02984a0d1fabad4d741856f10ea92d6d4d3142ed3ff9c48f63e6e9
sha512=5c2b5ed9cdd14549ae3e65da7a0340f343587aa53376dde36fd146c0ad37ab80354985af9f2e82490c277313168621c47c29ce5b283928544b417bd0d225ef19

Description

Generates a compile_commands.json from dune rules that can be used by language server like 'clangd', or static analyzers like 'goblint'. Works with generated headers.

Published: 11 Sep 2023

README

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

Dependencies (6)

  1. fpath
  2. sexplib0
  3. sexplib
  4. ezjsonm >= "1.0.0"
  5. ocaml >= "4.08"
  6. dune >= "2.7"

Dev Dependencies (1)

  1. odoc with-doc

Used by (1)

  1. lintcstubs

Conflicts

None

OCaml

Innovation. Community. Security.