Search code examples
windowsiconsexeddub

How to add icon in D application?


I want to add icon to exe file of my application? How can I do it. I would like it's added automatically when I build my app with dub.


Solution

  • I guess I'll write up my comment as an answer as it is the closest we have.

    To add an icon to the application, you first make a resource file, add the icon, then compile that resource into the exe. I explained how to do this in an old thread here and there's a wiki page linked too: http://forum.dlang.org/post/[email protected]

    To achieve this with dub, I'd try adding a preBuildCommand to compile the resource to your dub configuration file, then add a sourceFiles-windows argument for your compiled resource. If the resource is added to dmd as a source file, it will know what to do and pass it to the linker.