![]() build-eu-terminal-apps-Desktop_Qt_6_2_0_GCC_64bit-Debug/ -graphviz=eu-terminal-3.dot We generate the graph with the following commands. The above setting ignores all targets starting with test_. The option GRAPHVIZ_IGNORE_TARGETS is assigned a list of regular expressions of target names. In the final pruning step, we get rid of the test executables by adding another line to CMakeGraphVizOptions.cmake. Full dependency graph without external libraries Excluding Test Executables We generate the complete the full dependency graph this time, as it will easily fit into this post. The command results in 7 files starting with eu-terminal-2.dot – instead of the 59 files from the first run. Reading GraphViz options file: /public/Projects/eu-terminal-apps/CMakeGraphVizOptions.cmake Generate graphviz: /public/Projects/deps-eu-terminal-apps/eu-terminal-2.dot build-eu-terminal-apps-Desktop_Qt_6_2_0_GCC_64bit-Debug/ -graphviz=eu-terminal-2.dot When we run CMake with the GraphViz option, it reads the options file CMakeGraphVizOptions.cmake as shown in the output. We create the file CMakeGraphVizOptions.cmake in the directory CMAKE_SOURCE_DIR or CMAKE_BINARY_DIR with the following content. In general, test executables litter the depency graph and should be excluded (see section Excluding Test Executables) Excluding External LibrariesĮxternal libraries don’t add much to the understanding of an unfamiliar software project. Nevertheless, we discovered a little problem that we should fix. As a unit test, it should not depend on the library Machine, but use test doubles. The target test_main_model is a test executable written with QtTest. The module library QmlModuleBusinessLogicModels is a QML module and makes the C++ models from its backing library BusinessLogic available to QML. Here is the legend for the dependency graphs.Īs a composition root, the executable MainApp creates the BusinessLogic and the Machine object and links privately against the respective shared libraries. We can view the generated SVG images with the tool display. So, we generate the graph for the dependants and the dependers for the target Machine from and, respectively. The complete dependency graph is a too big to show here in the post. for each target of the project: the graph of the other targets that depend on directly or indirectly.for each target of the project: the graph on which other targets the depends directly or indirectly. eu-terminal-1.dot: the dependency graph of the complete project.Build files have been written to: /public/Projects/build-eu-terminal-apps-Desktop_Qt_6_2_0_GCC_64bit-Debug Generate graphviz: /public/Projects/deps-eu-terminal-apps/eu-terminal-1.dot build-eu-terminal-apps-Desktop_Qt_6_2_0_GCC_64bit-Debug/ -graphviz=eu-terminal-1.dot My CMake command and results look as follows: $ cmake -S. In QtCreator, we run the action Build > Run CMake, copy the CMake command to a Linux terminal, add the option -graphviz=eu-terminal-1.dot, and run the command. This post is based on commit 1f2a678 but you should be able to work along with older and newer versions. We clone the example project eu-terminal-apps into a directory of our choice and create a sibling directory for the generated dependency graphs. The documentation page CMakeGraphVizOptions describes how to generate and visualise dependency graphs. Although the project is pretty simple, the graph needs some pruning to reflect the relevant parts of the architecture. The project depends on several external libraries like Qt and OpenGL. ![]() The project comprises the executable MainApp, the test executables, the shared libraries BusinessLogicModels and Machine, and the QML module EmUse.Models. My running example is the walking skeleton of the harvester terminal, which I introduced in my talk Hexagonal Architecture: The Standard for Qt Embedded Applications at Meeting Embedded 2021. The graphs help us get an idea of the software architecture and identify the dependency hot spots. CMake uses Graphviz to generate dependency graphs between the targets of a CMake project like libraries and executables.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |