Add windows icon and resource files to build

This commit is contained in:
John Alanbrook 2024-03-24 10:32:51 -05:00
parent ecb2882e7e
commit 79c06098b3
4 changed files with 54 additions and 10 deletions

3
.gitignore vendored
View file

@ -26,4 +26,5 @@ jsc
primum* primum*
Prosperon* Prosperon*
*.icns *.icns
game.cdb game.cdb
icon.ico

View file

@ -93,6 +93,7 @@ endif
INFO :=$(INFO)_$(ARCH) INFO :=$(INFO)_$(ARCH)
ifeq ($(OS), Windows_NT) # then WINDOWS ifeq ($(OS), Windows_NT) # then WINDOWS
DEPS += resource.o
LDFLAGS += -mwin32 -static LDFLAGS += -mwin32 -static
CPPFLAGS += -mwin32 CPPFLAGS += -mwin32
LDLIBS += mingw32 kernel32 d3d11 user32 shell32 dxgi gdi32 ws2_32 ole32 winmm setupapi m pthread 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 .DEFAULT_GOAL := all
all: $(NAME) all: $(NAME)
cp -f $(NAME) $(APP) cp -f $(NAME) $(APP)$(EXT)
DESTDIR ?= ~/.bin
SHADERS = $(shell ls source/shaders/*.sglsl) SHADERS = $(shell ls source/shaders/*.sglsl)
SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS)) SHADERS := $(patsubst %.sglsl, %.sglsl.h, $(SHADERS))
DESTDIR ?= ~/.bin
install: $(NAME) install: $(NAME)
cp -f $(NAME) $(DESTDIR)/$(APP) cp -f $(NAME) $(DESTDIR)/$(APP)
$(NAME): libengine$(INFO).a libquickjs$(INFO).a $(NAME): libengine$(INFO).a libquickjs$(INFO).a $(DEPS)
@echo Linking $(NAME) @echo Linking $(NAME)
$(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@ $(LD) $^ $(CPPFLAGS) $(LDFLAGS) -L. $(LDPATHS) $(LDLIBS) -o $@
@echo Finished build @echo Finished build
@ -242,17 +242,27 @@ jsc: tools/jso.c tools/libquickjs.a
tools/libquickjs.a: $(BIN)/libquickjs.a tools/libquickjs.a: $(BIN)/libquickjs.a
cp -f $(BIN)/libquickjs.a tools 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 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) make CC=$(WINCC) OS=Windows_NT ARCH=x86_64 DEBUG=$(DEBUG) OPT=$(OPT)
crossios: crossios:
make OS=IOS ARCH=arm64 DEBUG=$(DEBUG) OPT=$(OPT) make OS=IOS ARCH=arm64 DEBUG=$(DEBUG) OPT=$(OPT)
ICNSIZE = 16 32 128 256 512 1024 Prosperon.icns: $(ICON)
Prosperon.icns: icons/moon.gif
mkdir -p Prosperon.iconset 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 iconutil -c icns Prosperon.iconset
crossmac: Prosperon.icns crossmac: Prosperon.icns
@ -280,7 +290,7 @@ playweb:
clean: clean:
@echo Cleaning project @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 rm -rf Prosperon.app
docs: doc/prosperon.org docs: doc/prosperon.org

17
resource.manifest Normal file
View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<copyright>Copyright (c) 2024 Pockle World. All Rights Reserved.</copyright>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
name="Prosperon"
version="0.4"
type="win32"
/>
<description>Prosperon Game Engine</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

16
resource.rc Normal file
View file

@ -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