Reputation:
I made a little library for the IPhone that I would like to redistribute, but I cannot find how to compile it to work on both the simulator and the iphoneos. I know there is a way to build a lib.a for both architecture, but I cannot figure it out.
Upvotes: 5
Views: 3311
Reputation: 85955
This is a kind of batching multiple build work. So scripting is suitable and regular solution.
Key concept is mixing command xcodebuild
and lipo
.
Please refer my answer on this question: Build fat static library (device + simulator) using Xcode and SDK 4+
Upvotes: 0
Reputation: 3033
You can use the lipo tool to create a universal binary containing the simulator, armv6 and armv7 versions.
Upvotes: 1
Reputation: 2632
First you obviously have to put your code into a framework. That is fine for linking into your application that exists in the same project, but as you've noticed the iPhone doesn't support dynamic linking.
One of my libraries available on google code has a script that builds a Custom SDK for the iPhone and iPhone Simulator. I put the scripts to do that in the following StackOverflow answer. That also has the link to the code, so you can download and play with settings in the project if the post is not enough.
Upvotes: 1
Reputation: 6869
Set 'Valid Architectures' setting of the Xcode target to both i386 and the one of the iPhone (that I don't know which is, maybe someone will suggest).
Upvotes: 0