diff --git a/uppsrc/ide/About.cpp b/uppsrc/ide/About.cpp index 8d0a43e20..f426a8314 100644 --- a/uppsrc/ide/About.cpp +++ b/uppsrc/ide/About.cpp @@ -7,9 +7,17 @@ #define TOPICFILE #include -#ifndef bmYEAR -#include -#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; } diff --git a/uppsrc/ide/BuildInfo.cpp b/uppsrc/ide/BuildInfo.cpp new file mode 100644 index 000000000..6aed6d645 --- /dev/null +++ b/uppsrc/ide/BuildInfo.cpp @@ -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 + +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 +; diff --git a/uppsrc/ide/ide.upp b/uppsrc/ide/ide.upp index 16bd4de88..6c851d98a 100644 --- a/uppsrc/ide/ide.upp +++ b/uppsrc/ide/ide.upp @@ -76,6 +76,7 @@ file CommandLineHandler.h, CommandLineHandler.cpp, About.h, + BuildInfo.cpp, About.cpp, Macro.cpp, Help.cpp,