mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-23 16:32:31 +00:00
Fix GIT_HASH and re-add build date. (#691)
This commit is contained in:
parent
f45b72d00d
commit
9d1776410c
4 changed files with 30 additions and 11 deletions
17
Makefile
17
Makefile
|
|
@ -7,6 +7,7 @@ default: all
|
||||||
|
|
||||||
# Preprocessor definitions
|
# Preprocessor definitions
|
||||||
DEFINES :=
|
DEFINES :=
|
||||||
|
C_DEFINES :=
|
||||||
|
|
||||||
#==============================================================================#
|
#==============================================================================#
|
||||||
# Build Options #
|
# Build Options #
|
||||||
|
|
@ -333,13 +334,13 @@ OPT_FLAGS += $(BITS)
|
||||||
|
|
||||||
TARGET := sm64.$(VERSION)
|
TARGET := sm64.$(VERSION)
|
||||||
|
|
||||||
# Stuff for showing the git hash in the intro on nightly builds
|
# Stuff for showing the git hash and build time in dev builds
|
||||||
# From https://stackoverflow.com/questions/44038428/include-git-commit-hash-and-or-branch-name-in-c-c-source
|
# Originally from https://stackoverflow.com/questions/44038428/include-git-commit-hash-and-or-branch-name-in-c-c-source
|
||||||
#ifeq ($(shell git rev-parse --abbrev-ref HEAD),nightly)
|
ifneq ($(shell git rev-parse --abbrev-ref HEAD),main)
|
||||||
# GIT_HASH=`git rev-parse --short HEAD`
|
GIT_HASH=$(shell git rev-parse --short HEAD)
|
||||||
# COMPILE_TIME=`date -u +'%Y-%m-%d %H:%M:%S UTC'`
|
COMPILE_TIME=$(shell date -u +'%Y-%m-%d %H:%M:%S UTC')
|
||||||
# DEFINES += -DNIGHTLY -DGIT_HASH="\"$(GIT_HASH)\"" -DCOMPILE_TIME="\"$(COMPILE_TIME)\""
|
C_DEFINES += -DGIT_HASH="\"$(GIT_HASH)\"" -DCOMPILE_TIME="\"$(COMPILE_TIME)\""
|
||||||
#endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
# GRUCODE - selects which RSP microcode to use.
|
# GRUCODE - selects which RSP microcode to use.
|
||||||
|
|
@ -841,7 +842,7 @@ ifneq ($(SDL1_USED)$(SDL2_USED),00)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
C_DEFINES := $(foreach d,$(DEFINES),-D$(d))
|
C_DEFINES += $(foreach d,$(DEFINES),-D$(d))
|
||||||
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
|
DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
|
||||||
|
|
||||||
# Check code syntax with host compiler
|
# Check code syntax with host compiler
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,11 @@ void djui_panel_main_create(struct DjuiBase* caller) {
|
||||||
djui_base_set_color(&message->base, 255, 255, 160, 255);
|
djui_base_set_color(&message->base, 255, 255, 160, 255);
|
||||||
djui_text_set_alignment(message, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM);
|
djui_text_set_alignment(message, DJUI_HALIGN_CENTER, DJUI_VALIGN_BOTTOM);
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef COMPILE_TIME
|
||||||
|
struct DjuiText* version = djui_text_create(&panel->base, get_version_with_build_date());
|
||||||
|
#else
|
||||||
struct DjuiText* version = djui_text_create(&panel->base, get_version());
|
struct DjuiText* version = djui_text_create(&panel->base, get_version());
|
||||||
|
#endif
|
||||||
djui_base_set_size_type(&version->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
djui_base_set_size_type(&version->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
djui_base_set_size(&version->base, 1.0f, 1.0f);
|
djui_base_set_size(&version->base, 1.0f, 1.0f);
|
||||||
djui_base_set_color(&version->base, 50, 50, 50, 255);
|
djui_base_set_color(&version->base, 50, 50, 50, 255);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,17 @@ const char* get_version(void) {
|
||||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s", SM64COOPDX_VERSION);
|
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s", SM64COOPDX_VERSION);
|
||||||
#else
|
#else
|
||||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %s", SM64COOPDX_VERSION, VERSION_REGION);
|
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %s", SM64COOPDX_VERSION, VERSION_REGION);
|
||||||
#endif
|
#endif // VERSION_US
|
||||||
return sVersionString;
|
return sVersionString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COMPILE_TIME
|
||||||
|
const char* get_version_with_build_date(void) {
|
||||||
|
#if defined(VERSION_US)
|
||||||
|
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s, %s", SM64COOPDX_VERSION, COMPILE_TIME);
|
||||||
|
#else
|
||||||
|
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %s, %s", SM64COOPDX_VERSION, VERSION_REGION, COMPILE_TIME);
|
||||||
|
#endif // VERSION_US
|
||||||
|
return sVersionString;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -29,8 +29,11 @@
|
||||||
#define WINDOW_NAME "Super Mario 64 Coop Deluxe"
|
#define WINDOW_NAME "Super Mario 64 Coop Deluxe"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_VERSION_LENGTH 32
|
#define MAX_VERSION_LENGTH 128
|
||||||
|
|
||||||
const char* get_version(void);
|
const char* get_version(void);
|
||||||
|
#ifdef COMPILE_TIME
|
||||||
|
const char* get_version_with_build_date(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue