Skip to content

Building GTKMM with Visual Studio on top of MSYS2

Daniyel edited this page Jul 16, 2017 · 2 revisions

This is a brief walk through for using MSYS2 instead of OBS as a basis.

Setting up MSYS2

Make sure you update MSYS2 installation as outlined on their site otherwise you'll end up with slightly older GTK+3 that misses certain functions.

We will need the following (after update)

pacman -S patch python2 git mingw-w64-i686-gtk3 mingw-w64-i686-gstreamer mingw-w64-i686-gst-plugins-good

if you are building for 64 bit Windows, use

pacman -S patch python2 git mingw-w64-x86_64-gtk3 mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-good

Getting the source

Clone this git repo git clone https://github.com/mlt/gtkmm.git and make sure you are using branch with msys2 support.

Generating import libraries

Msys2 import libraries built with gcc are not compatible with MSVC. We can dump export table into library definition file and generate an import library off that with a2lib.py. For this, start Visual Studio command prompt, then start MSYS2 shell C:\msys64\msys2_shell.bat from there and run the following

python2 PROJECT_FOLDER/gtkmm/a2lib.py --root=c:/msys64/mingw32

Configure CMake project & generate VC++ projects or makefiles

While you are at MSYS2 prompt (via VS prompt), create a sibling folder to the cloned git repo where you'll build things.

mkdir build && cd build
cmake-gui ..\gtkmm

Configure, adjust variables, and generate either VS solution & projects, or makefiles for nmake or jom.