Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » [PROPOSAL] U++ version macro
[PROPOSAL] U++ version macro [message #33137] Sun, 10 July 2011 17:43 Go to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi!

Sometimes I want to have an access to information about what sources were used when compiling my application (e.g. to show it in About box Wink ). As of now, the only way to get this piece of information is to include ide/version.h and use IDE_VERSION macro. As you can see, that is not really intuitive and has some drawbacks, for example if you export project sources, the version.h won't be exported (unless you add ide package to your project, which is absurd overkill).

I propose to change the name of this version macro and also move it into Core package. Following solution should do it and maintains backward compatibility:

Add file Core/version.h:
#ifndef UPP_VERSION
  #define UPP_VERSION 3629
#endif
Change ide/version.h to:
#include<Core/version.h>
#ifndef IDE_VERSION
  #define IDE_VERSION UPP_VERSION
#endif

Finally, add #include "version.h" into Core/Core.h.

What do you think?

Best regards,
Honza
Re: [PROPOSAL] U++ version macro [message #33151 is a reply to message #33137] Mon, 11 July 2011 15:54 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
dolik.rce wrote on Sun, 10 July 2011 11:43

Hi!

Sometimes I want to have an access to information about what sources were used when compiling my application (e.g. to show it in About box Wink ). As of now, the only way to get this piece of information is to include ide/version.h and use IDE_VERSION macro. As you can see, that is not really intuitive and has some drawbacks, for example if you export project sources, the version.h won't be exported (unless you add ide package to your project, which is absurd overkill).

I propose to change the name of this version macro and also move it into Core package. Following solution should do it and maintains backward compatibility:

Add file Core/version.h:
#ifndef UPP_VERSION
  #define UPP_VERSION 3629
#endif
Change ide/version.h to:
#include<Core/version.h>
#ifndef IDE_VERSION
  #define IDE_VERSION UPP_VERSION
#endif

Finally, add #include "version.h" into Core/Core.h.

What do you think?

Best regards,
Honza


Well, why not, but it would only work for "released" sources, not for svn....

Mirek
Re: [PROPOSAL] U++ version macro [message #33152 is a reply to message #33151] Mon, 11 July 2011 17:06 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mirek wrote on Mon, 11 July 2011 15:54

Well, why not, but it would only work for "released" sources, not for svn....

Mirek

Sure, I'm aware of the SVN limitation. But SVN is mainly for developers. Skilled developer can surely write a simple script to keep the file up to date Wink Something along the lines of
#!/bin/sh
UPPROOT=/path/to/upp
UPPREV=`svn info $UPPROOT | sed -n 's/Revision: \([0-9]*\)/\1/p'`
echo "#ifndef UPP_VERSION
  #define UPP_VERSION $UPPREV
#endif" > $UPPROOT/uppsrc/Core/version.h


Also, the update system in theide can take care of this (as it does now with IDE_VERSION), even when using SVN repository.

Honza
Re: [PROPOSAL] U++ version macro [message #33209 is a reply to message #33152] Sat, 16 July 2011 09:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
What about:

During build, if theide finds specific file (say 'version') inside package and svn is present, it would set it to the current svn revision

#define PACKAGE_VERSION 3333
Re: [PROPOSAL] U++ version macro [message #33225 is a reply to message #33209] Sun, 17 July 2011 16:51 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

mirek wrote on Sat, 16 July 2011 09:44

What about:

During build, if theide finds specific file (say 'version') inside package and svn is present, it would set it to the current svn revision

#define PACKAGE_VERSION 3333


Do I understand correctly that you would like to do this in theide builder code? Well, that would be just an additional bonus, as it could be used in end user packages as well... as long as they use SVN.

Honza
Previous Topic: [bug]HasMouse() disappeared from CtrlCore.h
Next Topic: Add empty to STL_VECTOR_COMPATIBILITY
Goto Forum:
  


Current Time: Sat Apr 27 18:23:06 CEST 2024

Total time taken to generate the page: 0.05881 seconds