summaryrefslogtreecommitdiff
path: root/Source/cmGraphVizWriter.h
diff options
context:
space:
mode:
authorStephan Rohmen <s.rohmen@gmx.de>2020-07-21 19:45:45 +0200
committerBrad King <brad.king@kitware.com>2020-07-21 14:55:44 -0400
commit93549b9224821eda5b6402c7fc4fc77708bcd86f (patch)
tree20e50c8c0111503d49d63877d2b2cd4dde60de85 /Source/cmGraphVizWriter.h
parente647949539f4704a00eddac2357d59ceeb8bc0ca (diff)
downloadcmake-93549b9224821eda5b6402c7fc4fc77708bcd86f.tar.gz
Graphviz: Restore support for per-target dependency graph options
The behaviors controlled by options `GRAPHVIZ_GENERATE_PER_TARGET` and `GRAPHVIZ_GENERATE_DEPENDERS` were broken by commit 553658393c (Graphviz: added test suite, fixes, enhancements, 2019-10-08, v3.17.0-rc1~615^2). It had not been covered in the test suite previously, and those changes left out checks for these features from the `default_options` case. Implement the previously-existing behavior in the new graphviz generation engine added by the above-mentioned commit. Fixes: #20928
Diffstat (limited to 'Source/cmGraphVizWriter.h')
-rw-r--r--Source/cmGraphVizWriter.h36
1 files changed, 35 insertions, 1 deletions
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
index 578660dbbb..9766068a2a 100644
--- a/Source/cmGraphVizWriter.h
+++ b/Source/cmGraphVizWriter.h
@@ -7,16 +7,18 @@
#include <map>
#include <memory>
+#include <set>
#include <string>
+#include <utility>
#include <vector>
#include "cmsys/RegularExpression.hxx"
#include "cmGeneratedFileStream.h"
+#include "cmLinkItem.h"
#include "cmLinkItemGraphVisitor.h"
#include "cmStateTypes.h"
-class cmLinkItem;
class cmGlobalGenerator;
/** This class implements writing files for graphviz (dot) for graphs
@@ -47,6 +49,22 @@ private:
using FileStreamMap =
std::map<std::string, std::unique_ptr<cmGeneratedFileStream>>;
+ struct Connection
+ {
+ Connection(cmLinkItem s, cmLinkItem d, std::string scope)
+ : src(std::move(s))
+ , dst(std::move(d))
+ , scopeType(std::move(scope))
+ {
+ }
+
+ cmLinkItem src;
+ cmLinkItem dst;
+ std::string scopeType;
+ };
+ using Connections = std::vector<Connection>;
+ using ConnectionsMap = std::map<cmLinkItem, Connections>;
+
void VisitLink(cmLinkItem const& depender, cmLinkItem const& dependee,
bool isDirectLink, std::string const& scopeType = "");
@@ -66,6 +84,19 @@ private:
cmLinkItem const& dependeeTargetName,
std::string const& edgeStyle);
+ void FindAllConnections(const ConnectionsMap& connectionMap,
+ const cmLinkItem& rootItem,
+ Connections& extendedCons,
+ std::set<cmLinkItem>& visitedItems);
+
+ void FindAllConnections(const ConnectionsMap& connectionMap,
+ const cmLinkItem& rootItem,
+ Connections& extendedCons);
+
+ template <typename DirFunc>
+ void WritePerTargetConnections(const ConnectionsMap& connections,
+ const FileStreamMap& streams);
+
bool ItemExcluded(cmLinkItem const& item);
bool ItemNameFilteredOut(std::string const& itemName);
bool TargetTypeEnabled(cmStateEnums::TargetType targetType) const;
@@ -83,6 +114,9 @@ private:
FileStreamMap PerTargetFileStreams;
FileStreamMap TargetDependersFileStreams;
+ ConnectionsMap PerTargetConnections;
+ ConnectionsMap TargetDependersConnections;
+
std::string GraphName;
std::string GraphHeader;
std::string GraphNodePrefix;