is there a way to get information for Doxygen from git: For instance for:
@version
@author
@date
The information should be automatically included in the Doxygen comments.
For @version it would be nice to get maybe the tag information.
Many thanks in advance!
I realize this is an older question, but I was just trying to do the same thing.
Neither of the linked answers in the comments are a great solution to this issue. We may want to include e.g. a git revision in the generated documentation without mucking about with git filters and so forth in our working sources.
Fortunately, Doxygen supports the use of environment variables in your Doxyfile, and provides various settings that can be used to place information in your generated content. The PROJECT_NUMBER setting is meant explicitly for including version control information in your documentation.
If we have this in our Doxyfile:
PROJECT_NUMBER = $(PROJECT_NUMBER)
You can run doxygen like this to include the git revision in your generated docs:
PROJECT_NUMBER=$(git rev-parse --short HEAD) doxygen
You're not limited to just the commit id, either. For example:
PROJECT_NUMBER=$(git log -1 --format "%h (%cd)") doxygen
This makes the title in my generated HTML look like:
<div id="projectname">MyProject
 <span id="projectnumber">9dd847b (Fri Feb 1 15:36:13 2019 -0500)</span>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With