win32: add app icon and version resource

This commit is contained in:
flyinghead 2019-03-30 12:32:37 +01:00
parent 4b0e77a2b3
commit c02a6969df
10 changed files with 73 additions and 16 deletions

1
core/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/version.h

View File

@ -5,7 +5,7 @@
#LDFLAGS := -Wl,-Map,$(notdir $@).map,--gc-sections -Wl,-O3 -Wl,--sort-common
RZDCY_SRC_DIR ?= $(call my-dir)
VERSION_SRC := $(RZDCY_SRC_DIR)/version/version.cpp
VERSION_HEADER := $(RZDCY_SRC_DIR)/version.h
RZDCY_MODULES := cfg/ hw/arm7/ hw/aica/ hw/holly/ hw/ hw/gdrom/ hw/maple/ hw/modem/ \
hw/mem/ hw/pvr/ hw/sh4/ hw/sh4/interpr/ hw/sh4/modules/ plugins/ profiler/ oslib/ \
@ -94,7 +94,6 @@ RZDCY_FILES := $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(w
RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.cc))
RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.c))
RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.S))
RZDCY_FILES += $(VERSION_SRC)
ifdef FOR_PANDORA
RZDCY_CFLAGS := \
@ -156,8 +155,8 @@ endif
RZDCY_CXXFLAGS := $(RZDCY_CFLAGS) -fno-exceptions -fno-rtti -std=gnu++11
$(VERSION_SRC):
echo "const char *version = \"`git describe --tags --always`\";" > $(VERSION_SRC)
echo "const char *git_hash = \"`git rev-parse --short HEAD`\";" >> $(VERSION_SRC)
echo "const char *build_date = \"`date '+%Y-%m-%d %H:%M:%S %Z'`\";" >> $(VERSION_SRC)
$(VERSION_HEADER):
echo "#define REICAST_VERSION \"`git describe --tags --always`\"" > $(VERSION_HEADER)
echo "#define GIT_HASH \"`git rev-parse --short HEAD`\"" >> $(VERSION_HEADER)
echo "#define BUILD_DATE \"`date '+%Y-%m-%d %H:%M:%S %Z'`\"" >> $(VERSION_HEADER)

View File

@ -34,7 +34,7 @@
#include "linux-dist/main.h" // FIXME for kcode[]
#include "gui_util.h"
#include "gui_android.h"
#include "version/version.h"
#include "version.h"
extern void dc_loadstate();
extern void dc_savestate();
@ -1041,9 +1041,9 @@ static void gui_display_settings()
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, normal_padding);
if (ImGui::CollapsingHeader("Reicast", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::Text("Version: %s", version);
ImGui::Text("Git Hash: %s", git_hash);
ImGui::Text("Build Date: %s", build_date);
ImGui::Text("Version: %s", REICAST_VERSION);
ImGui::Text("Git Hash: %s", GIT_HASH);
ImGui::Text("Build Date: %s", BUILD_DATE);
ImGui::Text("Target: %s",
#if DC_PLATFORM == DC_PLATFORM_DREAMCAST
"Dreamcast"

View File

@ -1 +0,0 @@
/version.cpp

View File

@ -1,3 +0,0 @@
extern const char *version;
extern const char *git_hash;
extern const char *build_date;

View File

@ -2199,7 +2199,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"const char *version = \\\"`git describe --tags --always`\\\";\" > $SRCROOT/../../../core/version/version.cpp\necho \"const char *git_hash = \\\"`git rev-parse --short HEAD`\\\";\" >> $SRCROOT/../../../core/version/version.cpp\necho \"const char *build_date = \\\"`date '+%Y-%m-%d %H:%M:%S %Z'`\\\";\" >> $SRCROOT/../../../core/version/version.cpp\n";
shellScript = "echo \"#define REICAST_VERSION \\\"`git describe --tags --always`\\\"\" > $SRCROOT/../../../core/version.h\necho \"#define GIT_HASH \\\"`git rev-parse --short HEAD`\\\"\" >> $SRCROOT/../../../core/version.h\necho \"#define BUILD_DATE \\\"`date '+%Y-%m-%d %H:%M:%S %Z'`\\\"\" >> $SRCROOT/../../../core/version.h\n";
};
/* End PBXShellScriptBuildPhase section */

View File

@ -421,6 +421,12 @@ OBJECTS:=$(OBJECTS:.c=.build_obj)
OBJECTS:=$(OBJECTS:.S=.build_obj)
OBJECTS:=$(patsubst $(RZDCY_SRC_DIR)/%,$(BUILDDIR)/%,$(OBJECTS))
ifdef FOR_WINDOWS
OBJECTS+=$(BUILDDIR)/reicastres.build_obj
$(BUILDDIR)/reicastres.build_obj: $(LOCAL_PATH)/../windows/reicast.rc $(LOCAL_PATH)/../windows/reicast.ico $(RZDCY_SRC_DIR)/version.h
windres $< $@
endif
DEPDIR := .dep-$(BUILDDIR)
DEPFLAGS = -MT $@ -MD -MP -MF $(DEPDIR)/$*.Td
DEPS=$(RZDCY_FILES:.cpp=.d)
@ -500,7 +506,7 @@ uninstall:
rm -f $(DESTDIR)$(ICON_DIR)/reicast.png
clean:
rm -f $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE_STRIPPED) .map
rm -f $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE_STRIPPED) .map $(RZDCY_SRC_DIR)/version.h
.PRECIOUS = $(DEPDIR)/%.d
$(DEPDIR)/%.d: ;

BIN
shell/windows/reicast.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

39
shell/windows/reicast.rc Normal file
View File

@ -0,0 +1,39 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "../../core/version.h"
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "reicast.ico"
/////////////////////////////////////////////////////////////////////////////
1 VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "Reicast Team"
VALUE "FileDescription", "Reicast"
VALUE "FileVersion", REICAST_VERSION
VALUE "InternalName", "reicast"
VALUE "LegalCopyright", "Copyright (c) Reicast Team. All rights reserved."
VALUE "OriginalFilename", "reicast.exe"
VALUE "ProductName", "Reicast"
VALUE "ProductVersion", REICAST_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1252
END
END

16
shell/windows/resource.h Normal file
View File

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by reicast.rc
//
#define IDI_ICON1 105
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif