mirror of
https://github.com/bkryza/clang-uml.git
synced 2025-05-16 10:42:22 +08:00
2.2 KiB
2.2 KiB
Quick start
To add an initial class diagram to your project, follow these steps:
-
Enter your project's top level directory and run:
clang-uml --init
-
Edit the generated
.clang-uml
file and set the following:# Path to `compile_commands.json` directory compilation_database_dir: . # Path to diagram output directory output_directory: diagrams diagrams: # This is the name of the diagram some_class_diagram: type: class # Parse only translation units in `src` subdirectory glob: - src/*.cc # Render all names relative to `myproject` namespace using_namespace: myproject include: # Include only elements in `myproject` namespace namespaces: - myproject exclude: # Exclude elements in `myproject::detail` namespace namespaces: - myproject::detail
-
Run
clang-uml
in the project's top directory:clang-uml # or to see generation progress for each diagram clang-uml --progress
-
Generate SVG images from the PlantUML diagrams:
plantuml -tsvg diagrams/*.puml
or generate also MermaidJS diagram (requires mermaid-cli):
clang-uml --progress -n some_class_diagram -g mermaid mmdc -i diagrams/some_class_diagram.mmd -o diagrams/some_class_diagram.svg
Steps 3 and 4 can be combined into one step:
clang-uml -p -n some_class_diagram -g plantuml -r --plantuml-cmd="/usr/bin/plantuml -tsvg diagrams/{}.puml"
where
-r
enables diagram rendering and--plantuml-cmd
specifies command to execute on each generated diagram. -
Add another diagram:
clang-uml --add-sequence-diagram another_diagram
-
Now list the diagrams defined in the config file:
clang-uml -l The following diagrams are defined in the config file: - another_diagram [sequence] - some_class_diagram [class]
-
Generate only the new diagram in JSON format:
clang-uml -n another_diagram -g json