Doxygen Integration#
2025-05-07
3 min read time
What#
doxysphinx is a package that handles integration
of Doxygen and Sphinx documentation.
doxysphinx allows displaying Doxygen documentation in the Sphinx documentation.
rocm-docs-core applies some additional formatting and styling on top of this
to stay in line with our themes.
Since doxysphinx automatically integrates the Doxygen documentation,
developers only have to update the documentation strings in the source code
if they are formatted for Doxygen.
For more information on doxysphinx, see the GitHub repository
or the doxysphinx documentation.
How#
Some examples of how to use doxysphinx with rocm-docs-core are included below.
Assuming Doxygen documentation is already configured correctly,
several changes must be made to the configuration file (conf.py)
located in the docs folder
and the requirements files (requirements.in and requirements.txt)
located in the sphinx folder.
For the configuration file:
Include the
rocm_docs.doxygenextension in theextensionslist.Include the path to the Doxygen configuration in
doxygen_root. For ROCm projects, this value is usuallydoxygen.Set
doxysphinx_enabledto True.Define a
doxygen_projectdictionary and set anameandpath. For ROCm projects, the value of path is usuallydoxygen/xml.
For the requirements files:
Specify the
api_referencein therequirements.in(example:rocm-docs-core[api_reference]==0.36.0)Use
pip-toolsto compile therequirements.inpip install pip-toolspip-compile requirements.in --resolver=backtracking
Then add the Doxygen output to the table of contents (_toc.yml.in).
Optionally, specify custom style sheets to use in the Doxygen configuration (Doxyfile).
These style sheets are a part of rocm-docs-core.
HTML_HEADERHTML_FOOTERHTML_STYLESHEETHTML_EXTRA_STYLESHEET
When building the documentation with the API reference enabled, the console output will also make configuration recommendations to make documentation builds succeed. If documentation builds are still failing, please follow the recommendations.
This project has Demo Doxygen Docs here. See the source code for details.
The tests folder in the rocm-docs-core project on GitHub
also has example configuration files.
See this PR for a simple example of adding a Doxygen code snippet.