| 397 | } |
| 398 | |
| 399 | void cmGraphVizWriter::WriteLegend(cmGeneratedFileStream& fs) |
| 400 | { |
| 401 | // Note that the subgraph name must start with "cluster", as done here, to |
| 402 | // make Graphviz layout engines do the right thing and keep the nodes |
| 403 | // together. |
| 404 | /* clang-format off */ |
| 405 | fs << "subgraph clusterLegend {\n" |
| 406 | " label = \"Legend\";\n" |
| 407 | // Set the color of the box surrounding the legend. |
| 408 | " color = black;\n" |
| 409 | // We use invisible edges just to enforce the layout. |
| 410 | " edge [ style = invis ];\n" |
| 411 | // Nodes. |
| 412 | " legendNode0 [ label = \"Executable\", shape = " |
| 413 | << GRAPHVIZ_NODE_SHAPE_EXECUTABLE << " ];\n" |
| 414 | " legendNode1 [ label = \"Static Library\", shape = " |
| 415 | << GRAPHVIZ_NODE_SHAPE_LIBRARY_STATIC << " ];\n" |
| 416 | " legendNode2 [ label = \"Shared Library\", shape = " |
| 417 | << GRAPHVIZ_NODE_SHAPE_LIBRARY_SHARED << " ];\n" |
| 418 | " legendNode3 [ label = \"Module Library\", shape = " |
| 419 | << GRAPHVIZ_NODE_SHAPE_LIBRARY_MODULE << " ];\n" |
| 420 | " legendNode4 [ label = \"Interface Library\", shape = " |
| 421 | << GRAPHVIZ_NODE_SHAPE_LIBRARY_INTERFACE << " ];\n" |
| 422 | " legendNode5 [ label = \"Object Library\", shape = " |
| 423 | << GRAPHVIZ_NODE_SHAPE_LIBRARY_OBJECT << " ];\n" |
| 424 | " legendNode6 [ label = \"Unknown Library\", shape = " |
| 425 | << GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN << " ];\n" |
| 426 | " legendNode7 [ label = \"Custom Target\", shape = " |
| 427 | << GRAPHVIZ_NODE_SHAPE_UTILITY << " ];\n" |
| 428 | // Edges. |
| 429 | // Some of those are dummy (invisible) edges to enforce a layout. |
| 430 | " legendNode0 -> legendNode1 [ style = " |
| 431 | << GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n" |
| 432 | " legendNode0 -> legendNode2 [ style = " |
| 433 | << GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n" |
| 434 | " legendNode0 -> legendNode3;\n" |
| 435 | " legendNode1 -> legendNode4 [ label = \"Interface\", style = " |
| 436 | << GRAPHVIZ_EDGE_STYLE_INTERFACE << " ];\n" |
| 437 | " legendNode2 -> legendNode5 [ label = \"Private\", style = " |
| 438 | << GRAPHVIZ_EDGE_STYLE_PRIVATE << " ];\n" |
| 439 | " legendNode3 -> legendNode6 [ style = " |
| 440 | << GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n" |
| 441 | " legendNode0 -> legendNode7;\n" |
| 442 | "}\n"; |
| 443 | /* clang-format off */ |
| 444 | } |
| 445 | |
| 446 | void cmGraphVizWriter::WriteNode(cmGeneratedFileStream& fs, |
| 447 | cmLinkItem const& item) |