Fix version and commit display
Made version and commit variables static, and local to the version display function. Previously, they would be globals, and as such would collide with those from linked shared libraries. Now, all project types will have them local.
This commit is contained in:
parent
178b2f4860
commit
c83be332d5
@ -2,8 +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 := "const char* commit = \"$(COMMIT-HASH)\";"
|
COMMIT := "static const char* commit = \"$(COMMIT-HASH)\";"
|
||||||
VERSION := "const char* version = \"$(MAJOR).$(MINOR).$(PATCH)\";"
|
VERSION := "static const char* version = \"$(MAJOR).$(MINOR).$(PATCH)\";"
|
||||||
|
|
||||||
# some important install locations
|
# some important install locations
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
#include "version.inc"
|
|
||||||
#include "commit.inc"
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
std::string {PROJECT}_version() {
|
std::string {PROJECT}_version() {
|
||||||
|
#include "version.inc"
|
||||||
|
#include "commit.inc"
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "{PROJECT} version " << version;
|
oss << "{PROJECT} version " << version;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user