Skip to content
/ cmpdb Public

editor agnostic tool for generating json compilation database files

Notifications You must be signed in to change notification settings

thimc/cmpdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cmpdb

cmpdb (compilation database) is a go rewrite of compiledb.

This tool is suitable for make-based projects and is used to generate a JSON Compilation Database file for programs such as the popular LSP server clangd.

Usage

Before you invoke cmpdb, make sure your current working directory is the root of your project.

cmpdb does not require any any flags. Granted, the output will be printed to stdout rather than to a file, so to store the output you will need to redirect the output of cmpdb like so cmpdb > compile_commands.json. Another solution is to simply pass the -w flag which will write the file on disk.

If you wish to alter the behaviour of cmpdb, these flags are available:

-c  output the compilation command as a single string instead of a list of arguments
-d  sets the working directory
-f  expands the compiler executable path
-h  displays a help message
-i  sets the json indentation (default "  ")
-m  adds the compilers predefined macros to the argument list
-w  writes the content to "compile_commands.json" (default behaviour is to write to stdout)

Installation

go build -o cmpdb .
cp ./cmpdb /usr/local/bin/

Unit tests

go test -v ./...

Benchmarks:

go test -v -bench=. -run=^#

Note: The benchmark is somewhat of a fork bomb as it spawns a new process continuously in order to measure the total run time of what cmpdb's code functionality does

About

editor agnostic tool for generating json compilation database files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages