Friday, June 1, 2012

Build fat static library (device + simulator) using Xcode and SDK 4+


It appears that we can - theoretically - build a single static library that includes both simulator and iPhone and iPad.



However, Apple has no documentation on this that I can find, and Xcode's default templates are NOT configured to do this.



I'm looking for a simple, portable, re-usable technique that can be done inside Xcode.



Some history:



  • In 2008, we used to be able to make single static-libs that included both sim and device. Apple disabled that.

  • Throughout 2009, we made pairs of static libs - one for sim, one for device. Apple has now disabled that too.



References:





  1. This is a great idea, it's an excellent approach, but it doesn't work: http://www.drobnik.com/touch/2010/04/universal-static-libraries/



    • There's some bugs in his script that means it only works on his machine - he should be using BUILT_PRODUCTS_DIR and/or BUILD_DIR instead of "guesstimating" them)

    • Apple's latest Xcode prevents you from doing what he's done - it simply will not work, due to the (Documented) change in how Xcode processes targets)





  2. Another SO questioner asked how to do it WITHOUT xcode, and with responses that focussed on the arm6 vs arm7 part - but ignored the i386 part: http://stackoverflow.com/questions/2793392/how-do-i-compile-a-static-library-fat-for-armv6-armv7-and-i386



    • Since Apple's latest changes, the Simulator part isn't the same as the arm6/arm7 difference any more - it's a different problem, see above)




Source: Tips4all

No comments:

Post a Comment