Mac OS X Notes
Clone this wiki locally
Mac OS X Notes
Since February 2009, gtkD now works properly on Mac OS X too. This guide has been tested with DSSS 0.75 (other versions will propably fail) on revision 648 of the gtkD svn. The current svn HEAD might not be working on OS X.
Option 1: Installing the GTK+ Framework
If you're not using gtkDgl (the OpenGL/gtkglext module) you should use the new Mac OS X native GTK+ Framework installer (beta) from gtk-osx. That is the default for gtkD. Just install the framework you download from there, and you can proceed with building gtkD.
Option 2: Installing GTK+ X11 through Macports
If you want to use gtkDgl, you will have to use the X11 version, which runs under the separate X11 environment of OS X, because gtkglext is not yet ported to the Quartz backend. The most convenient way to install GTK+ and it's dependencies is to use Macports. You can install the package found from their website, and in a terminal, run the port command with the parameters found below. NOTE: This operation will take many hours, as it will download all the packages and build them from source. You should have XCode (and X11) installed and an internet connection available for this to work.
sudo port install gtkglext
That command will actually install gtkglext, and it's dependencies, which basically means GTK+. (If you don't want or need gtkglext, then you can of course just install the package called gtk2.) See the Macports documentation for additional commands and other usefull packages. (If you run into trouble, try the -f force switch (with deactivate, activate etc.), and if that doesn't help, check everything again, and then remove Macports with their instructions, and start over. And wait again.)
Many hours later, you should prepare gtkD to use X11 paths for the GTK+ libraries. This is done by uncommenting the version=darwinX11 in the gtkD toplevel dsss.conf file. You don't need that version switch on your own applications dsss.conf file. Also add srcgl to the defaulttargets in the toplevel dsss.conf. Now you proceed with building gtkD.
Option 3: Installing a GTK+ X11 package
- Download and launch GTK+ X11
- Add /Library/Framework/GTK+.framework/Resources/bin to your PATH
- doesn't rely on macports (which takes hours of downloading and installing dependencies), but on a quick and simple package install.
- Gtk+-v2.18.5 is installed, a slightly older version compared to gtk-osx (which is currently 2.24).
- the X11 windowing system is launched in parallel with your GtkD application (and, obviously, required). The Quartz backend doesn't require this. Note, however, that the GTK look and feel is pretty much the same in both cases.
In a terminal run
make -f GNUmakefile
To install system-wide
sudo make -f GNUmakefile install
And optionally add /usr/local/include/d/ to the search path of dmd.
Testing the demos
Go to the /demos/ directory and test the various examples by running dsss build in the corresponding demo's folder. For general testing of GTK+, I usually try /demos/gtkD/TestWindow/. For testing Cairo 2D graphics library, I try /demos/cairo/cairo_clock/. And then finally in the /demos/gl/ directory there is shapesGL, for testing OpenGL/gtkglext.