added some apple specific settings, default build options and code fixes