From 79c06098b3888b177f92f3b8ae92dbe9c2745da1 Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Sun, 24 Mar 2024 10:32:51 -0500 Subject: [PATCH] Add windows icon and resource files to build --- .gitignore | 3 ++- Makefile | 28 +++++++++++++++++++--------- resource.manifest | 17 +++++++++++++++++ resource.rc | 16 ++++++++++++++++ 4 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 resource.manifest create mode 100644 resource.rc diff --git a/.gitignore b/.gitignore index 0531c56d..5391b707 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ jsc primum* Prosperon* *.icns -game.cdb \ No newline at end of file +game.cdb +icon.ico \ No newline at end of file diff --git a/Makefile b/Makefile index 506238df..355abd6f 100755 --- a/Makefile +++ b/Makefile @@ -93,6 +93,7 @@ endif INFO :=$(INFO)_$(ARCH) ifeq ($(OS), Windows_NT) # then WINDOWS + DEPS += resource.o LDFLAGS += -mwin32 -static CPPFLAGS += -mwin32 LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread @@ -165,17 +166,16 @@ DEPENDS = $(OBJS:.o=.d) .DEFAULT_GOAL := all all: $(NAME) - cp -f $(NAME) $(APP) - -DESTDIR ?= ~/.bin + cp -f $(NAME) $(APP)$(EXT) SHADERS = $(shell ls source/shaders/*.sglsl) SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS)) +DESTDIR ?= ~/.bin install: $(NAME) cp -f $(NAME) $(DESTDIR)/$(APP) -$(NAME): libengine$(INFO).a libquickjs$(INFO).a +$(NAME): libengine$(INFO).a libquickjs$(INFO).a $(DEPS) @echo Linking $(NAME) $(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@ @echo Finished build @@ -242,17 +242,27 @@ jsc: tools/jso.c tools/libquickjs.a tools/libquickjs.a: $(BIN)/libquickjs.a cp -f $(BIN)/libquickjs.a tools +ICNSIZE = 16 32 128 256 512 1024 +ICNNAME := $(addsuffix .png, $(ICNSIZE)) +ICON = icons/moon.gif +icon.ico: $(ICON) + for i in $(ICNSIZE); do convert $^ -thumbnail $${i}x$${i} $${i}.png; done + convert $(ICNNAME) icon.ico + rm $(ICNNAME) + +resource.o: resource.rc resource.manifest icon.ico + x86_64-w64-mingw32-windres -i $< -o $@ + WINCC = x86_64-w64-mingw32-gcc -crosswin: packer +crosswin: packer resource.o make CC=$(WINCC) OS=Windows_NT ARCH=x86_64 DEBUG=$(DEBUG) OPT=$(OPT) crossios: make OS=IOS ARCH=arm64 DEBUG=$(DEBUG) OPT=$(OPT) -ICNSIZE = 16 32 128 256 512 1024 -Prosperon.icns: icons/moon.gif +Prosperon.icns: $(ICON) mkdir -p Prosperon.iconset - for i in $(ICNSIZE); do magick icons/moon.gif -size $${i}x$${i} Prosperon.iconset/icon_$${i}x$${i}.png; done + for i in $(ICNSIZE); do magick $^ -size $${i}x$${i} Prosperon.iconset/icon_$${i}x$${i}.png; done iconutil -c icns Prosperon.iconset crossmac: Prosperon.icns @@ -280,7 +290,7 @@ playweb: clean: @echo Cleaning project - rm -f source/shaders/*.h core.cdb jso cdb packer TAGS source/engine/core.cdb.h tools/libcdb.a **.a **.o **.d $(APP)* *.icns + rm -f source/shaders/*.h core.cdb jso cdb packer TAGS source/engine/core.cdb.h tools/libcdb.a **.a **.o **.d $(APP)* *.icns *.ico rm -rf Prosperon.app docs: doc/prosperon.org diff --git a/resource.manifest b/resource.manifest new file mode 100644 index 00000000..b68577fa --- /dev/null +++ b/resource.manifest @@ -0,0 +1,17 @@ + +Copyright (c) 2024 Pockle World. All Rights Reserved. + + + Prosperon Game Engine + + + + + + + + \ No newline at end of file diff --git a/resource.rc b/resource.rc new file mode 100644 index 00000000..930797e4 --- /dev/null +++ b/resource.rc @@ -0,0 +1,16 @@ +101 ICON "icon.ico" +102 RT_MANIFEST "resource.manifest" +103 VERSIONINFO +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Pockle World" + VALUE "FileDescription", "Prosperon Game Engine" + VALUE "FileVersion", "0.4.0" + VALUE "LegalCopyright", "Copyright 2024 Pockle World." + VALUE "ProductVersion", "0.4.0" + END + END +END