Home » Community » U++ Webs: Functioning, Layout , Design, Features and Structure of these forums, homepage etc. » Automatically embedding Git version information during compilation in TheIDE
| Automatically embedding Git version information during compilation in TheIDE [message #62032] |
Fri, 03 July 2026 13:34  |
nikitha_k
Messages: 9 Registered: July 2023 Location: Banglore
|
Promising Member |
|
|
Hi everyone,
I am developing an application using U++ and building it with TheIDE on Debian.
I would like to automatically embed version information into my executable at compile time, similar to how the compiler provides the predefined macros __DATE__ and __TIME__.
My goal is to include information such as:
* Git tag (e.g. v1.4.0)
* Git commit hash
* Build date and time
so that the application can display it, for example:
App --version
App --git
App --build
or from within the application's About dialog.
I would prefer to embed this information during compilation so that the executable contains the version information even when Git is not available on the target system.
Is there a built-in mechanism in TheIDE to execute a command before compilation or define custom compile-time macros from the output of a command (for example, `git describe --tags` or `git rev-parse --short HEAD`)?
If not, what is the recommended U++ approach for automatically embedding Git version information into an executable?
Thank you.
[Updated on: Fri, 03 July 2026 13:35] Report message to a moderator
|
|
|
|
| Re: Automatically embedding Git version information during compilation in TheIDE [message #62036 is a reply to message #62032] |
Thu, 16 July 2026 00:13  |
Novo
Messages: 1433 Registered: December 2006
|
Ultimate Contributor |
|
|
nikitha_k wrote on Fri, 03 July 2026 07:34
If not, what is the recommended U++ approach for automatically embedding Git version information into an executable?
TheIDE creates a file "build_info.h" in an output directory. Below is an example of such file.
#define bmYEAR 2026
#define bmMONTH 7
#define bmDAY 15
#define bmHOUR 18
#define bmMINUTE 4
#define bmSECOND 44
#define bmTIME Time(2026, 7, 15, 18, 4, 44)
#define bmMACHINE "t530"
#define bmUSER "xxx"
#define bmGIT_REVCOUNT "206"
#define bmGIT_HASH "5b0efecb2b823dcb836afe794754679956c52edb"
#define bmGIT_BRANCH "net.company.upp.app"
How to use this file:
reference/build_info_simple
reference/build_info
Regards,
Novo
|
|
|
|
Goto Forum:
Current Time: Thu Jul 16 12:36:09 GMT+2 2026
Total time taken to generate the page: 0.00871 seconds
|