Skip to content

Commit 958c6d9

Browse files
stinosdpgeorge
authored andcommitted
windows: Use the MicroPython logo as application icon.
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]>
1 parent 03eae48 commit 958c6d9

File tree

7 files changed

+22
-0
lines changed

7 files changed

+22
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
# These are binary so should never be modified by git.
1010
*.a binary
11+
*.ico binary
1112
*.png binary
1213
*.jpg binary
1314
*.dxf binary

logo/vector-logo-2.ico

166 KB
Binary file not shown.

ports/windows/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,9 @@ test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
102102
test_full: test
103103
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
104104
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
105+
106+
$(BUILD)/$(PROG): $(BUILD)/micropython.res
107+
108+
$(BUILD)/%.res: %.rc
109+
$(ECHO) "WINDRES $<"
110+
$(Q)$(WINDRES) $< -O coff -o $@

ports/windows/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,13 @@ For more info, see https://www.winehq.org/docs/wineusr-guide/cui-programs .
135135
If built without line editing and history capabilities
136136
(MICROPY_USE_READLINE=0), the resulting binary can be run using the standard
137137
`wine` tool.
138+
139+
140+
Generating the icon file
141+
------------------------
142+
The windows builds use a .ico file for the executable logo.
143+
To generate such file from a .png file use ImageMagick, as was done for the icons in the logo/ directory:
144+
145+
magick convert vector-logo-2.png -define icon:auto-resize="256,128,96,64,48,32,16" vector-logo-2.ico
146+
147+
Note that for versions prior to 7.0 the command is `convert` instead of `magick convert`.

ports/windows/micropython.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
app ICON "../../logo/vector-logo-2.ico"

ports/windows/micropython.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
<ClInclude Include="$(PyBaseDir)ports\windows\*.h" />
104104
<ClInclude Include="$(PyBaseDir)ports\windows\msvc\*.h" />
105105
</ItemGroup>
106+
<ItemGroup>
107+
<ResourceCompile Include="micropython.rc" />
108+
</ItemGroup>
106109
<Import Project="msvc/genhdr.targets" />
107110
<Import Project="$(CustomPropsFile)" Condition="exists('$(CustomPropsFile)')" />
108111
<Target Name="GenerateMicroPythonSources" BeforeTargets="BuildGenerateSources" DependsOnTargets="GenerateHeaders;FreezeModules">

py/mkenv.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
5454
SIZE = $(CROSS_COMPILE)size
5555
STRIP = $(CROSS_COMPILE)strip
5656
AR = $(CROSS_COMPILE)ar
57+
WINDRES = $(CROSS_COMPILE)windres
5758

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

0 commit comments

Comments
 (0)