Commit SHA in error log

This commit is contained in:
igor725 2018-10-25 21:39:34 +03:00
parent 2984d7ff26
commit 2acb32c1cd
4 changed files with 22 additions and 15 deletions

View File

@ -76,6 +76,10 @@ typedef struct Bitmap_ { uint8_t* Scan0; int Width, Height; } Bitmap;
#endif
#endif
#ifndef CC_COMMIT_SHA
#define CC_COMMIT_SHA "Unknown"
#endif
#ifdef CC_BUILD_D3D9
typedef void* GfxResourceID;
#define GFX_NULL NULL

View File

@ -641,6 +641,8 @@ static void ErrorHandler_FailCommon(ReturnCode result, const char* raw_msg, void
String msg = String_NT_Array(msgBuffer);
String_Format3(&msg, "ClassiCube crashed.%cMessage: %c%c", Platform_NewLine, raw_msg, Platform_NewLine);
String_Format2(&msg, "Commit SHA: %c%c", CC_COMMIT_SHA, Platform_NewLine);
if (result) {
String_Format2(&msg, "%h%c", &result, Platform_NewLine);
} else { result = 1; }

View File

@ -3,6 +3,7 @@ LIBS=-lGL -lcurl -lopenal -lpthread -lX11 -lm
CFLAGS=-g -w -no-pie
SOURCES=$(wildcard *.c)
OBJECTS=$(patsubst %.c, %.o, $(SOURCES))
COMMITSHA=$(shell git rev-parse HEAD | cut -c '1-7')
EXECUTABLE=ClassiCube
@ -10,7 +11,7 @@ $(EXECUTABLE): $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
$(OBJECTS): %.o : %.c
$(CC) $(CFLAGS) -c $< $(LIBS) -o $@
$(CC) $(CFLAGS) -DCC_COMMIT_SHA=\"$(COMMITSHA)\" -c $< $(LIBS) -o $@
clean:
rm -f $(EXECUTABLE) $(OBJECTS)