Cyberithub

How to Install Doxygen on Ubuntu 20.04 LTS (Focal Fossa)

Advertisements

In this article, I will take you through the steps to install Doxygen on Ubuntu 20.04 LTS (Focal Fossa). Doxygen is a free and open source documentation generator and static analysis tools for software sources trees. Doxygen not only supports annotated C++ sources but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, and to some extent D. It also supports the hardware description language VHDL. Doxygen is developed for Mac OS and Linux but is known to be highly portable. More on official website. Here we will see the steps to install Doxygen on Ubuntu 20.04 LTS.

How to Install Doxygen on Ubuntu 20.04 LTS (Focal Fossa)

How to Install Doxygen on Ubuntu 20.04 LTS (Focal Fossa)

Also Read: How to Install Grunt on Ubuntu 20.04 LTS Using 5 Easy Steps

Step 1: Prerequisites

a) You should have a running Ubuntu 20.04 LTS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt utility available in your System.

 

Step 2: Update Your Server

First you need to update the Server by using sudo apt update command as shown below.

cyberithub@ubuntu:~$ sudo apt update
Hit:1 http://in.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease
Get:3 https://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Hit:4 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:6 https://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,081 B]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40.7 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [66.6 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,468 B]
Fetched 226 kB in 2s (146 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

If any of the packages needs to be upgraded then run sudo apt upgrade command as well as shown below.

cyberithub@ubuntu:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 linux-headers-5.8.0-41-generic linux-hwe-5.8-headers-5.8.0-41 linux-image-5.8.0-41-generic linux-modules-5.8.0-41-generic
linux-modules-extra-5.8.0-41-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be upgraded:
google-chrome-stable
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 89.6 MB of archives.
After this operation, 12.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
................................

 

Step 3: Install Doxygen

Next step is to install Doxygen by using sudo apt install doxygen command as shown below. This command will download and install the package along with all its dependencies from default Ubuntu repo.

cyberithub@ubuntu:~$ sudo apt install doxygen
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 linux-headers-5.8.0-41-generic linux-hwe-5.8-headers-5.8.0-41 linux-image-5.8.0-41-generic linux-modules-5.8.0-41-generic
linux-modules-extra-5.8.0-41-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libclang1-10 libllvm10 libxapian30
Suggested packages:
doxygen-latex doxygen-doc doxygen-gui graphviz xapian-tools
The following NEW packages will be installed:
doxygen libclang1-10 libllvm10 libxapian30
0 upgraded, 4 newly installed, 0 to remove and 1 not upgraded.
Need to get 33.2 MB of archives.
After this operation, 154 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
..........................

 

Step 4: Check Version

After successful installation, you can check the current installed version by using doxygen --version command as shown below.

cyberithub@ubuntu:~$ doxygen --version
1.8.17

 

Step 5: Generate Documentation

First you need to create configuration file of your source code by using doxygen -g <file> syntax. In this example, we are generating configuration file sample.conf using doxygen -g sample.conf command as shown below.

cyberithub@ubuntu:~$ doxygen -g sample.conf


Configuration file 'sample.conf' created.

Now edit the configuration file and enter

doxygen sample.conf

to generate the documentation for your project

Once the configuration file is edited, you can generate the documentation for your project by running doxygen sample.conf command as shown below.

cyberithub@ubuntu:~$ doxygen sample.conf
Searching for include files...
Searching for example files...
Searching for images...
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Searching for files in directory /home/cyberithub
Reading and parsing tag files
Parsing files
Building group list...
Building directory list...
Building namespace list...
Building file list...
Building class list...
Computing nesting relations for classes...
Associating documentation with classes...
Building example list...
Searching for enumerations...
Searching for documented typedefs...
Searching for members imported via using declarations...
Searching for included using directives...
Searching for documented variables...
Building interface member list...
Building member list...
Searching for friends...
Searching for documented defines...
Computing class inheritance relations...
Computing class usage relations...
Flushing cached template relations that have become invalid...
Computing class relations...
Add enum values to enums...
Searching for member function documentation...
Creating members for template instances...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Adding members to member groups.
Computing member references...
.........................................

 

Step 6: Check all the available options

To check all the options available with doxygen command, you need to use doxygen --help command as shown below.

cyberithub@ubuntu:~$ doxygen --help
Doxygen version 1.8.17
Copyright Dimitri van Heesch 1997-2019

You can use doxygen in a number of ways:

1) Use doxygen to generate a template configuration file:
doxygen [-s] -g [configName]

2) Use doxygen to update an old configuration file:
doxygen [-s] -u [configName]

3) Use doxygen to generate documentation using an existing configuration file:
doxygen [configName]

4) Use doxygen to generate a template file controlling the layout of the
generated documentation:
doxygen -l [layoutFileName]
.............................................

Leave a Comment