Re: set PROJECT_NUMBER to the value of a #define from a header file

Alessandro Antonello <[email protected]>
Newsgroups gmane.text.doxygen.general
Message-ID <CA+JN8RKhjZJV4F7FyWK0v+Wjyz_pvG0fDe+6n3yrVhmt17cm2w@mail.gmail.com>
Hi, Stefan

I faced this problem years ago and the solution I came up was to add a
target in my Makefiles where I also set variables with the the project
version.

MAJOR_VERSION = 1
MINOR_VERSION = 10
BUILD_VERSION = 155
VERSION_NUMBER = $(MAJOR_VERSION).$(MINOR_VERSION).$(BUILD_VERSION)

Then I added a target with the following command line:

docs : $(HTML_DIR)
( cat doxyfile; echo "PROJECT_NUMBER=$(VERSION_NUMBER)" ) | doxygen -

That command generates the documentation with the version number defined in
the Makefile that is also used in the the header variables inside the
project.



2017-08-18 11:51 GMT-03:00 Stefan Ludewig <[email protected]>:

> Hi.
>
> I would like to centralize the versioning of a project to avoid having to
> count up the project version number at multiple places all the time.
>
> I have version.h file, which looks like this:
> #define STRINGIFY2(param) #param
> #define STRINGIFY(param) EG_PHOTON_STRINGIFY2(param)
>
> #define VERSION_MAJOR 4
> #define VERSION_SERVER_MINOR 1
> #define VERSION_CLIENT_MINOR 8
> #define VERSION_PATCH_RELEASE 2
> #define VERSION STRINGIFY(VERSION_MAJOR) "."
> STRINGIFY(VERSION_SERVER_MINOR) "." STRINGIFY(VERSION_CLIENT_MINOR) "."
> STRINGIFY(VERSION_PATCH_RELEASE)
>
>
>
> - the resource-files include this header, so that the Visual Studio
> resource compiler can use it for the version number that is shown in the
> details page of a generated dll
> - the build-scripts parse that file, so that they can include that number
> as part of the name of the generated package
> - the code itself also includes this header so that it can send the
> version to the server when connecting
>
> Now I wonder about the bst way to also have doxygen use this version
> number when generating the documentation.
> As a fallback option I could just have the buildscript parse in doxygens
> configuration file and replace the value to which PROJECT_NUMBER is set
> with the value from that header that the build script already has
> available anyway, before running doxygen.
> However that would mean that only after running a script first, doxygen
> would know the correct version number to use.
> I would prefer if doxygen would also know the correct version number
> without the need to run an external tool first.
> Is there any way  how to tell doxygen in its config file to read out the
> version number from a #define in a header file?
> I know that it's possible to set PROJECT_NUMBER to an environment variable
> instead of a hard coded value, but that doesn't help as we still would
> have to update the env var every time when version.h gets updated, which
> is errorprone.
> So is there any way to have doxygen use the value of a #define for the
> version number in the generated docs without using any external tools?
>
> Kind regards,
> Stefan.
>
> --
>
> --
> Exit Games Inc.
>
> We Make Multiplayer Simple
> www.photonengine.com
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Doxygen-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/doxygen-users
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Doxygen-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.