Thread: [Doxygen-users] set PROJECT_NUMBER to the value of a #define from a header file
Brought to you by:
dimitri
From: Stefan L. <kai...@ex...> - 2017-08-18 15:18:26
|
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 |
From: Alessandro A. <ant...@gm...> - 2017-08-20 19:47:07
|
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 <kai...@ex...>: > 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 > Dox...@li... > https://lists.sourceforge.net/lists/listinfo/doxygen-users > |
From: Stefan L. <ste...@ex...> - 2017-08-21 14:50:03
|
Hi Alessandro. Your solution is exactly what I had in mind as a backup solution if I could not find a bulit-in solution, as it involves additional tools – you run a makefile to set the project version, which means, it won’t work in the case that one starts doxygen directly without involving that makefile. I was looking for a solution that does not have this restriction. Kind regards, Stefan. *From:* Alessandro Antonello [mailto:ant...@gm...] *Sent:* Sonntag, 20. August 2017 21:47 *To:* Stefan Ludewig *Cc:* dox...@li... *Subject:* Re: [Doxygen-users] set PROJECT_NUMBER to the value of a #define from a header file 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 <kai...@ex...>: 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 Dox...@li... https://lists.sourceforge.net/lists/listinfo/doxygen-users -- -- Exit Games Inc. We Make Multiplayer Simple www.photonengine.com |