Skip to content

Commit

Permalink
windows: Use the MicroPython logo as application icon.
Browse files Browse the repository at this point in the history
Add a .ico file with common icon image size, created from
vector-logo-2.png, and embed it into the resulting executable.

Signed-off-by: stijn <[email protected]>
  • Loading branch information
stinos authored and dpgeorge committed Nov 7, 2023
1 parent 03eae48 commit 958c6d9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

# These are binary so should never be modified by git.
*.a binary
*.ico binary
*.png binary
*.jpg binary
*.dxf binary
Expand Down
Binary file added logo/vector-logo-2.ico
Binary file not shown.
6 changes: 6 additions & 0 deletions ports/windows/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,9 @@ test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
test_full: test
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) $(PYTHON) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) $(RUN_TESTS_SKIP) -d basics float micropython

$(BUILD)/$(PROG): $(BUILD)/micropython.res

$(BUILD)/%.res: %.rc
$(ECHO) "WINDRES $<"
$(Q)$(WINDRES) $< -O coff -o $@
10 changes: 10 additions & 0 deletions ports/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,13 @@ For more info, see https://www.winehq.org/docs/wineusr-guide/cui-programs .
If built without line editing and history capabilities
(MICROPY_USE_READLINE=0), the resulting binary can be run using the standard
`wine` tool.


Generating the icon file
------------------------
The windows builds use a .ico file for the executable logo.
To generate such file from a .png file use ImageMagick, as was done for the icons in the logo/ directory:

magick convert vector-logo-2.png -define icon:auto-resize="256,128,96,64,48,32,16" vector-logo-2.ico

Note that for versions prior to 7.0 the command is `convert` instead of `magick convert`.
1 change: 1 addition & 0 deletions ports/windows/micropython.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app ICON "../../logo/vector-logo-2.ico"
3 changes: 3 additions & 0 deletions ports/windows/micropython.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
<ClInclude Include="$(PyBaseDir)ports\windows\*.h" />
<ClInclude Include="$(PyBaseDir)ports\windows\msvc\*.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="micropython.rc" />
</ItemGroup>
<Import Project="msvc/genhdr.targets" />
<Import Project="$(CustomPropsFile)" Condition="exists('$(CustomPropsFile)')" />
<Target Name="GenerateMicroPythonSources" BeforeTargets="BuildGenerateSources" DependsOnTargets="GenerateHeaders;FreezeModules">
Expand Down
1 change: 1 addition & 0 deletions py/mkenv.mk
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
STRIP = $(CROSS_COMPILE)strip
AR = $(CROSS_COMPILE)ar
WINDRES = $(CROSS_COMPILE)windres

MAKE_MANIFEST = $(PYTHON) $(TOP)/tools/makemanifest.py
MAKE_FROZEN = $(PYTHON) $(TOP)/tools/make-frozen.py
Expand Down

0 comments on commit 958c6d9

Please sign in to comment.