Search code examples
macosc++11gtk3clang++dylib

MacOS app bundle with GTK+ - no xcode


I am working on various C++ projects (School/Portfolio related) and I have been using the GTK+3 library for some of them. My apps are done and now I need to create the .app for my applications. I have been trying to get it working for a long time now and still without success. I am not working with xcode and compile my application with:

clang++ main.cpp _Scripts/Resources.cpp _Scripts/gui.cpp _Scripts/Game.cpp -o minesweeper `pkg-config --cflags --libs gtk+-3.0` -std=c++11

One of my projects was a replica of Minesweeper. My .app structure looks like this:

/Minesweeper.app

//Contents

///Info.plist

///MacOS

////minesweeper

////libatk-1.0.0.dylib

////libatkmm-1.6.1.dylib

////etc.dylib

///Resources

////MyAssets

I have done

install_name_tool -id "@executable_path/duplicate.dylib" original.dylib

for every dylib int otool -L minesweeper. I then did

install_name_tool -change "/usr/local/opt/glib/lib/originalDependency.dylib" "@executable_path/duplicateDependency.dylib" duplicate.dylib

for every dylib in otool -L duplicate.dylib. And finally I did

install_name_tool -change /usr/local/opt/gdk-pixbuf/lib/original.dylib "@executable_path/duplicate.dylib" minesweeper

for all the dependencies. After all this, my app is still not working and it looks like it's the Gdk_pixbuf that's failing.

I found the the gdk_pixbuf/loaders folder, but I'm not sure if I need to link that or anything. Could anybody help me get my application working?

Regards, Dani


Solution

  • So, I guess either no-one knew it or no-one wanted to spend 3849823 years to type an answer that MIGHT have helped me. Either way, I totally understand. I've spend a lot of time researching (also before asking the question) and I've written how I successfully created the app-bundle on my website. I hope it helps someone :)