Couple of fixes to make it compile on OS X.

This adds OS X target (no UI, just for compiling and detecting warnings and errors). Additionally it fixes couple of warnings and errors on OS X build.