Visualizing dependencies of kdelibs (or any other cmake-built package)

Alexander Neundorf neundorf at kde.org
Sun Oct 31 17:07:08 GMT 2010


Hi,

attached you can find a dependency graph for kfile in kdelibs.

This graph was created using dot, and the dotfile has been created 
automatically by cmake.
So, you can do this for any cmake-based software, i.e. for all of KDE, etc.
It generates a dot-file for the whole project (too big to be usable e.g. for 
kdelibs), and also a separate dot-file for each target.

Some of you may know that cmake has a "--graphviz=<filename>" command line 
argument. If you give this to cmake, it will generate a dot file from the 
software it is currently generating makefiles for.
Unfortunately this feature is/was a bit buggy.

You need to fetch cmake from the ImprovedDotSupport-branch in git:
http://cmake.org/gitweb?p=stage/cmake.git;a=shortlog;h=refs/heads/ImprovedDotSupport

Build it, and then you can use it to generate such dependency graphs.

To use it, change into an already existing build tree, and run cmake there:
$ cd builddir/
buildir/$ cmake . --graphviz=kdelibs.dot
...
Writing kdelibs.dot.testkhtml...
Writing kdelibs.dot.testkhtml_static...
Writing kdelibs.dot.testkjs...
Writing kdelibs.dot.testkjs_static...
Writing kdelibs.dot.testmodelqueuedconnections...
Writing kdelibs-2.8.3/kdelibs.dot.testqtargs...
Writing kdelibs.dot.testserver...
Writing kdelibs.dot.threadweaver...
Writing kdelibs.dot.undomanager_test...
Writing kdelibs.dot.valuetest...
Writing kdelibs.dot...
-- Generating done
builddir/$ dot kdelibs.dot.kfile -Tpdf -okdelibs.dot.kfile.pdf

And there you have the pdf which is attached here.

Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs.dot.kfile.pdf
Type: application/pdf
Size: 28745 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20101031/f766c273/attachment.pdf>


More information about the kde-core-devel mailing list