Add preprocessor variable to override version number on title bar.

Modify github workflow to set version number to current git SHA, and
append to artifact name.
This commit is contained in:
SarahW 2021-05-28 21:33:22 +01:00
commit f9cdcfa6b6
4 changed files with 17 additions and 8 deletions

View file

@ -14,9 +14,9 @@ jobs:
include: include:
- name: Ubuntu 64bit (gcc) - name: Ubuntu 64bit (gcc)
os: ubuntu-latest os: ubuntu-latest
args: --enable-networking --enable-release-build args: --enable-networking --enable-release-build CFLAGS="-DPCEM_BUILD_VERSION=${GITHUB_SHA::8}"
artifacts_name: PCem-Ubuntu-${{ github.head_ref }}-${{ github.run_number }} artifacts_name: PCem-Ubuntu-${{ github.head_ref }}-${{ github.run_number }}
artifacts_path: PCem.tar.bz2 artifacts_path: PCem-${{ github.sha }}.tar.bz2
installdeps: >- installdeps: >-
libsdl2-dev libsdl2-dev
libopenal-dev libopenal-dev
@ -25,9 +25,9 @@ jobs:
- name: Windows 32bits (MSYS2) - name: Windows 32bits (MSYS2)
os: windows-latest os: windows-latest
compiler: MINGW32 compiler: MINGW32
args: --enable-networking --enable-release-build args: --enable-networking --enable-release-build CFLAGS="-DPCEM_BUILD_VERSION=${GITHUB_SHA::8}"
artifacts_name: PCem-Windows-MINGW32-${{ github.head_ref }}-${{ github.run_number }} artifacts_name: PCem-Windows-MINGW32-${{ github.head_ref }}-${{ github.run_number }}
artifacts_path: PCem.zip artifacts_path: PCem-${{ github.sha }}.zip
installdeps: >- installdeps: >-
base-devel base-devel
zip zip
@ -40,9 +40,9 @@ jobs:
- name: Windows 64bits (MSYS2) - name: Windows 64bits (MSYS2)
os: windows-latest os: windows-latest
compiler: MINGW64 compiler: MINGW64
args: --enable-networking --enable-release-build args: --enable-networking --enable-release-build CFLAGS="-DPCEM_BUILD_VERSION=${GITHUB_SHA::8}"
artifacts_name: PCem-Windows-MINGW64-${{ github.head_ref }}-${{ github.run_number }} artifacts_name: PCem-Windows-MINGW64-${{ github.head_ref }}-${{ github.run_number }}
artifacts_path: PCem.zip artifacts_path: PCem-${{ github.sha }}.zip
installdeps: >- installdeps: >-
base-devel base-devel
zip zip

View file

@ -4,6 +4,15 @@
#include "timer.h" #include "timer.h"
#ifdef PCEM_BUILD_VERSION
#define STRINGISE2(string) #string
#define STRINGISE(string) STRINGISE2(string)
#define PCEM_VERSION_STRING "build " STRINGISE(PCEM_BUILD_VERSION)
#else
#define PCEM_VERSION_STRING "v17"
#endif
#ifdef ABS #ifdef ABS
#undef ABS #undef ABS
#endif #endif

View file

@ -605,7 +605,7 @@ void runpc()
if (win_title_update) if (win_title_update)
{ {
win_title_update=0; win_title_update=0;
sprintf(s, "PCem v17 - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : ((mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON) ? "Press CTRL-END to release mouse" : "Press CTRL-END or middle button to release mouse")); sprintf(s, "PCem " PCEM_VERSION_STRING " - %i%% - %s - %s - %s", fps, model_getname(), models[model].cpu[cpu_manufacturer].cpus[cpu].name, (!mousecapture) ? "Click to capture mouse" : ((mouse_get_type(mouse_type) & MOUSE_TYPE_3BUTTON) ? "Press CTRL-END to release mouse" : "Press CTRL-END or middle button to release mouse"));
#ifdef __APPLE__ #ifdef __APPLE__
// Needed due to modifying the UI on the non-main thread is a big no-no. // Needed due to modifying the UI on the non-main thread is a big no-no.
dispatch_async_f(dispatch_get_main_queue(), strdup(s), _set_window_title); dispatch_async_f(dispatch_get_main_queue(), strdup(s), _set_window_title);

View file

@ -595,7 +595,7 @@ int window_create()
hwnd = CreateWindowEx ( hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */ 0, /* Extended possibilites for variation */
szClassName, /* Classname */ szClassName, /* Classname */
"PCem v17", /* Title Text */ "PCem " PCEM_VERSION_STRING, /* Title Text */
WS_OVERLAPPEDWINDOW&~WS_SIZEBOX, /* default window */ WS_OVERLAPPEDWINDOW&~WS_SIZEBOX, /* default window */
CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */ CW_USEDEFAULT, /* where the window ends up on the screen */