Here's a comprehensive guide detailing how you can use Doxygen to create full inheritance diagrams that cross-reference multiple projects. This is made possible by leveraging Doxygen's tag files.
Steps in Detail
- Generate Doxygen Tag Files for Each Project: Tag files are a kind of metadata that Doxygen uses to create links between different sets of documentation. First, you need to run Doxygen on each of your projects separately to create individual tag files:
For example, Open Doxyfile in your project directory and set the following parameters:
GENERATE_HTML = NO
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_MAN = NO
GENERATE_TAGFILE = myProj.tag
INPUT = /path_to_your_project_files/
This configuration will output a file named myProj.tag, which holds all the relation information about the classes and files for your current project. Repeat for all your projects.
- Cross Reference between Different Projects: Now that we have our tag files, we can make the specific project reference to other projects.
As an example, for project1, you'd set TAGFILES
parameter in Doxyfile like so:
GENERATE_HTML = YES
GENERATE_LATEX = NO
GENERATE_RTF = NO
GENERATE_MAN = NO
TAGFILES = /path_to_tag_files/project2.tag=/url_or_path_to_project2_documentation \
/path_to_tag_files/project3.tag=/url_or_path_to_project3_documentation
So, whenever you generate the documentation for project1, Doxygen will also use data from the tag files of project2 and project3.
- Visualizing Inheritance Diagrams: To get the full view of the inheritance diagrams, make sure you enable Graphviz's dot tool in your Doxyfile. This tool creates graph-based diagrams of the relationships between classes.
Make sure to set:
HAVE_DOT = YES
CLASS_DIAGRAMS = YES
CLASS_GRAPH = YES
These settings ensure that Doxygen generates the inheritance and collaboration diagrams for the classes.
Remember, in order for the cross-referencing to work properly, each project needs to be aware of all others. Hence, be sure to list the tag files of every project in the TAGFILES
option when generating the documentation for each individual project.
Let's have a look at your example:
Example project 1 code: Here we group the related classes (A, B, C) under the title "Project 1".
/** @defgroup project1 Project 1
* This is the first group
* @{
*/
class A {};
class B : public A {};
class C : public A {};
/** @} */ // end of project1
Example project 2 code: Similarly, we group the classes (D, E, F) under "Project 2".
/** @defgroup project2 Project 2
* This is the second group
* @{
*/
#include <proj1.h>
class D : public A {};
class E : public A {};
class F : public E {};
/** @} */ // end of project2
In these examples, the @defgroup
command is used to define a group while the @{ and @} commands are used to close off the classes associated with the group. When you decide to add more member classes to the group, the @ingroup
command will be handy.
I hope this helps you, and others who come across this, to generate complete inheritance diagrams across multiple projects using Doxygen!
dot
) to generate those graphs, if I understand you correctly. – CubitalHAVE_DOT=YES
the correct graph is shown. When not setting theHAVE_DOT=YES
theD
,E
andF
are missing. – Selfsealing