Building GTK 3 with MSVC 2013

As part of my work at NICE I had the opportunity to research a bit how to build the GTK stack using MSVC. The reason for this is that even if we are currently using the msys2 binaries and we are quite happy with them, it becomes a pain to debug any issue you might have in GLib or GTK from MSVC.

The hexchat people took the instructions from Fan and made them easy to build GLib and GTK2 using a powershell script. After learning and fighting powershell (which BTW is actually quite nice) I made a fork of hexchat‘s repository and added GTK 3 to the build system. It is actually quite impressive how you manage to build everything with this script in a windows 7 VM in less than 6 minutes.

I am sharing this with you because those who had to fight GTK on windows I am pretty sure didn’t have it very easy. Also I think there are a lot of things to improve here:

  • Make it a bit more like jhbuild, where you choose what you want to build without dealing with the dependencies if you do not really want
  • Stop getting custom sources and use the upstream ones. This is one of the things that I worked on, supporting tar.xz on the powershell script.
  • Try to get closer on the setup to upstream msvc projects. This means that right now for each project we keep a copy of the msvc projects to just modify the place where we want to build and install the binaries. This is bad, we should just use upstream’s setup which is good enough.
  • Remove the dependency on mozilla-build. I’d rather use msys2 instead.
  • Make it build with GObject introspection support.
  • Have something like jhbuild modules so we could support different versions of the sources.
  • Make it build from git: this would be great for continuous integration, but unfortunately at the moment some this is not possible due to the files generated at the dist process.

The current solution we managed to get working is actually good enough for our purposes for what we use glib and gtk on our product but if someone wants to improve this I think it could be really good for the future of GTK and GLib.


This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Building GTK 3 with MSVC 2013

  1. Pingback: Links 19/2/2015: Hewlett-Packard on Cumulus Linux, Previews of GNOME 3.16 Beta | Techrights

  2. Stu says:

    It’s good that somebody is trying to get this all working on linux, I periodically google for this, once pygobject works reliably on Win 64 then I’ll finally port my app to Gtk3 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *