Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

build info

 

Demonstates the use of build_info, supplied by U++ builder

 

 

main.cpp

 

#include <Core/Core.h>

 

using namespace Upp;

 

// import data from build_info.cpp

extern int bm_YEAR;

extern int bm_MONTH;

extern int bm_DAY;

extern int bm_HOUR;

extern int bm_MINUTE;

extern int bm_SECOND;

extern const char *bm_MACHINE;

extern const char *bm_USER;

extern const char *bm_GIT_REVCOUNT;

extern const char *bm_GIT_BRANCH;

extern const char *bm_GIT_HASH;

 

CONSOLE_APP_MAIN

{

    StdLogSetup(LOG_COUT|LOG_FILE);

    

    

    Time tm(bm_YEAR, bm_MONTH, bm_DAY, bm_HOUR, bm_MINUTE, bm_SECOND);

    LOG("Compiled " << tm << ", " << (GetSysDate() - (Date)tm) << " day(s) ago");

    LOG("Compiled by user " << bm_USER);

    LOG("Compiled on machine " << bm_MACHINE);

    LOG("Git revcount " << bm_GIT_REVCOUNT);

    LOG("Git hash " << bm_GIT_HASH);

    LOG("Git branch " << bm_GIT_BRANCH);

}

 

 

 

build_info.cpp

 

// we place this in separate file to speedup compilation

// otherwise main.cpp has to be compiled each time as build_info.h is always new

// and compiling this minimal file is much faster

 

#include <build_info.h>

 

int bm_YEAR = bmYEAR;

int bm_MONTH = bmMONTH;

int bm_DAY = bmDAY;

int bm_HOUR = bmHOUR;

int bm_MINUTE = bmMINUTE;

int bm_SECOND = bmSECOND;

 

const char *bm_MACHINE = bmMACHINE;

const char *bm_USER = bmUSER;

 

const char *bm_GIT_BRANCH =

#ifdef bm_GIT_BRANCH

    bmGIT_BRANCH

#else

    ""

#endif

;

const char *bm_GIT_REVCOUNT =

#ifdef bmGIT_REVCOUNT

    bmGIT_REVCOUNT

#else

    ""

#endif

;

const char *bm_GIT_HASH =

#ifdef bm_GIT_HASH

    bmGIT_HASH

#else

    ""

#endif

;

 

 

 

 

Do you want to contribute?