File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed
Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,14 @@ ifeq ($(VERSION),)
66VERSION = unknown
77endif
88
9- SUB_VERSION := $(if $(GITHUB_SHA ) ,$(shell echo $( GITHUB_SHA ) | cut -c1-7 ) ,unknown)
9+ COMMIT_HASH := $(if $(GITHUB_SHA ) ,$(GITHUB_SHA ) ,unknown)
1010
1111APP_MANIFEST = src/Info.plist
1212APP_BUNDLE = $(APP_NAME ) .app
1313APP_EXE = $(APP_NAME )
1414
1515CC = clang++
16- CFLAGS = -std=c++17 -Wall -mmacosx-version-min=11.0 -arch x86_64 -arch arm64 -MMD -MP -DAPP_NAME='"$(APP_NAME ) "' -DVERSION='"$(VERSION ) "' -DSUB_VERSION ='"$(SUB_VERSION ) "'
16+ CFLAGS = -std=c++17 -Wall -mmacosx-version-min=11.0 -arch x86_64 -arch arm64 -MMD -MP -DAPP_NAME='"$(APP_NAME ) "' -DVERSION='"$(VERSION ) "' -DCOMMIT_HASH ='"$(COMMIT_HASH ) "'
1717LFLAGS = -mmacosx-version-min=11.0
1818INCS = -I../external/sdl/build/include/ -I../external/imgui/ -I../shared/
1919LIBS = -L../external/sdl/build/lib/ -lSDL2-2.0.0 -framework Cocoa -framework OpenGL
@@ -63,7 +63,7 @@ $(BOOTROM_HEADER): $(BOOTROM_SOURCE)
6363
6464# Generate Info.plist from template with version substitution
6565$(APP_MANIFEST ) : $(APP_MANIFEST ) .in
66- sed -e ' s/@APP_NAME@/$(APP_NAME)/g' -e ' s/@VERSION@/$(VERSION)/g' -e ' s/@SUB_VERSION @/$(SUB_VERSION )/g' $< > $@
66+ sed -e ' s/@APP_NAME@/$(APP_NAME)/g' -e ' s/@VERSION@/$(VERSION)/g' -e ' s/@COMMIT_HASH @/$(COMMIT_HASH )/g' $< > $@
6767
6868# Pattern rules for incremental compilation
6969% .o : ../shared/% .cc $(LICENSE_HEADER ) $(BOOTROM_HEADER )
Original file line number Diff line number Diff line change 1818#define VERSION " unknown"
1919#endif
2020
21- // SUB_VERSION is defined by the compiler via -DSUB_VERSION ="..."
21+ // COMMIT_HASH is defined by the compiler via -DCOMMIT_HASH ="..."
2222// Falls back to generic name if not defined (shouldn't happen in normal builds)
23- #ifndef SUB_VERSION
24- #define SUB_VERSION " unknown"
23+ #ifndef COMMIT_HASH
24+ #define COMMIT_HASH " unknown"
2525#endif
2626
2727#define MEM_SIZE 4096
Original file line number Diff line number Diff line change @@ -220,13 +220,18 @@ void Gui::HelpWindows() {
220220 ImGui::SetNextWindowPosCenter (ImGuiSetCond_Appearing);
221221 ImGui::Begin (" About" , &show_about);
222222
223+ // Truncate COMMIT_HASH to first 7 characters for display
224+ char short_hash[8 ];
225+ snprintf (short_hash, sizeof (short_hash), " %.7s" , COMMIT_HASH);
226+
223227 ImGui::TextWrapped (
224- APP_NAME " " VERSION " (" SUB_VERSION " )\n "
228+ APP_NAME " " VERSION " (%s )\n "
225229 " \n "
226230 " A cross-platform Chip-8 interpreter written\n "
227231 " in C-Style C++ using SDL2, ImGui, and OpenGL.\n "
228232 " \n "
229- " <https://github.com/Diesel-Net/kiwi-8>\n "
233+ " <https://github.com/Diesel-Net/kiwi-8>\n " ,
234+ short_hash
230235 );
231236
232237 ImGui::End ();
Original file line number Diff line number Diff line change @@ -8,18 +8,17 @@ VERSION = unknown
88!ENDIF
99
1010!IFDEF GITHUB_SHA
11- # Extract first 7 characters of GITHUB_SHA
12- SUB_VERSION = $(GITHUB_SHA:~0,7 )
11+ COMMIT_HASH = $(GITHUB_SHA )
1312!ELSE
14- SUB_VERSION = unknown
13+ COMMIT_HASH = unknown
1514!ENDIF
1615
1716APP_EXE = $(APP_NAME ) .exe
1817APP_PDB = $(APP_NAME ) .pdb
1918APP_RES = $(APP_NAME ) .res
2019
2120CC = CL
22- CFLAGS = /std:c++17 /W4 /MD /nologo /w44996 "/DAPP_NAME=\"$(APP_NAME ) \"" "/DVERSION=\"$(VERSION ) \"" "/DSUB_VERSION =\"$(SUB_VERSION ) \""
21+ CFLAGS = /std:c++17 /W4 /MD /nologo /w44996 "/DAPP_NAME=\"$(APP_NAME ) \"" "/DVERSION=\"$(VERSION ) \"" "/DCOMMIT_HASH =\"$(COMMIT_HASH ) \""
2322LFLAGS = /link \
2423 /LIBPATH:..\external\sdl\build\lib \
2524 /ENTRY:mainCRTStartup
You can’t perform that action at this time.
0 commit comments