Regardless of how you build your guis you need to have a build system that can build the application under all these different environments from a single code base. To this end I created a sample application called Platypus, which can be downloaded from this Github repo.
The code and compilationThe application itself is extremely simple. It consists of one shared library that returns a random number between 0 and 100 when called. It is implemented using C++ 11's random number generator functionality to ensure each platform has a toolchain new enough to handle it. The GUI applications built on top of it have a text label and a button. Pressing the button updates the text label with a new random number. There is also a test program that verifies that the library is working.
The GTK version is a plain C application. The gui is defined using a Glade interface definition file rather than building it by hand.
The macOS version has a GUI written in Objective C. The gui is defined as a XIB file created with XCode. It is built into a standard app bundle.
The Windows application is written in C++ (though it does not really use any C++ features) and has a gui laid out by hand.
All these guis have full platform integration with icons, an Info.plist, .desktop files and so on.
The GTK version can be built as a Flatpak in the usual way. The build manifest can be found in the repository's root.
The macOS version builds a standard .dmg installer that can be directly shipped to end users.
The Windows version builds an .MSI installer providing complete install/uninstall integration.
How complicated is it?
The entire build definition consists of 107 lines of Meson.
Here is the plain GTK version running as a Flatpak application on Kubuntu. Window icons and desktop integration work as you would expect.
Here is the macOS version showing the drive image, the installer window and the application running with proper platform integration.
Finally here is the Windows application showing the installed path location under Program Files, the application itself and the automatic integration to Windows' application uninstaller system.
It would be cool to add an Android application as well as an iOS application written in Swift in the code base. Patches are welcome as always.