Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caellian/sourcedepgraph
A tool that generates include graph from C/C++ source files.
https://github.com/caellian/sourcedepgraph
c cpp dependencies dependency-graph include-files includes source-code-analysis sourcegraph
Last synced: 14 days ago
JSON representation
A tool that generates include graph from C/C++ source files.
- Host: GitHub
- URL: https://github.com/caellian/sourcedepgraph
- Owner: Caellian
- License: gpl-3.0
- Created: 2024-04-21T18:32:48.000Z (7 months ago)
- Default Branch: trunk
- Last Pushed: 2024-04-24T10:36:56.000Z (7 months ago)
- Last Synced: 2024-04-24T15:19:17.259Z (7 months ago)
- Topics: c, cpp, dependencies, dependency-graph, include-files, includes, source-code-analysis, sourcegraph
- Language: Python
- Homepage:
- Size: 252 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cdepgraph
A tool that generates include graph from C/C++ source files.
![example image](./assets/example.png "Example Image")
It's very primitive and won't work for very unconventional projects, but it
should in most cases where:- Local include headers are expected to have appropriate extensions (`.h`,`.hh`,`.hpp`,`.hxx`, etc.)
- Headers without extensions are assumed to belong to stdlib
- Sources are expected to have appropriate extensions (`.c`,`.cc`,`.cpp`,`.cxx`, etc.)
- Compile flags aren't handled
- A single program entry point is expected (e.g. `main.cpp`)## Usage
```
usage: cdepgraph [-h] [-m MAIN_FILE] [-i INCLUDE_PATHS] [-l] [-e] [-s] [-c] [-o OUTPUT] [-F OUTPUT_FORMAT] SOURCE_DIRECTORYGenerates include graph from C/C++ source files
positional arguments:
SOURCE_DIRECTORY Source directory containing program entry pointoptions:
-h, --help show this help message and exit
-m MAIN_FILE, --main-file MAIN_FILE
Main file name and extension; default is any of main.c/cc/cpp/etc.
-i INCLUDE_PATHS, --include-paths INCLUDE_PATHS
Semicolon (;) separated list of additional include paths
-l, --std-lib Include standard library includes in produced graph
-e, --system Include system includes in produced graph
-s, --strict Exclude includes which can't be found
-c, --check-sources Check includes of corresponding source files
-o OUTPUT, --output OUTPUT
Output file name
-F OUTPUT_FORMAT, --output-format OUTPUT_FORMAT
Output file format
```Runs well on most Linux distros, running on other platforms will require adjusting `INCLUDE_PATHS` constant for `-l` argument to work.
## Requirements
All requirements can be found in [`requirements.txt`](./requirements.txt) file.
[PyGraphviz](https://pygraphviz.github.io/documentation/stable/install.html) is required to generate `.dot` files.
## Future Work
In future, the following improvements could potentially be made:
- Loading previously generated files for visualization. (why?)
## License
This tool is licensed under [GPLv3](./LICENSE) license.