ide: BuildInfo separated to additional file to speedup compilation

This commit is contained in:
Mirek Fidler 2025-02-18 16:52:06 +01:00
parent e21ecf2de6
commit 50d66cb3fc
3 changed files with 67 additions and 26 deletions

View file

@ -7,9 +7,17 @@
#define TOPICFILE <ide/app.tpp/all.i>
#include <Core/topic_group.h>
#ifndef bmYEAR
#include <build_info.h>
#endif
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;
String SplashCtrl::GenerateVersionInfo(bool qtf, bool about)
{
@ -17,24 +25,24 @@ String SplashCtrl::GenerateVersionInfo(bool qtf, bool about)
char separator = qtf ? '\n' : ' ';
#ifdef bmGIT_HASH
String rev = bmGIT_HASH;
String dr = rev;
if(dr.GetCount() > 8)
dr.Trim(8);
h << "Revision: ";
if(qtf && about)
h << "\1[^https://github.com/ultimatepp/ultimatepp/commit/" << rev << "^ ";
h << dr;
if(qtf && about)
h << "]\1";
h << separator;
#endif
if(*bm_GIT_HASH) {
String rev = bm_GIT_HASH;
String dr = rev;
if(dr.GetCount() > 8)
dr.Trim(8);
h << "Revision: ";
if(qtf && about)
h << "\1[^https://github.com/ultimatepp/ultimatepp/commit/" << rev << "^ ";
h << dr;
if(qtf && about)
h << "]\1";
h << separator;
}
h << "Build: " << GenerateVersionNumber();
#ifdef bmGIT_BRANCH
h << " " << bmGIT_BRANCH;
#endif
if(*bm_GIT_BRANCH)
h << " " << bm_GIT_BRANCH;
h << "\n";
if(sizeof(void *) == 8)
@ -77,11 +85,9 @@ String SplashCtrl::GenerateVersionInfo(bool qtf, bool about)
#endif
h << separator;
#ifdef bmTIME
h << "Compiled: " << bmTIME;
#endif
h << "Compiled: " << Time(bm_YEAR, bm_MONTH, bm_DAY, bm_HOUR, bm_MINUTE, bm_SECOND);
h << separator;
String p = GetExeFilePath();
if(p.GetCount() > 30)
p = ".." + p.Mid(max(p.GetCount() - 30, 0));
@ -95,9 +101,8 @@ String SplashCtrl::GenerateVersionNumber()
#ifdef bmSVN_REVISION
return bmSVN_REVISION;
#endif
#ifdef bmGIT_REVCOUNT
return AsString(atoi(bmGIT_REVCOUNT) + 2270);
#endif
if(*bm_GIT_REVCOUNT)
return AsString(atoi(bm_GIT_REVCOUNT) + 2270);
return IDE_VERSION;
}

35
uppsrc/ide/BuildInfo.cpp Normal file
View file

@ -0,0 +1,35 @@
// we place this in separate file to speedup compilation
// otherwise About.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 bmGIT_HASH
bmGIT_BRANCH
#else
""
#endif
;
const char *bm_GIT_REVCOUNT =
#ifdef bmGIT_HASH
bmGIT_REVCOUNT
#else
""
#endif
;
const char *bm_GIT_HASH =
#ifdef bmGIT_HASH
bmGIT_HASH
#else
""
#endif
;

View file

@ -76,6 +76,7 @@ file
CommandLineHandler.h,
CommandLineHandler.cpp,
About.h,
BuildInfo.cpp,
About.cpp,
Macro.cpp,
Help.cpp,