by Sarcasm

Sarcasm / compdb

The compilation database Swiss army knife

141 Stars 10 Forks Last release: over 2 years ago (v0.2.0) MIT License 149 Commits 5 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

compdb: the compilation database Swiss army knife

.. contents:: :local:


compdb_ is a command line tool to manipulates compilation databases. A compilation database is a database for compile options, it has records of which compile options are used to build the files in a project. An example of compilation database is the

JSON Compilation Database

aims to make it easier for you to run tools on your codebase by spoon-feeding you the right compile options.

is not so much about generating the initial compilation database, this, is left to other tools, such as
. It is only a glue between the initial compilation database and your tool(s).


With the proliferation of Clang-based tools, it has become apparent that the compile options are no longer useful uniquely to the compiler.

Standalone tools such as clang-tidy_ or text editors with libclang_ integration have to deal with compile options.

Examples of such tools, dealing with compilation databases are: irony-mode, rtags and ycmd_.

Based on this evidence,

came to life. A tool that has knowledge of the compile options and can share it both to inform the text editor and to run clang based tool from the shell.

Getting started

Installation ~~~~~~~~~~~~

Install with pip_::

pip install compdb

From Github, as user::

pip install --user git+

Generate a compilation database with header files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Assuming a build directory

, containing a
, a new compilation database, containing the header files, can be generated with::

compdb -p build/ list > compile_commands.json

Running the tests ~~~~~~~~~~~~~~~~~

To run the tests, type::

python -m tests


tox --skip-missing-interpreters

For regression tests on a few open source projects::

cd tests/regression/headerdb make [all|help]


Contributions are always welcome!

Try to be consistent with the actual code, it will ease the review.


This project is licensed under the MIT License. See LICENSE.txt for details.


  • repo_: for its ubiquitous command line interface, which served as an inspiration
  • scan-build_: for the clear Python package design
  • git_: for the
    : for the interesting article serie on
    CLI design

.. clang-tidy: .. _CLI design: .. _compdb: .. _git: .. _irony-mode: .. .. _JSON Compilation Database: .. _libclang: .. _pip: .. _repo: .. _rtags: .. _scan-build: .. _ycmd:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.