[cmake-developers] Improved graphviz support
Alexander Neundorf
neundorf at kde.org
Mon Nov 1 09:42:40 EDT 2010
Hi,
attached you can find a dependency graph for the khtmlpart in kdelibs.
This graph was created using dot from a dot-file generated by cmake using
the --graphviz option.
This feature was a bit buggy, e.g. it ignored targets which didn't link to
anything. So I spent some time on it and now it works better.
You can see what I have so far here in the ImprovedDotSupport-branch :
http://cmake.org/gitweb?p=stage/cmake.git;a=shortlog;h=refs/heads/ImprovedDotSupport
The old code produced one dot-file containing everything. This is not usable
for big projects, i.e. I was not able to zoom into the generated image or pdf
with any application, they all crashed, because it was too big.
Also, there was just too much in it for one graph (for kdelibs it's around
1000 nodes).
So now, if you say --graphviz=kdelibs.dot, cmake generates the all-in-one file
kdelibs.dot, and additionally for each target a kdelibs.dot.<targetname>
file, which contains only the dependencies of this target.
$ 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
Is that ok or should there be a switch whether I want all the separate
dot-files ?
Or should this be configurable via the file CMakeGraphVizOptions.cmake, which
can already now be used e.g. to specify targets which should be ignored ?
I could also add options to CMakeGraphVizOptions.cmake so that you could
specify a include/exclude regex, or that you can say it should only generate
graphs for LIBRARY targets, etc.
But OTOH, you could simply ignore the dot-files you're not interested in...
The code to do this is now around 350 lines (6 functions) in cmake.cxx, I
guess I should move this to a separate class/file.
Comments ?
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs.dot.khtmlpart.pdf
Type: application/pdf
Size: 32728 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20101101/68ff128d/attachment-0002.pdf>
More information about the cmake-developers
mailing list