ΠΊΠ°ΠΊ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ doxygen Π½Π° linux
Compiling from source on UNIX
If you downloaded the source distribution, you need at least the following to build the executable:
To take full advantage of doxygen’s features the following additional tools should be installed.
Compilation is now done by performing the following steps:
Run cmake with the makefile generator
cmake tries to determine the platform you use, and will look for the requires tools. It will report if something is missing.
If you have Qt-4.3 or higher installed and want to build the GUI front-end, you should enable it as follows:
For an overview of other configuration options use
Compile the program by running make:
The program should compile without problems and the binaries ( doxygen and optionally doxywizard ) should be available in the bin directory within the build directory.
Optional: Generate the user manual.
To let doxygen generate the HTML and PDF documentation.
The HTML directory within the build directory will now contain the html documentation (just point a HTML browser to the file index.html in the html directory).
Optional: static linking
If you want to build a statically linked version of doxygen that embeds libclang you need to first build LLVM and clang from sources using the following options:
and then build doxygen with these options:
Installing the binaries on UNIX
After the compilation of the source code do a make install to install doxygen. If you downloaded the binary distribution for Linux, type:
Note You need the GNU install tool for this to work (it is part of the coreutils package). Other install tools may put the binaries in the wrong directory!
If you have a RPM or DEP package, then please follow the standard installation procedure that is required for these packages.
Compiling from source on Windows
From version 1.8.10 onwards, build files need to be generated by cmake. cmake can be downloaded from https://cmake.org/download/
At the moment only the express version of Visual Studio 2015 and 2017 are tested, but other version might also work.
Alternatively, you can compile doxygen the UNIX way using Cygwin or MinGW.
The next step is to install modern versions of bison and flex (see https://sourceforge.net/projects/winflexbison/. After installation and adding them to your path rename win_flex.exe to flex.exe and win_bison.exe to bison.exe ) Furthermore you have to install python (version 2.7 or higher, see https://www.python.org). These packages are needed during the compilation process.
Download doxygen’s source tarball and put it somewhere (e.g. use c:\tools )
Now start a visual studio native command shell (for either x86 or x64) and type
to unpack the sources (you can obtain tar from e.g. http://gnuwin32.sourceforge.net/packages.html). Alternatively you can use an unpack program, like 7-Zip (see https://www.7-zip.org/) or use the built-in unpack feature of modern Windows systems).
cd into the doxygen-x.y.z directory, create and cd to a build directory
This will create a project file then can be opened in Visual Studio.
If you prefer compiling from the command prompt you can use the following instead:
Note that compiling Doxywizard requires Qt 4.3 or newer (see https://www.qt.io/developers).
Also read the next section for additional tools you may need to install to run doxygen with certain features enabled.
Installing the binaries on Windows
Doxygen comes as a self-installing archive, so installation is extremely simple. Just follow the dialogs.
After installation it is recommended to also download and install GraphViz (version 2.38 or better is highly recommended). Doxygen can use the dot tool of the GraphViz package to render nicer diagrams, see the HAVE_DOT option in the configuration file.
If you want to produce compressed HTML files (see GENERATE_HTMLHELP) in the configuration file, then you need the Microsoft HTML help workshop. In the beginning of 2021 Microsoft took the original page, with a.o. the download links, offline the HTML help workshop was already many years in maintenance mode). You can download the HTML help workshop from the web archives at Installation executable.
If you want to produce Qt Compressed Help files (see QHG_LOCATION) in the configuration file, then you need qhelpgenerator which is part of Qt. You can download Qt from Qt Software Downloads.
In order to generate PDF output or use scientific formulas you will also need to install LaTeX and Ghostscript.
For a number of distributions exists. Popular ones that should work with doxygen are MikTex and proTeXt.
Ghostscript can be downloaded from Sourceforge.
After installing and Ghostscript you’ll need to make sure the tools latex.exe, pdflatex.exe, and gswin32c.exe (or gswin64c.exe) are present in the search path of a command box. Follow these instructions if you are unsure and run the commands from a command box to verify it works.
Go to the next section or return to the index.
ΠΠ°ΠΏΠΈΡΠΊΠΈ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠΈΡΡΠ°
ΠΠ΅Π½Π΅ΡΠΈΡΡΠ΅ΠΌ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ ΠΊ ΠΏΡΠΎΠ΅ΠΊΡΠ°ΠΌ Π½Π° C/C++ Ρ Doxygen
ΠΡΠΎΠ³ΡΠ°ΠΌΠΌΠΈΡΡΡ, ΠΊΠ°ΠΊ ΠΏΡΠ°Π²ΠΈΠ»ΠΎ, Π½Π΅ ΠΎΡΠ΅Π½Ρ Π»ΡΠ±ΡΡ ΠΏΠΈΡΠ°ΡΡ ΡΠ΅ΡΡΡ. ΠΠΎ ΠΊΡΠ΄Π° ΡΠΈΠ»ΡΠ½Π΅Π΅ ΠΎΠ½ΠΈ Π½Π΅ Π»ΡΠ±ΡΡ ΠΏΠΈΡΠ°ΡΡ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ. Π’Π΅ΡΡΡ Ρ ΠΎΡΡ Π±Ρ ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»ΡΡΡ ΡΠΎΠ±ΠΎΠΉ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΡ, Π° Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ β ΡΡΠΎ ΡΡΠΎ? ΠΡΠΎΡΡΠΎ ΡΠ΅ΠΊΡΡ. ΠΠΎΡ ΠΏΡΡΡΡ ΠΊΡΠΎ-Π½ΠΈΠ±ΡΠ΄Ρ Π΄ΡΡΠ³ΠΎΠΉ Π΅Π³ΠΎ ΠΈ ΠΏΠΈΡΠ΅Ρ, ΡΠ΅Ρ Π½ΠΈΡΠ΅ΡΠΊΠΈΠ΅ ΠΏΠΈΡΠ°ΡΠ΅Π»ΠΈ Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ! ΠΠΏΡΠΎΡΠ΅ΠΌ, Π΅ΡΠ»ΠΈ ΡΠ΅ΡΡ ΠΈΠ΄Π΅Ρ Π½Π΅ ΠΎ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»ΡΡΠΊΠΎΠΉ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ, Π° ΠΎΠ± ΠΎΠΏΠΈΡΠ°Π½ΠΈΠΈ ΠΊΠ»Π°ΡΡΠΎΠ² ΠΈ ΠΌΠ΅ΡΠΎΠ΄ΠΎΠ², ΠΏΡΠ΅Π΄Π½Π°Π·Π½Π°ΡΠ΅Π½Π½ΠΎΠΌ Π΄Π»Ρ Π΄ΡΡΠ³ΠΈΡ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠΈΡΡΠΎΠ², ΡΡΡ ΠΎΡΠΊΠΎΡΠΈΡΡ Π²ΡΡΠ΄ Π»ΠΈ ΡΠ΄Π°ΡΡΡΡ. Π ΡΡΠ°ΡΡΡΡ, Π΅ΡΡΡ Doxygen, ΡΠΏΠΎΡΠΎΠ±Π½ΡΠΉ ΡΡΡΠ΅ΡΡΠ²Π΅Π½Π½ΠΎ ΠΏΠΎΠΌΠΎΡΡ ΡΠΎ ΡΡΠΎΠ»Ρ Π½Π΅ΠΏΡΠΈΡΡΠ½ΠΎΠΉ Π΄Π»Ρ ΠΌΠ½ΠΎΠ³ΠΈΡ ΡΠ°Π±ΠΎΡΠΎΠΉ.
Fun fact! ΠΠ΅ΡΠΌΠΎΡΡΡ Π½Π° ΡΠΎ, ΡΡΠΎ Π² ΡΠ°ΠΌΠΊΠ°Ρ ΡΡΠΎΠ³ΠΎ ΠΏΠΎΡΡΠ° ΠΌΡ Π±ΡΠ΄Π΅ΠΌ Π³ΠΎΠ²ΠΎΡΠΈΡΡ ΠΎ Doxygen ΠΈΡΠΊΠ»ΡΡΠΈΡΠ΅Π»ΡΠ½ΠΎ Π² ΠΊΠΎΠ½ΡΠ΅ΠΊΡΡΠ΅ ΡΠ·ΡΠΊΠΎΠ² C ΠΈ C++, ΠΎΠ½ ΡΠ°ΠΊΠΆΠ΅ ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°Π΅Ρ ΡΠ·ΡΠΊΠΈ Java, Python, PHP, ΠΈ Π΄ΡΡΠ³ΠΈΠ΅.
Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Doxygen ΠΎΡΡΡΠ΅ΡΡΠ²Π»ΡΠ΅ΡΡΡ ΠΊΠ°ΠΊ-ΡΠΎ ΡΠ°ΠΊ:
# Π΅ΡΠ»ΠΈ Ρ Π²Π°Ρ Ubuntu:
sudo apt-get install doxygen
ΠΠ°Π»Π΅Π΅ ΠΏΠ΅ΡΠ΅Ρ ΠΎΠ΄ΠΈΠΌ Π² ΠΊΠ°ΡΠ°Π»ΠΎΠ³ Ρ Π½Π°ΡΠΈΠΌ ΠΏΡΠΎΠ΅ΠΊΡΠΎΠΌ ΠΈ ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΡΠ°Π±Π»ΠΎΠ½Π½ΡΠΉ ΡΠ°ΠΉΠ» Doxyfile ΠΊΠΎΠΌΠ°Π½Π΄ΠΎΠΉ:
Π Doxyfile ΡΠΎΠ΄Π΅ΡΠΆΠΈΡΡΡ ΠΊΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΏΡΠΎΠ΅ΠΊΡΠ°, Π΅Π³ΠΎ Π²Π΅ΡΡΠΈΡ ΠΈ ΠΏΠΎΠ΄ΠΎΠ±Π½ΡΠ΅ Π²Π΅ΡΠΈ. Π‘Π»Π΅Π΄ΡΡΡΠΈΠ΅ Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΡΡΠΎΠΈΡ ΡΡΠ°Π·Ρ ΠΈΠ·ΠΌΠ΅Π½ΠΈΡΡ.
ΠΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΏΡΠΎΠ΅ΠΊΡΠ°:
ΠΡΠ΄Π° ΠΏΠΈΡΠ°ΡΡ ΡΠ³Π΅Π½Π΅ΡΠ΅Π½Π½ΡΠ΅ Π΄ΠΎΠΊΠΈ:
ΠΡΠΊΠ»ΡΡΠ°Π΅ΠΌ LaTeX, ΡΠ°ΠΊ ΠΊΠ°ΠΊ HTML ΠΎΠ±ΡΡΠ½ΠΎ Π΄ΠΎΡΡΠ°ΡΠΎΡΠ½ΠΎ:
ΠΠ΄Π΅ ΠΈΡΠΊΠ°ΡΡ ΡΠ°ΠΉΠ»Ρ, ΠΈΠ· ΠΊΠΎΡΠΎΡΡΡ Π³Π΅Π½Π΅ΡΠΈΡΠΎΠ²Π°ΡΡ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ β ΡΠΏΠΈΡΠΎΠΊ ΡΠ°ΠΉΠ»ΠΎΠ² ΠΈ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΉ ΡΠ΅ΡΠ΅Π· ΠΏΡΠΎΠ±Π΅Π»:
ΠΠΊΠ»ΡΡΠ°Π΅ΠΌ ΡΠ΅ΠΊΡΡΡΠΈΠ²Π½ΡΠΉ ΠΎΠ±Ρ ΠΎΠ΄ Π΄ΠΈΡΠ΅ΠΊΡΠΎΡΠΈΠΉ:
ΠΡΠ΅Π³ΠΎ Π² ΡΠ°ΠΉΠ»Π΅ ΠΎΠΊΠΎΠ»ΠΎ 2500 ΡΡΡΠΎΠΊ Ρ ΠΏΠΎΠ΄ΡΠΎΠ±Π½ΡΠΌ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ΠΌ Π²ΡΠ΅Ρ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠΎΠ². ΠΠ΄Π½Π°ΠΊΠΎ ΠΏΠΎΠΌΠΈΠΌΠΎ ΠΏΡΠΈΠ²Π΅Π΄Π΅Π½Π½ΡΡ Π²ΡΡΠ΅ ΠΏΠ°ΡΠ°ΠΌΠ΅ΡΡΠΎΠ² Π²Π°ΠΌ Π²ΡΡΠ΄ Π»ΠΈ ΠΏΡΠΈΠ΄Π΅ΡΡΡ ΡΡΠΎ-ΡΠΎ ΠΌΠ΅Π½ΡΡΡ.
ΠΡΠ°Π²ΠΈΠ»Π° Ρ ΠΎΡΠΎΡΠ΅Π³ΠΎ ΡΠΎΠ½Π° Π³Π»Π°ΡΡΡ, ΡΡΠΎ Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΠΏΡΠΎΡΠ΅Π΄ΡΡΡ ΠΈΠ»ΠΈ ΠΌΠ΅ΡΠΎΠ΄Π° ΠΊΠ»Π°ΡΡΠ° (Π½Π΅Π·Π°Π²ΠΈΡΠΈΠΌΠΎ ΠΎΡ ΡΠΎΠ³ΠΎ, ΠΏΡΠ±Π»ΠΈΡΠ½ΡΠ΅ ΠΎΠ½ΠΈ ΠΈΠ»ΠΈ ΠΏΡΠΈΠ²Π°ΡΠ½ΡΠ΅) Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π±ΡΡΡ ΠΊΠ°ΠΊ ΠΌΠΈΠ½ΠΈΠΌΡΠΌ ΠΊΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΡΠΎΠ³ΠΎ, ΡΡΠΎ Π΄Π΅Π»Π°Π΅Ρ ΠΏΡΠΎΡΠ΅Π΄ΡΡΠ° ΠΈΠ»ΠΈ ΠΌΠ΅ΡΠΎΠ΄, ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ ΠΈΠ· Π°ΡΠ³ΡΠΌΠ΅Π½ΡΠΎΠ², Π° ΡΠ°ΠΊΠΆΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ Π²ΠΎΠ·Π²ΡΠ°ΡΠ°Π΅ΠΌΠΎΠ³ΠΎ Π·Π½Π°ΡΠ΅Π½ΠΈΡ. ΠΡΠ»ΠΈ ΠΌΠ΅ΡΠΎΠ΄ Π΄Π΅Π»Π°Π΅Ρ Π΅ΡΠ΅ ΡΡΠΎ-ΡΠΎ, Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, ΠΊΠ°ΠΊ-ΡΠΎ ΠΌΠ΅Π½ΡΠ΅Ρ ΡΠΎΡΡΠΎΡΠ½ΠΈΠ΅ ΠΊΠ»Π°ΡΡΠ°, ΡΡΠΎ ΡΠ°ΠΊΠΆΠ΅ ΠΎΠ±ΡΠ·Π°ΡΠ΅Π»ΡΠ½ΠΎ Π½ΡΠΆΠ½ΠΎ Π·Π°Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠΈΡΠΎΠ²Π°ΡΡ.
ΠΠ½Π°Π»ΠΎΠ³ΠΈΡΠ½ΠΎ, ΠΊΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΡΠΎΠ³ΠΎ, ΡΡΠΎ ΠΎΠ½ΠΈ ΠΈΠ· ΡΠ΅Π±Ρ ΠΏΡΠ΅Π΄ΡΡΠ°Π²Π»ΡΡΡ, Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π±ΡΡΡ Ρ ΡΠ°ΠΌΠΈΡ ΠΊΠ»Π°ΡΡΠΎΠ² ΠΈ ΡΡΡΡΠΊΡΡΡ. ΠΠ΅ Π»ΠΈΡΠ½ΠΈΠΌ Π±ΡΠ΄Π΅Ρ ΡΠ°ΡΡΠΊΠ°Π·Π°ΡΡ, ΡΠ²Π»ΡΠ΅ΡΡΡ Π»ΠΈ ΠΊΠ»Π°ΡΡ ΠΊΠΎΠΏΠΈΡΡΠ΅ΠΌΡΠΌ ΠΈΠ»ΠΈ thread-safe. ΠΡΠ°ΡΠΊΠΎΠ΅ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ Π΄ΠΎΠ»ΠΆΠ½ΠΎ Π±ΡΡΡ Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ Π°ΡΡΠΈΠ±ΡΡΠ° ΠΊΠ»Π°ΡΡΠ°.
Π Π΄Π΅ΠΉΡΡΠ²ΠΈΡΠ΅Π»ΡΠ½ΠΎΡΡΠΈ, Doxygen ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°Π΅Ρ ΠΊΡΠ΄Π° Π±ΠΎΠ»ΡΡΠ΅ ΠΊΠΎΠΌΠ°Π½Π΄. ΠΠ°ΠΏΡΠΈΠΌΠ΅Ρ, ΠΎΠ½ ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ ΠΏΠΈΡΠ°ΡΡ ΠΌΠ½ΠΎΠ³ΠΎΡΡΡΠ°Π½ΠΈΡΠ½ΡΡ ( @page ) Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ Ρ ΡΠ°Π·Π΄Π΅Π»Π°ΠΌΠΈ ( @section ) ΠΈ ΠΏΠΎΠ΄ΡΠ°Π·Π΄Π΅Π»Π°ΠΌΠΈ ( @subsection ), ΡΠΊΠ°Π·ΡΠ²Π°ΡΡ Π²Π΅ΡΡΠΈΠΈ ΠΌΠ΅ΡΠΎΠ΄ΠΎΠ² ΠΈ ΠΊΠ»Π°ΡΡΠΎΠ² ( @version ), ΠΈ Π½Π΅ ΡΠΎΠ»ΡΠΊΠΎ. ΠΠ·Π½Π°ΠΊΠΎΠΌΠΈΡΡΡΡ Ρ ΠΏΠΎΠ»Π½ΡΠΌ ΡΠΏΠΈΡΠΊΠΎΠΌ ΠΊΠΎΠΌΠ°Π½Π΄ ΠΌΠΎΠΆΠ½ΠΎ Π·Π΄Π΅ΡΡ.
Fun fact! Doxygen ΠΏΠΎΠ½ΠΈΠΌΠ°Π΅Ρ Markdown Π² ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΡΡ . ΠΡΠ°ΡΠΊΡΡ ΡΠΏΠ°ΡΠ³Π°Π»ΠΊΡ ΠΏΠΎ Markdown Π²Ρ Π½Π°ΠΉΠ΄Π΅ΡΠ΅ Π² Π·Π°ΠΌΠ΅ΡΠΊΠ΅ ΠΏΡΠΎ ΡΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΡΡΠ°ΡΠΈΡΠ΅ΡΠΊΠΎΠ³ΠΎ Π±Π»ΠΎΠ³Π° Π½Π° Pelican.
ΠΠ»Ρ Π³Π΅Π½Π΅ΡΠ°ΡΠΈΠΈ ΠΈ ΠΏΡΠΎΡΠΌΠΎΡΡΠ° Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ ΠΏΡΠΎΡΡΠΎ Π³ΠΎΠ²ΠΎΡΠΈΠΌ:
ΠΡΠ»ΠΈ Π²Π°Ρ ΠΈΠ½ΡΠ΅ΡΠ΅ΡΡΡΡ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΡΠ΅ ΠΏΡΠΈΠΌΠ΅ΡΡ, ΡΠ΅ΠΊΠΎΠΌΠ΅Π½Π΄ΡΡ ΠΏΠΎΡΠΌΠΎΡΡΠ΅ΡΡ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ ΠΏΠΎ libevent, wxWidgets ΠΈΠ»ΠΈ Assimp. ΠΡΠ±ΠΎΠΉ ΠΏΡΠΎΠ΅ΠΊΡ ΠΊΡΠ΄Π° ΠΏΡΠΎΡΠ΅ ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΈΠ²Π°ΡΡ, Π΅ΡΠ»ΠΈ Ρ Π½Π΅Π³ΠΎ Π΅ΡΡΡ ΡΠ°ΠΊΠ°Ρ ΠΆΠ΅ ΠΊΠ»Π°ΡΡΠ½Π°Ρ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ!
Π ΠΈΡΠΏΠΎΠ»ΡΠ·ΡΠ΅ΡΠ΅ Π»ΠΈ Π²Ρ Doxygen, ΠΈ ΡΡΠΎ Π² ΡΠ΅Π»ΠΎΠΌ ΠΎ Π½Π΅ΠΌ Π΄ΡΠΌΠ°Π΅ΡΠ΅?
ΠΠΎΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅: ΠΠ°Ρ ΡΠ°ΠΊΠΆΠ΅ ΠΌΠΎΠΆΠ΅Ρ Π·Π°ΠΈΠ½ΡΠ΅ΡΠ΅ΡΠΎΠ²Π°ΡΡ ΠΏΠΎΡΡ ΠΠΎΡΡΡΠΎΠ΅Π½ΠΈΠ΅ UML-Π΄ΠΈΠ°Π³ΡΠ°ΠΌΠΌ Ρ ΠΏΠΎΠΌΠΎΡΡΡ PlantUML. Π Doxygen ΠΈΠΌΠ΅Π΅ΡΡΡ ΠΏΠΎΠ΄Π΄Π΅ΡΠΆΠΊΠ° PlantUML.
How to generate documentation from source code in Linux
Last updated on September 9, 2020 by Dan Nanni
If you are an open-source developer and want to release your project to the public, you may consider publishing source-code documentation for the project. In cases where you are trying to read source code written by others, it will also be helpful if you can get a bird-eye view of the otherwise cryptic source code.
In Linux, doxygen is the de facto standard tool for automatically generating cross-reference documentation from annotated source code. It supports major programming languages including C/C++, Objective-C, C#, PHP, Java and Python. There are more than 350 open-source projects (e.g., Drupal, Gaim, GNU C++ library, KDE) that rely on doxygen for automatic documentation of their source code.
Install Doxygen on Linux
For Ubuntu, Debian or Linux Mint:
To install doxygen on Ubuntu, Linux Mint or Debian:
For CentOS, Fedora or RHEL:
To install doxygen on CentOS, Fedora or RHEL:
Generate Documentation from Source code with doxygen
To generate documentation of source code, proceed as follows.
First, generate a project-specific doxygen configuration file:
The above command will generate a template configuration file for a particular project, which you can further customize as described below.
Among others, you can edit the following options in the configuration file.
Now go ahead and run doxygen with the configuration file.
To browse the HTML-formatted documentation, you can use any web browser to open the HTML index file.
doxygen Documentation Screenshots
This shows a list of header files that are automatically categorized by topics.
This shows a list of classes, structs, unions and interfaces with descriptions.
This shows a source code browser listing all source files recursively in sub-directories.
If you click on a particular source file, you will see a page which shows dependency graph for the file, as well as documentation for all defined functions.
This shows a detailed view of function/macro definitions. Below the figure is shown the actual source code snippet that corresponds to this documented portion.
Support Xmodulo
This website is made possible by minimal ads and your gracious donation via PayPal (Credit Card) or Bitcoin ( 1M161JGAkz3oaHNvTiPFjNYkeABox8rb4g ).
Step 0: Check if doxygen supports your programming language
First, assure that your programming language has a reasonable chance of being recognized by doxygen. These languages are supported by default: C, C++, Lex, C#, Objective-C, IDL, Java, VHDL, PHP, Python, Fortran and D. It is possible to configure certain file type extensions to use certain parsers: see the Configuration/ExtensionMappings for details. Also, completely different languages can be supported by using preprocessor programs: see the Helpers page for details.
Step 1: Creating a configuration file
Doxygen uses a configuration file to determine all of its settings. Each project should get its own configuration file. A project can consist of a single source file, but can also be an entire source tree that is recursively scanned.
The configuration file has a format that is similar to that of a (simple) Makefile. It consists of a number of assignments (tags) of the form:
You can probably leave the values of most tags in a generated template configuration file to their default value. See section Configuration for more details about the configuration file.
If you do not wish to edit the configuration file with a text editor, you should have a look at doxywizard, which is a GUI front-end that can create, read and write doxygen configuration files, and allows setting configuration options by entering them via dialogs.
For a small project consisting of a few C and/or C++ source and header files, you can leave INPUT tag empty and doxygen will search for sources in the current directory.
Doxygen looks at the file’s extension to determine how to parse a file, using the following table:
Extension | Language | Extension | Language | Extension | Language |
---|---|---|---|---|---|
.dox | C / C++ | .hpp | C / C++ | .py | Python |
.doc | C / C++ | .h++ | C / C++ | .pyw | Python |
.c | C / C++ | .mm | C / C++ | .f | Fortran |
.cc | C / C++ | .txt | C / C++ | .for | Fortran |
.cxx | C / C++ | .idl | IDL | .f90 | Fortran |
.cpp | C / C++ | .ddl | IDL | .f95 | Fortran |
.c++ | C / C++ | .odl | IDL | .f03 | Fortran |
.ii | C / C++ | .java | Java | .f08 | Fortran |
.ixx | C / C++ | .cs | C# | .f18 | Fortran |
.ipp | C / C++ | .d | D | .vhd | VHDL |
.i++ | C / C++ | .php | PHP | .vhdl | VHDL |
.inl | C / C++ | .php4 | PHP | .ucf | VHDL |
.h | C / C++ | .php5 | PHP | .qsf | VHDL |
.H | C / C++ | .inc | PHP | .l | Lex |
.hh | C / C++ | .phtml | PHP | .md | Markdown |
.HH | C / C++ | .m | Objective-C | .markdown | Markdown |
.hxx | C / C++ | .M | Objective-C | .ice | Slice |
Please note that the above list might contain more items than that by default set in the FILE_PATTERNS.
Any extension that is not parsed can be set by adding it to FILE_PATTERNS and when the appropriate EXTENSION_MAPPING is set.
Step 2: Running doxygen
To generate the documentation you can now enter:
HTML output
The generated HTML documentation can be viewed by pointing a HTML browser to the index.html file in the html directory. For the best results a browser that supports cascading style sheets (CSS) should be used (I’m using Mozilla Firefox, Google Chrome, Safari, and sometimes IE8, IE9, and Opera to test the generated output).
Some of the features the HTML section (such as GENERATE_TREEVIEW or the search engine) require a browser that supports Dynamic HTML and JavaScript enabled.
LaTeX output
The generated documentation must first be compiled by a
compiler (I use a recent teTeX distribution for Linux and MacOSX and MikTex for Windows). To simplify the process of compiling the generated documentation, doxygen writes a Makefile into the latex directory (on the Windows platform also a make.bat batch file is generated).
The contents and targets in the Makefile depend on the setting of USE_PDFLATEX. If it is disabled (set to NO ), then typing make in the latex directory a dvi file called refman.dvi will be generated. This file can then be viewed using xdvi or converted into a PostScript file refman.ps by typing make ps (this requires dvips ).
To put 2 pages on one physical page use make ps_2on1 instead. The resulting PostScript file can be send to a PostScript printer. If you do not have a PostScript printer, you can try to use ghostscript to convert PostScript into something your printer understands.
Conversion to PDF is also possible if you have installed the ghostscript interpreter; just type make pdf (or make pdf_2on1 ).
RTF output
XML output
A file called combine.xslt XSLT script is also generated and can be used to combine all XML files into a single file.
Doxygen also generates two XML schema files index.xsd (for the index file) and compound.xsd (for the compound files). This schema file describes the possible elements, their attributes and how they are structured, i.e. it the describes the grammar of the XML files and can be used for validation or to steer XSLT scripts.
In the addon/doxmlparser directory you can find a parser library for reading the XML output produced by doxygen in an incremental way (see addon/doxmlparser/doxmparser/index.py and addon/doxmlparser/doxmlparser/compound.py for the interface of the library)
Man page output
The generated man pages can be viewed using the man program. You do need to make sure the man directory is in the man path (see the MANPATH environment variable). Note that there are some limitations to the capabilities of the man page format, so some information (like class diagrams, cross references and formulas) will be lost.
DocBook output
Doxygen can also generate output in the DocBook format. How to process the DocBook output is beyond the scope of this manual.
Step 3: Documenting the sources
Although documenting the sources is presented as step 3, in a new project this should of course be step 1. Here I assume you already have some code and you want doxygen to generate a nice document describing the API and maybe the internals and some related design documentation as well.
If the EXTRACT_ALL option is set to NO in the configuration file (the default), then doxygen will only generate documentation for documented entities. So how do you document these? For members, classes and namespaces there are basically two options:
Place a special documentation block in front of the declaration or definition of the member, class or namespace. For file, class and namespace members it is also allowed to place the documentation directly after the member.
See section Special comment blocks to learn more about special documentation blocks.
Place a special documentation block somewhere else (another file or another location) and put a structural command in the documentation block. A structural command links a documentation block to a certain entity that can be documented (e.g. a member, class, namespace or file).
See section Documentation at other places to learn more about structural commands.
The advantage of the first option is that you do not have to repeat the name of the entity.
Files can only be documented using the second option, since there is no way to put a documentation block before a file. Of course, file members (functions, variables, typedefs, defines) do not need an explicit structural command; just putting a special documentation block in front or behind them will work fine.
The text inside a special documentation block is parsed before it is written to the HTML and/or output files.
During parsing the following steps take place:
Go to the next section or return to the index.
ΠΠ°ΠΊ ΡΡΡΠ°Π½ΠΎΠ²ΠΈΡΡ doxygen Π½Π° linux
ΠΡΠ°ΠΊ, ΠΏΡΠΎΡΠ΅ΡΡ ΠΏΠΎ ΡΠ°Π³Π°ΠΌ:
1. ΠΠ°ΡΠ°Π΅ΠΌ ΠΏΠΎ ΡΡΡΠ»ΠΊΠ΅ [1], Π΄ΠΎΡΡΡΠΏΠ½Ρ Π²Π΅ΡΡΠΈΠΈ Π΄Π»Ρ Linux i386, Mac OS X 10.6 (Snow Leopard), Mac OS X 10.4 (Tiger), Windows XP/Vista/7, Π° ΡΠ°ΠΊΠΆΠ΅ ΠΈΡΡ ΠΎΠ΄Π½ΠΈΠΊΠΈ (Doxygen ΡΠ°ΡΠΏΡΠΎΡΡΡΠ°Π½ΡΠ΅ΡΡΡ ΠΏΠΎΠ΄ Π»ΠΈΡΠ΅Π½Π·ΠΈΠ΅ΠΉ GPL).
2. ΠΠ°ΠΏΡΡΠΊΠ°Π΅ΠΌ doxygen-1.7.2-setup.exe. ΠΡΠ²Π΅ΡΠ°Π΅ΠΌ Π½Π° Π½Π΅ΡΠ»ΠΎΠΆΠ½ΡΠ΅ ΡΡΠ°Π΄ΠΈΡΠΈΠΎΠ½Π½ΡΠ΅ Π²ΠΎΠΏΡΠΎΡΡ ΠΈΠ½ΡΡΠ°Π»Π»ΡΡΠΎΡΠ° (ΠΌΠΎΠΆΠ½ΠΎ ΡΡΠΏΠΎ ΠΆΠ°ΡΡ Next). ΠΠΎΡΠ»Π΅ ΠΈΠ½ΡΡΠ°Π»Π»ΡΡΠΈΠΈ ΠΏΠΎΡΠ²ΠΈΡΡΡ ΠΏΠ°ΠΏΠΊΠ° c:\Program Files\doxygen\, Π³Π΄Π΅ ΠΈ Π½Π°Ρ ΠΎΠ΄ΠΈΡΡΡ Π²ΡΡ ΡΠΈΡΡΠ΅ΠΌΠ° Doxygen, Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ ΠΏΠΎ Π½Π΅ΠΉ, ΠΈ ΡΡΠΈΠ»ΠΈΡΡ.
3. ΠΠ°ΠΏΡΡΠΊΠ°Π΅ΠΌ c:\Program Files\doxygen\bin\doxywizard.exe. ΠΡΠΎ ΠΏΡΠΎΠ³ΡΠ°ΠΌΠΌΠ°, ΠΊΠΎΡΠΎΡΠ°Ρ ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ ΡΠΏΡΠΎΡΡΠΈΡΡ ΡΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΈ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°Π½ΠΈΠ΅ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΠΎΠ½Π½ΠΎΠ³ΠΎ ΡΠ°ΠΉΠ»Π° Π΄Π»Ρ ΡΠΎΠ·Π΄Π°Π½ΠΈΡ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ (Doxygen GUI frontend).
5. Π’Π΅ΠΏΠ΅ΡΡ ΠΎΡΡΠ°Π»ΠΎΡΡ ΠΏΠ΅ΡΠ΅ΠΉΡΠΈ Π½Π° Π·Π°ΠΊΠ»Π°Π΄ΠΊΡ Run ΠΈ Π½Π°ΠΆΠ°ΡΡ Π½Π° ΠΊΠ½ΠΎΠΏΠΊΡ Run doxygen:
ΠΡΠ»ΠΈ Π²ΠΎ Π²ΡΠ΅ΠΌΡ ΠΊΠΎΠΌΠΏΠΈΠ»ΡΡΠΈΠΈ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ Π² ΡΠ΅ΠΊΡΡΠ°Ρ ΠΈΡΡ ΠΎΠ΄Π½ΠΈΠΊΠΎΠ² Π²ΡΡΡΠ΅ΡΡΡΡΡ ΠΎΡΠΈΠ±ΠΊΠΈ, ΡΠΎ ΠΎΠ½ΠΈ Π±ΡΠ΄ΡΡ Π²ΡΠ²Π΅Π΄Π΅Π½Ρ Π² ΠΏΠΎΠ»Π΅ Π²ΡΠ²ΠΎΠ΄Π° «Output produced by doxygen». Π ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡΡ ΡΠΊΠ°Π·Π°Π½Ρ Π½ΠΎΠΌΠ΅ΡΠ° ΡΡΡΠΎΠΊ, Π³Π΄Π΅ Π½Π°ΠΉΠ΄Π΅Π½Ρ ΠΎΡΠΈΠ±ΠΊΠΈ. ΠΡΠΌΠ΅ΡΠ°ΡΠΈΡ ΡΡΡΠΎΠΊ Π² ΡΠΎΠΎΠ±ΡΠ΅Π½ΠΈΡΡ «tag without matching» ΠΌΠΎΠΆΠ΅Ρ Π½Π΅ ΡΠΎΠ²ΠΏΠ°Π΄Π°ΡΡ ΡΠΎ ΡΡΡΠΎΠΊΠ°ΠΌΠΈ, Π³Π΄Π΅ ΡΡΠΈ ΠΎΡΠΈΠ±ΠΊΠΈ ΠΈΠΌΠ΅ΡΡΡΡ Π½Π° ΡΠ°ΠΌΠΎΠΌ Π΄Π΅Π»Π΅.
ΠΠ°ΠΏΡΡΠΊ Π³Π΅Π½Π΅ΡΠ°ΡΠΈΠΈ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ ΠΌΠΎΠΆΠ½ΠΎ ΡΠ°ΠΊΠΆΠ΅ ΠΏΡΠΎΠ²Π΅ΡΡΠΈ ΠΈΠ· ΠΊΠΎΠΌΠ°Π½Π΄Π½ΠΎΠΉ ΡΡΡΠΎΠΊΠΈ Π²Π²ΠΎΠ΄ΠΎΠΌ ΠΊΠΎΠΌΠ°Π½Π΄Ρ (config-file ΠΈΠΌΡ ΡΠ°ΠΉΠ»Π° ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΠΈ doxygen):
Π ΠΌΠΎΠ΅ΠΌ ΠΏΡΠΈΠΌΠ΅ΡΠ΅ Π² ΠΏΠ°ΠΏΠΊΠ΅ VirtualSerial\Documentation\html\ ΠΏΠΎΡΠ²ΡΡΡΡ ΡΠ°ΠΉΠ»Ρ Π² ΡΠΎΡΠΌΠ°ΡΠ΅ html. ΠΠ°ΡΠΈΠ½Π°ΡΡ ΠΏΡΠΎΡΠΌΠΎΡΡ Π΄ΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ Π½ΡΠΆΠ½ΠΎ Ρ ΡΠ°ΠΉΠ»Π° VirtualSerial\Documentation\html\index.html.
ΠΡΠ»ΠΈ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΠΎΠ½Π½ΠΎΠ³ΠΎ ΡΠ°ΠΉΠ»Π° Π½Π΅Ρ, ΡΠΎ ΠΌΠΎΠΆΠ½ΠΎ Π²ΡΡΡΠ½ΡΡ ΡΠ³Π΅Π½Π΅ΡΠΈΡΡ ΠΊΠΎΠ½ΡΠΈΠ³ΡΡΠ°ΡΠΈΡ. ΠΡΠΆΠ½ΠΎ Π²ΡΠΏΠΎΠ»Π½ΠΈΡΡ, ΠΊΠ°ΠΊ ΠΌΠΈΠ½ΠΈΠΌΡΠΌ, ΡΠ»Π΅Π΄ΡΡΡΠΈΠ΅ ΡΠ°Π³ΠΈ (Π΄Π»Ρ ΠΏΡΠΈΠΌΠ΅ΡΠ° VirtualSerial):
ΠΠ°ΠΊΠ»Π°Π΄ΠΊΠ° Run:
— Π½Π°ΠΆΠΈΠΌΠ°Π΅ΠΌ ΠΊΠ½ΠΎΠΏΠΊΡ Run Doxugen. Π ΡΠ΅Π·ΡΠ»ΡΡΠ°ΡΠ΅ ΠΏΠΎΠ»ΡΡΠΈΠΌ ΡΠ°ΠΉΠ» Π΅Π΄ΠΈΠ½ΡΡΠ²Π΅Π½Π½ΡΠΉ ΡΠ°ΠΉΠ» VirtualSerial\Documentation\rtf\refman.rtf.
[ΠΡΠΎΠ±Π»Π΅ΠΌΠ° ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΠΎΠΉ ΠΎΠ±ΡΠ°Π±ΠΎΡΠΊΠΈ ΠΊΠΎΠ΄ΠΈΡΠΎΠ²ΠΊΠΈ ΡΡΡΡΠΊΠΎΠ³ΠΎ ΡΠ·ΡΠΊΠ°]
# ΡΠ°Π½ΡΡΠ΅ ΡΡΡ Π±ΡΠ»ΠΎ ΡΠΊΠ°Π·Π°Π½ΠΎ INPUT_ENCODING = UTF-8
INPUT_ENCODING = windows-1251
ΠΡΠΎΠΌΠ΅ ΡΠΎΠ³ΠΎ, Π΅ΡΠ»ΠΈ Π½ΡΠΆΠ½ΠΎ ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΠΎ ΡΠ°ΡΠΏΠΎΠ·Π½Π°ΡΡ ΡΡΡΡΠΊΠΈΠΉ ΡΠ΅ΠΊΡΡ, ΠΊΠΎΡΠΎΡΡΠΉ Π΅ΡΡΡ Π² ΡΠ°ΠΉΠ»Π΅ Doxygen.conf (Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, ΡΡΠΎ ΠΌΠΎΠΆΠ΅Ρ Π±ΡΡΡ ΡΠ΅ΠΊΡΡ ΠΈΠΌΠ΅Π½ΠΈ ΠΏΡΠΎΠ΅ΠΊΡΠ° PROJECT_NAME ΠΈ Π΄ΡΡΠ³ΠΈΠ΅ ΡΡΡΠΎΠΊΠΈ), ΡΠΎ Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌΠΎ ΠΎΡΡΠ΅Π΄Π°ΠΊΡΠΈΡΠΎΠ²Π°ΡΡ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ ΠΊΠΎΠ½ΡΠΈΠ³Π° DOXYFILE_ENCODING (ΡΠΊΠ°Π·Π°ΡΡ ΠΊΠΎΠ΄ΠΈΡΠΎΠ²ΠΊΡ windows-1251):
# ΡΠ°Π½ΡΡΠ΅ ΡΡΡ Π±ΡΠ»ΠΎ ΡΠΊΠ°Π·Π°Π½ΠΎ DOXYFILE_ENCODING = UTF-8
DOXYFILE_ENCODING = windows-1251
ΠΠΎΡ ΡΠ°ΠΊ ΠΌΠΎΠΆΠ½ΠΎ ΠΈΡΠΏΡΠ°Π²ΠΈΡΡ ΠΊΠΎΠ΄ΠΈΡΠΎΠ²ΠΊΡ ΡΠ΅ΡΠ΅Π· ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡ GUI:
ΠΠΎΡΠ»Π΅ ΡΠ°ΠΊΠΎΠ³ΠΎ ΠΈΡΠΏΡΠ°Π²Π»Π΅Π½ΠΈΡ html Π±ΡΠ΄Π΅Ρ ΠΊΠΎΡΡΠ΅ΠΊΡΠ½ΠΎ Π³Π΅Π½Π΅ΡΠΈΡΠΎΠ²Π°ΡΡΡΡ, ΠΈ ΠΏΡΠ°Π²ΠΈΠ»ΡΠ½ΠΎ ΠΎΡΠΎΠ±ΡΠ°ΠΆΠ°ΡΡΡΡ Π²ΡΠ΅ΠΌΠΈ Π±ΡΠ°ΡΠ·Π΅ΡΠ°ΠΌΠΈ, ΡΡΡΡΠΊΠΈΠΉ ΡΠ΅ΠΊΡΡ Π±ΡΠ΄Π΅Ρ Π±Π΅Π· ΠΊΡΠ°ΠΊΠΎΠ·ΡΠ±Ρ.
[ΠΠΊΡΠ°Π½ΠΈΡΠΎΠ²Π°Π½ΠΈΠ΅ ΡΠΏΠ΅ΡΠΈΠ°Π»ΡΠ½ΡΡ ΡΠΈΠΌΠ²ΠΎΠ»ΠΎΠ² doxygen]
ΠΠ»Ρ ΡΡΡΡΠ°Π½Π΅Π½ΠΈΡ ΠΏΡΠ΅Π΄ΡΠΏΡΠ΅ΠΆΠ΄Π΅Π½ΠΈΠΉ ΡΠΈΠΏΠ° «ΠΈΠΌΡ_ΡΠ°ΠΉΠ»Π°:Π½ΠΎΠΌΠ΅Ρ_ΡΡΡΠΎΠΊΠΈ: warning: explicit link request to ‘define’ could not be resolved» Π½ΡΠΆΠ½ΠΎ ΠΏΡΠΈΠΌΠ΅Π½ΡΡΡ Π΄Π»Ρ ΡΠΊΡΠ°Π½ΠΈΡΠΎΠ²Π°Π½ΠΈΡ ΡΠΏΠ΅ΡΡΠΈΠΌΠ²ΠΎΠ»ΠΎΠ² ΠΎΠ±ΡΠ°ΡΠ½ΡΠΉ ΡΠ»Π΅Ρ ‘\’ (backslash). ΠΠ°ΠΏΡΠΈΠΌΠ΅Ρ, ΡΠ°ΠΊ Π½ΡΠΆΠ½ΠΎ ΡΠΊΡΠ°Π½ΠΈΡΠΎΠ²Π°ΡΡ ΡΠΈΠΌΠ²ΠΎΠ» # Π²ΠΌΠ΅ΡΡΠ΅ Ρ ΠΊΠ»ΡΡΠ΅Π²ΡΠΌ ΡΠ»ΠΎΠ²ΠΎΠΌ define:
ΡΡΡ ΡΠ΅ΠΊΡΡ \#define ΡΡΡ Π΄Π°Π»ΡΡΠ΅ ΡΠ΅ΠΊΡΡ
ΠΡΠΎ ΡΡΡΡΠ°Π½ΠΈΡ ΠΏΡΠ΅Π΄ΡΠΏΡΠ΅ΠΆΠ΄Π΅Π½ΠΈΡ ΡΠΈΠΏΠ° request to ‘. ‘ could not be resolved.