Change build date to commit date in version string

Use build date only when there is no commit.
This commit is contained in:
bob committed 2026-10-30 12:48:51 +01:00
1 parent b9a2cd51f6
commit 62a89679f0
2 files changed
+5 -3

No files matched your search

+2 -1
View File
@@ -2,7 +2,8 @@ include premake.make
# git commit hash and version for this build # git commit hash and version for this build
COMMIT-HASH != git log 2>/dev/null | sed -e '1s/^commit //;q' COMMIT-HASH != git log 2>/dev/null | sed -e '1s/^commit //;q'
COMMIT := "static const char* commit = \"$(COMMIT-HASH)\";" COMMITDATE != git log 2>/dev/null | sed -ne '3p' | sed -e 's/^Date: //'
COMMIT := "const char* commit = \"$(COMMIT-HASH), $(COMMITDATE)\";"
VERSION := "static const char* version = \"$(MAJOR).$(MINOR).$(PATCH)\";" VERSION := "static const char* version = \"$(MAJOR).$(MINOR).$(PATCH)\";"
# some important install locations # some important install locations
+3 -2
View File
@@ -11,9 +11,10 @@ std::string {PROJECT}_version() {
#endif #endif
oss << '\n'; oss << '\n';
if (commit[0] != '\0') { if (commit[0] != '\0') {
oss << "build " << commit << ", "; oss << "build " << commit << '\n';
} } else {
oss << __DATE__ << ", " << __TIME__ << '\n'; oss << __DATE__ << ", " << __TIME__ << '\n';
}
oss << "(c) Bob Polis, all rights reserved"; oss << "(c) Bob Polis, all rights reserved";
return oss.str(); return oss.str();
} }