Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doxygen: Outputting Version Numbers

I would like to have Doxygen display the source code version number as part of the main page or the title header.

Presently, our code has the version defined as a text literal:

/*!
 *  \brief  Text literal containing the build number portion of the
 *              ESG Application Version.
 */
static const char   build_version_text[] = "105";

I have searched the internet for a method to get the 105 from the above statement into the Doxygen main page (or header) with no luck.

Background
We have a build server that updates the text string as part of a nightly build operation. The file is updated, then checked into the Software Configuration Management system. The build server is also capable of generating the documentation. We would also like to have the developers be able to check out the code, the build the Doxygen documentation at their workstations.

We are using Doxygen version 1.8.11.

like image 354
Thomas Matthews Avatar asked Sep 19 '16 20:09

Thomas Matthews


1 Answers

What you're looking for is to set the PROJECT_NUMBER config option based on the value in your source. I don't think this can be done, but the way I would go about achieving the same result is as follows.

Since the project version is updated when a build script runs, have the build script generate an extra file, for example Doxyversion. Have the content of the file be:

PROJECT_NUMBER = "<versiontext>"

Update your main Doxyfile and replace

PROJECT_NUMBER =

with

@INCLUDE = "<pathToDoxyversion>"

Edit:

A solution I can think of that does not require duplicating the version string requires parsing the version string out from the file into an environment variable. Then you can set PROJECT_NUMBER to

PROJECT_NUMBER=$(ENV_VAR)

Another option is you can call doxygen with

( cat Doxyfile ; echo "PROJECT_NUMBER=$ENV_VAR" ) | doxygen

Both solutions would require the developers to know to do this when generating the documentation, or wrapping the entire doxygen call in a script. Also potential portability issues.

like image 158
Artur Kink Avatar answered Oct 13 '22 08:10

Artur Kink