3@brief Output a node in the graph
5Queries the properties
for modules and generates the node
for it in the graph
6and its outgoing dependency
edges.
9 get_property(_vtk_graphviz_file GLOBAL
10 PROPERTY
"_vtk_module_${module}_file")
11 if (_vtk_graphviz_file)
12 get_property(_vtk_graphviz_module_third_party GLOBAL
13 PROPERTY
"_vtk_module_${module}_third_party")
14 get_property(_vtk_graphviz_module_exclude_wrap GLOBAL
15 PROPERTY
"_vtk_module_${module}_exclude_wrap")
16 get_property(_vtk_graphviz_module_depends GLOBAL
17 PROPERTY
"_vtk_module_${module}_depends")
18 get_property(_vtk_graphviz_module_private_depends GLOBAL
19 PROPERTY
"_vtk_module_${module}_private_depends")
20 get_property(_vtk_graphviz_module_optional_depends GLOBAL
21 PROPERTY
"_vtk_module_${module}_optional_depends")
22 get_property(_vtk_graphviz_module_implements GLOBAL
23 PROPERTY
"_vtk_module_${module}_implements")
24 get_property(_vtk_graphviz_module_implementable GLOBAL
25 PROPERTY
"_vtk_module_${module}_implementable")
27 get_property(_vtk_graphviz_module_third_party
29 PROPERTY
"INTERFACE_vtk_module_third_party")
30 get_property(_vtk_graphviz_module_exclude_wrap
32 PROPERTY
"INTERFACE_vtk_module_exclude_wrap")
33 get_property(_vtk_graphviz_module_depends
35 PROPERTY
"INTERFACE_vtk_module_depends")
36 set(_vtk_graphviz_module_private_depends)
37 set(_vtk_graphviz_module_optional_depends)
38 get_property(_vtk_graphviz_module_implements
40 PROPERTY
"INTERFACE_vtk_module_implements")
41 get_property(_vtk_graphviz_module_implementable
43 PROPERTY
"INTERFACE_vtk_module_implementable")
46 if (_vtk_graphviz_module_third_party)
47 set(_vtk_graphviz_shape "${_vtk_graphviz_third_party}
")
49 set(_vtk_graphviz_shape "${_vtk_graphviz_first_party}
")
52 if (_vtk_graphviz_file)
53 if (DEFINED "VTK_MODULE_USE_EXTERNAL_${module}
" AND VTK_MODULE_USE_EXTERNAL_${module})
54 set(_vtk_graphviz_fillcolor "${_vtk_graphviz_external}
")
56 set(_vtk_graphviz_fillcolor "${_vtk_graphviz_internal}
")
59 set(_vtk_graphviz_fillcolor "${_vtk_graphviz_external}
")
62 if (_vtk_graphviz_module_exclude_wrap)
63 set(_vtk_graphviz_penwidth "${_vtk_graphviz_exclude_wrap}
")
65 set(_vtk_graphviz_penwidth "${_vtk_graphviz_include_wrap}
")
68 if (_vtk_graphviz_module_implementable)
69 set(_vtk_graphviz_color "${_vtk_graphviz_implementable}
")
71 set(_vtk_graphviz_color "${_vtk_graphviz_not_implementable}
")
74 set(_vtk_graphviz_node_block "\
"${module}\" [
76 shape=${_vtk_graphviz_shape}
78 color=${_vtk_graphviz_color}
79 fillcolor=${_vtk_graphviz_fillcolor}
80 penwidth=${_vtk_graphviz_penwidth}
83 foreach (_vtk_graphviz_module_implement IN LISTS _vtk_graphviz_module_implements)
84 string(APPEND _vtk_graphviz_node_block
85 "\"${module}\" -> \"${_vtk_graphviz_module_implement}\" [style=${_vtk_graphviz_implements}, arrowhead=${_vtk_graphviz_required_depends}];\n")
88 foreach (_vtk_graphviz_module_depend IN LISTS _vtk_graphviz_module_depends)
89 string(APPEND _vtk_graphviz_node_block
90 "\"${module}\
" -> \"${_vtk_graphviz_module_depend}\" [style=${_vtk_graphviz_public_depends}, arrowhead=${_vtk_graphviz_required_depends}];\n")
93 if (_vtk_graphviz_PRIVATE_DEPENDENCIES)
94 foreach (_vtk_graphviz_module_private_depend IN LISTS _vtk_graphviz_module_private_depends)
95 string(APPEND _vtk_graphviz_node_block
96 "\"${module}\
" -> \"${_vtk_graphviz_module_private_depend}\" [style=${_vtk_graphviz_private_depends}, arrowhead=${_vtk_graphviz_required_depends}];\n")
99 foreach (_vtk_graphviz_module_optional_depend IN LISTS _vtk_graphviz_module_optional_depends)
100 string(APPEND _vtk_graphviz_node_block
101 "\"${module}\
" -> \"${_vtk_graphviz_module_optional_depend}\" [style=${_vtk_graphviz_optional_depends}, arrowhead=${_vtk_graphviz_optional_depends}];\n")
105 set("${var}
" "${_vtk_graphviz_node_block}
" PARENT_SCOPE)
109@ingroup module-support
110@brief Generate graphviz output for a module dependency graph
112Information about the modules built and/or available may be dumped to a
120 [PRIVATE_DEPENDENCIES <ON|OFF>]
121 [KIT_CLUSTERS <ON|OFF>])
124 * `MODULES`: (Required) The modules to output information for.
125 * `OUTPUT`: (Required) A Graphviz file describing the modules built will
126 be output to this path. Relative paths are rooted to `CMAKE_BINARY_DIR`.
127 * `PRIVATE_DEPENDENCIES`: (Default `ON`) Whether to draw private dependency
129 * `KIT_CLUSTERS`: (Default `OFF`) Whether to draw modules as part of a kit as
132function (vtk_module_graphviz)
133 cmake_parse_arguments(PARSE_ARGV 0 _vtk_graphviz
135 "PRIVATE_DEPENDENCIES;KIT_CLUSTERS;OUTPUT
"
138 if (_vtk_graphviz_UNPARSED_ARGUMENTS)
141 "${_vtk_graphviz_UNPARSED_ARGUMENTS}
")
144 if (NOT DEFINED _vtk_graphviz_OUTPUT)
146 "The `OUTPUT` argument is required.
")
149 if (NOT _vtk_graphviz_MODULES)
150 message(FATAL_ERROR "No modules given to output.
")
153 if (NOT DEFINED _vtk_graphviz_PRIVATE_DEPENDENCIES)
154 set(_vtk_graphviz_PRIVATE_DEPENDENCIES ON)
157 if (NOT DEFINED _vtk_graphviz_KIT_CLUSTERS)
158 set(_vtk_graphviz_KIT_CLUSTERS OFF)
161 if (NOT IS_ABSOLUTE "${_vtk_graphviz_OUTPUT}
")
162 string(PREPEND _vtk_graphviz_OUTPUT "${CMAKE_BINARY_DIR}/
")
165 set(_vtk_graphviz_kits)
166 set(_vtk_graphviz_no_kit_modules)
168 if (_vtk_graphviz_KIT_CLUSTERS)
169 # Get a list of all kits.
170 foreach (_vtk_graphviz_module IN LISTS _vtk_graphviz_MODULES)
171 get_property(_vtk_graphviz_kit GLOBAL
172 PROPERTY "_vtk_module_${_vtk_graphviz_module}_kit
")
173 if (_vtk_graphviz_kit)
174 list(APPEND _vtk_graphviz_kits
175 "${_vtk_graphviz_kit}
")
177 list(APPEND _vtk_graphviz_no_kit_modules
178 "${_vtk_graphviz_module}
")
181 if (_vtk_graphviz_kits)
182 list(REMOVE_DUPLICATES _vtk_graphviz_kits)
185 set(_vtk_graphviz_no_kit_modules "${_vtk_graphviz_MODULES}
")
189 set(_vtk_graphviz_first_party "rectangle
")
190 set(_vtk_graphviz_third_party "cds
")
191 set(_vtk_graphviz_internal "\
"/svg/white\"")
192 set(_vtk_graphviz_external
"\"/svg/cyan\"")
195 set(_vtk_graphviz_include_wrap
"5")
196 set(_vtk_graphviz_exclude_wrap
"1")
197 set(_vtk_graphviz_implementable
"\"/svg/darkorchid\"")
198 set(_vtk_graphviz_not_implementable
"\"/svg/coral\"")
201 set(_vtk_graphviz_public_depends
"solid")
202 set(_vtk_graphviz_private_depends
"dotted")
203 set(_vtk_graphviz_implements
"bold")
205 set(_vtk_graphviz_required_depends
"normal")
206 set(_vtk_graphviz_optional_depends
"empty")
208 set(_vtk_graphviz_contents
"strict digraph modules {\nclusterrank=local;\nrankdir=TB;\n")
210 # Output modules not part of a kit.
211 string(APPEND _vtk_graphviz_contents
212 "subgraph \"modules_without_kits\" {\n")
213 foreach (_vtk_graphviz_module IN LISTS _vtk_graphviz_no_kit_modules)
215 string(APPEND _vtk_graphviz_contents
216 "${_vtk_graphviz_node}\n")
218 string(APPEND _vtk_graphviz_contents
221 # Output kits as clusters.
222 foreach (_vtk_graphviz_kit IN LISTS _vtk_graphviz_kits)
223 string(APPEND _vtk_graphviz_contents
224 "subgraph \"cluster_${_vtk_graphviz_kit}\" {\nlabel=\"${_vtk_graphviz_kit}\"\n")
226 get_property(_vtk_graphviz_kit_modules GLOBAL
227 PROPERTY
"_vtk_kit_${_vtk_graphviz_kit}_kit_modules")
228 foreach (_vtk_graphviz_kit_module IN LISTS _vtk_graphviz_kit_modules)
229 if (NOT _vtk_graphviz_kit_module IN_LIST _vtk_graphviz_MODULES)
234 string(APPEND _vtk_graphviz_contents
235 "${_vtk_graphviz_node}\n
")
239 string(APPEND _vtk_graphviz_contents
243 # Write the key cluster.
244 string(APPEND _vtk_graphviz_contents "
245subgraph cluster_key {
247 subgraph cluster_party {
249 label=\
"First party\"
250 shape=${_vtk_graphviz_first_party}
252 color=${_vtk_graphviz_not_implementable}
253 fillcolor=${_vtk_graphviz_internal}
254 penwidth=${_vtk_graphviz_include_wrap}
257 label=\"Third party\"
258 shape=${_vtk_graphviz_third_party}
260 color=${_vtk_graphviz_not_implementable}
261 fillcolor=${_vtk_graphviz_internal}
262 penwidth=${_vtk_graphviz_include_wrap}
265 subgraph cluster_whence {
267 label=\"Internal module\"
268 shape=${_vtk_graphviz_first_party}
270 color=${_vtk_graphviz_not_implementable}
271 fillcolor=${_vtk_graphviz_internal}
272 penwidth=${_vtk_graphviz_include_wrap}
275 label=\"External module\"
276 shape=${_vtk_graphviz_first_party}
278 color=${_vtk_graphviz_not_implementable}
279 fillcolor=${_vtk_graphviz_external}
280 penwidth=${_vtk_graphviz_include_wrap}
283 subgraph cluster_wrapping {
286 shape=${_vtk_graphviz_first_party}
288 color=${_vtk_graphviz_not_implementable}
289 fillcolor=${_vtk_graphviz_internal}
290 penwidth=${_vtk_graphviz_include_wrap}
293 label=\"Not wrappable\"
294 shape=${_vtk_graphviz_first_party}
296 color=${_vtk_graphviz_not_implementable}
297 fillcolor=${_vtk_graphviz_internal}
298 penwidth=${_vtk_graphviz_exclude_wrap}
301 subgraph cluster_implementable {
303 label=\"Implementable\"
304 shape=${_vtk_graphviz_first_party}
306 color=${_vtk_graphviz_implementable}
307 fillcolor=${_vtk_graphviz_internal}
308 penwidth=${_vtk_graphviz_include_wrap}
311 label=\"Not implementable\"
312 shape=${_vtk_graphviz_first_party}
314 color=${_vtk_graphviz_not_implementable}
315 fillcolor=${_vtk_graphviz_internal}
316 penwidth=${_vtk_graphviz_include_wrap}
319 subgraph cluster_dependencies {
322 shape=${_vtk_graphviz_first_party}
324 color=${_vtk_graphviz_not_implementable}
325 fillcolor=${_vtk_graphviz_internal}
326 penwidth=${_vtk_graphviz_include_wrap}
329 label=\"Private Dependee\"
330 shape=${_vtk_graphviz_first_party}
332 color=${_vtk_graphviz_not_implementable}
333 fillcolor=${_vtk_graphviz_internal}
334 penwidth=${_vtk_graphviz_include_wrap}
337 label=\"Optional Dependee\"
338 shape=${_vtk_graphviz_first_party}
340 color=${_vtk_graphviz_not_implementable}
341 fillcolor=${_vtk_graphviz_internal}
342 penwidth=${_vtk_graphviz_include_wrap}
345 label=\"Public Dependee\"
346 shape=${_vtk_graphviz_first_party}
348 color=${_vtk_graphviz_not_implementable}
349 fillcolor=${_vtk_graphviz_internal}
350 penwidth=${_vtk_graphviz_include_wrap}
353 label=\"Implemented\"
354 shape=${_vtk_graphviz_first_party}
356 color=${_vtk_graphviz_implementable}
357 fillcolor=${_vtk_graphviz_internal}
358 penwidth=${_vtk_graphviz_include_wrap}
360 dependent -> private_dependee [style=${_vtk_graphviz_private_depends}, arrowhead=${_vtk_graphviz_required_depends}];
361 dependent -> optional_dependee [style=${_vtk_graphviz_private_depends}, arrowhead=${_vtk_graphviz_optional_depends}];
362 dependent -> public_dependee [style=${_vtk_graphviz_public_depends}, arrowhead=${_vtk_graphviz_required_depends}];
363 dependent -> implemented [style=${_vtk_graphviz_implements}, arrowhead=${_vtk_graphviz_required_depends}];
367 string(APPEND _vtk_graphviz_contents
"}\n")
370 # OUTPUT "${_vtk_graphviz_OUTPUT}"
371 # CONTENT "${_vtk_graphviz_contents}")
372 file(WRITE
"${_vtk_graphviz_OUTPUT}" "${_vtk_graphviz_contents}")
function _vtk_module_graphviz_module_node(var, module)
Output a node in the graph.
function vtk_module_graphviz()
Generate graphviz output for a module dependency graph.
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)