diff options
author | Alex Neundorf <neundorf@kde.org> | 2010-11-09 20:37:51 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2010-11-09 20:37:51 (GMT) |
commit | 84ce612c65520c273aa3b1d2efd2f8f4de7d3867 (patch) | |
tree | 3b8b53490941a16801a9530e0b258268148a5e38 /Source/cmGraphVizWriter.h | |
parent | a60b09927d4c29756c428d4c38f5ee2810a8f66e (diff) | |
download | CMake-84ce612c65520c273aa3b1d2efd2f8f4de7d3867.zip CMake-84ce612c65520c273aa3b1d2efd2f8f4de7d3867.tar.gz CMake-84ce612c65520c273aa3b1d2efd2f8f4de7d3867.tar.bz2 |
Move the code for generating dot-files into separate class cmGraphVizWriter
Alex
Diffstat (limited to 'Source/cmGraphVizWriter.h')
-rw-r--r-- | Source/cmGraphVizWriter.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h new file mode 100644 index 0000000..fd3d3e2 --- /dev/null +++ b/Source/cmGraphVizWriter.h @@ -0,0 +1,70 @@ +#ifndef CMGRAPHVIZWRITER_H +#define CMGRAPHVIZWRITER_H +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmStandardIncludes.h" +#include "cmLocalGenerator.h" +#include "cmGeneratedFileStream.h" + + +/** This class implements writing files for graphviz (dot) for graphs + * representing the dependencies between the targets in the project. */ +class cmGraphVizWriter +{ +public: + + cmGraphVizWriter(const std::vector<cmLocalGenerator*>& localGenerators); + + void ReadSettings(const char* settingsFileName, + const char* fallbackSettingsFileName); + + void WritePerTargetFiles(const char* fileName); + + void WriteGlobalFile(const char* fileName); + +protected: + + int collectAllTargets(); + + int collectAllExternalLibs(int cnt); + + void WriteHeader(cmGeneratedFileStream& str) const; + + void WriteConnections(const char* targetName, + std::set<std::string>& insertedNodes, + std::set<std::string>& insertedConnections, + cmGeneratedFileStream& str) const; + + void WriteNode(const char* targetName, const cmTarget* target, + std::set<std::string>& insertedNodes, + cmGeneratedFileStream& str) const; + + void WriteFooter(cmGeneratedFileStream& str) const; + + bool IgnoreThisTarget(const char* name) const; + + cmStdString GraphType; + cmStdString GraphName; + cmStdString GraphHeader; + cmStdString GraphNodePrefix; + + const std::vector<cmLocalGenerator*>& LocalGenerators; + + std::map<cmStdString, const cmTarget*> TargetPtrs; + // maps from the actual target names to node names in dot: + std::map<cmStdString, cmStdString> TargetNamesNodes; + + std::set<cmStdString> TargetsToIgnore; + +}; + +#endif |