Cpp Dependency Graph

License: MIT Build Status Maintainability Codacy Test Coverage Release

Generates useful component dependency visualisations (in dot or d3.js) to study the architecture of C/C++ projects.

Why do all the other languages have awesome tools to analyse codebases but C/C++ codebases do not?

It's time to change that.

This tool aims to -

  • provide multiple views into the architecture of a codebase
  • generate views at multiple levels of the architecture

Inspiration

This tool is inspired by a number of projects rubrowser, cpp-dependencies and objc-dependency-visualizer.

The pretty d3 visualisations are directly copied from objc-dependency-visualiser.

A huge shout out to the people behind these projects.

Usage

Installation

gem install cpp_dependency_graph

Overall component dependency graph

To generate the overall component depenency graph for a project, use it like so -

cpp_dependency_graph visualise -r spec\test\example_project\ -o deps.dot -f dot

Below is the overall dot and d3 component dependency visualisations for leveldb

Dot

d3.js visualisation of leveldb

d3.js visualisation of rocksdb

NOTE - If your project has a large number of components (> 100 and lots of connections between them), then generation (and subsequent rendering) may take some time.

Individual component dependency graph

This will highlight the dependencies coming in and going out of a specific component. This allows you to filter out extraneous detail and study individual components in more detail.

cpp_dependency_graph visualise -r spec\test\example_project\ -c Engine -o deps.dot -f dot

Here's a component dependency visualisation generated for the queue component in rethinkdb

Queue component dot visualisation

Queue component d3 visualisation

Component include dependency graph

This will highlight dependencies of includes within a specific component

cpp_dependency_graph visualise_includes -r spec\test\example_project\ -c Engine

Here's a component include dependency visualisation generated for the queue component in rethinkdb

Queue include graph dot

Queue include graph d3

Development

bundle exec cpp_dependency_graph visualise -r <dir>

License

cpp_dependency_graph is available under the MIT license.

Warranty

This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose.