App icon using make on msys2

I don’t know if I’m missing anything but what’s the best approach to setting the application icon when building using make (mingw + msys2).

I see there’s a scripts/templates/msys2/icon.rc file but from what I see it’s not used when building through make.

Should I do something like this:

Perhaps we can add it as a build step?

Rg,

Arnaud

yes we would need an extra step for windows in the makefiles, that link sounds correct, generating a .res from the rc and linking it with the final exe

if you want to send a PR with the changes that would be great

How do you guys debug the makefiles?

doing make MAKEFILE_DEBUG=1 errors:

make Debug MAKEFILE_DEBUG=1
HOST_OS=Linux
../openframeworks/libs/openFrameworksCompiled/project/makefileCommon/config.shared.mk:125: *** recipe commences before first target.  Stop.

Seems the indentation in the makefiles should be removed?

It seems spaces are replaces with tabs somewhere?

Anyway do you have any pointers where would be a logical place to add a windres compile command?
Somewhere before linking the windres command should be run and during linking the icon.res file should be added.

As a test I added OF_PROJECT_SOURCES_FILES += $(OF_PROJECT_ROOT)/icon.rc and the .res to $(OF_PROJECT_OBJ_FILES).
If I then add a *.res target I do get the icon.res file in obj/Release/msys/icon.res

But it then fails when it seems to try to parse the .res file:
warning: NUL character seen: rest of line ignores

makefiles always have to use tabs, spaces are not permitted

Can you confirm you can use make MAKEFILE_DEBUG=“true”?

make Debug MAKEFILE_DEBUG="true"
HOST_OS=Linux
../openframeworks/libs/openFrameworksCompiled/project/makefileCommon/config.shared.mk:125: *** recipe commences before first target.  Stop.

Even on Linux this fails I think due to this indented syntax being invalid:

ifdef MAKEFILE_DEBUG
        $(info =================== config.mk platform detection ================)
        $(info PLATFORM_ARCH=$(PLATFORM_ARCH))
        $(info PLATFORM_OS=$(PLATFORM_OS))
        $(info PLATFORM_VARIANT=$(PLATFORM_VARIANT))
        $(info PLATFORM_LIB_SUBPATH=$(PLATFORM_LIB_SUBPATH))
endif

it works if you unindent it or replace it with spaces.

ok yeah, that shouldn’t be indented at all, indentation in makefiles can only be used for rules and this is not a rule. you can use spaces to indent it cause spaces aren’t really parsed so these blocks should be indented with spaces for clarity

if you want to change that, it would be really useful as well

I need to fix the .res being treated as makefile as its in the list with .d files but I’ll have a look next year :grin:
Shop is closing here and no Windows at home :+1: