Giter Site home page Giter Site logo

rmgiroux / cppdep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rakhimov/cppdep

0.0 2.0 0.0 329 KB

C/C++ Dependency Analyzer: a rewrite of John Lakos' dep_utils (adep/cdep/ldep) from "Large-Scale C++ Software Design"

License: GNU General Public License v3.0

Python 100.00%

cppdep's Introduction

logo

https://travis-ci.org/rakhimov/cppdep.svg?branch=master 'Build status' Code Health

cppdep performs dependency analyses among components/packages/package groups of a large C/C++ project. This is a rewrite of dep_utils(adep/cdep/ldep), which is provided by John Lakos' book "Large-Scale C++ Software Design", Addison Wesley (1996).

Differences from dep_utils

  • Rewrite in Python, unifying adep/cdep/ldep into one tool
  • Single configuration file (yaml file)
  • No file alias support for the archaic file-name length limitations
  • An extended notion of Component (header- or source-only)
  • Support for multiple packages and package groups
  • Support for exporting final dependency graph to Graphviz dot format

Limitations

  • Indirect extern declarations of global variables or functions instead of including the proper component header with the declarations.
  • Embedded dynamic dependencies, such as dynamic loading and configurable internal services.
  • Preprocessing or macro expansion is not performed. Dependency inclusion via preprocessor meta-programming is not handled.
  • Dependency exclusion with C style multi-line comments or macros is not respected.

Requirements

  1. Python 2.7 or 3.4+
  2. NetworkX
  3. pydotplus
  4. PyYAML
  5. PyKwalify
  6. (Optional) Graphviz
  7. (Optional) xdot

The dependencies can be installed with pip.

$ sudo pip install networkx pydotplus PyYAML PyKwalify

Installation

The latest stable release from PyPi:

$ sudo pip install cppdep

Usage

Create a configuration file that describes the project for analysis. config_example.yml and config_schema.yml are given for guidance.

In the root directory of the project with the configuration file, run the following command to generate dependency analysis reports and graphs.

$ cppdep -c /path/to/config/file

Graph to Image Conversion

To view the generated graph dot files without converting to other formats.

$ xdot graph.dot

Here's how to convert a Graphviz dot file to PDF format.

$ dot -Tpdf graph1.dot -o graph1.pdf

Apply -O flag to automatically generate output file names from the input file names.

$ dot -T pdf graph1.dot -O  # The output file is graph1.dot.pdf

To run dot on files in directories and sub-directories recursively.

$ find -type f -name "*.dot" directory_path | xargs dot -Tpdf -O

To create output file names without .dot in the name.

$ find -type f -name "*.dot" directory_path -exec sh -c 'dot -Tpdf "${0}" -o "${0%.*}.pdf"' {} \;

External links

  1. The last known location of John Lakos' dep_utils source code: http://www-numi.fnal.gov/computing/d120/releases/R2.2/Dependency/
  2. Experimental packaging of dep_utils source code: https://sourceforge.net/projects/introspector/files/lsc-large-scale-c/first-release/
  3. Nmdepend, a lightweight 'link-time' dependency analyzer for C++ using object files and libraries instead of source-code as input.

Acknowledgments

  • John Lakos for inventing the analysis and providing dep_utils.
  • Zhichang Yu for rewriting dep_utils into Python.

cppdep's People

Contributors

rakhimov avatar yuzhichang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.