Re: Adding a 3rd party C++ library to ObjectiveC project
Re: Adding a 3rd party C++ library to ObjectiveC project
- Subject: Re: Adding a 3rd party C++ library to ObjectiveC project
- From: Koen van der Drift <email@hidden>
- Date: Sat, 08 Jun 2013 18:43:15 -0400
I finally figured out why I couldn't get it to work.
The library i am trying to add to my project comes with CMAKE build files. In order to have it build for iOS, I found a toolchain file, that can be used to add specifics (patch the makefile) for a specific build environment. I used this to set it either for the device or the simulator architecture. However, when playing around with lipo, I noticed that the architecture for both is actually x86_64, so the toolchain file was never used, or at least the architecture info was not used. This also explains that I could only build and run my project with the static library in the simulator and was getting all sorts of errors and warnings when trying to run it on a device.
So, next is to figure out how to fix this and tickle CMAKE so that the libraries are actually build for the correct architectures. I know this is outside the scope of this mailing list, but if anyone has some experience with this, feel free to contact me off-list.
- Koen.
On Jun 8, 2013, at 3:22 PM, Jeffrey Walton <email@hidden> wrote:
> On Sat, Jun 8, 2013 at 2:57 PM, Koen van der Drift
> <email@hidden> wrote:
>> What I ended up doing in the end was just copy the source and header files from the 3rd party library into my project, without creating a library. I spent hours searching and reading info on how to create a static library inside and outside Xcode, but I never could get it to work for both architectures.
>>
> Yeah, I've hit the same wall in the past. There's not much information
> on porting a third party library to a Framework. Apple has information
> on creating frameworks, but nothing for Makefile project -> Framework.
> Stack overflow had no answers either (when I searched in the past).
>
> Now I build the third party library using SDKROOT (the Makefiles have
> to be made aware), and then install them in /usr/local. My installs
> look similar to:
>
> /usr/local/openssl/iphoneos-armv6
> /usr/local/openssl/iphoneos-armv7
> /usr/local/openssl/iphoneos-armv7s
> /usr/local/openssl/iphone-simulator
> /usr/local/openssl/macosx-i386
> /usr/local/openssl/macosx-x86_64
>
> I then use paths and conditional build settings to include the proper library.
>
> Jeff
>
>> On Jun 7, 2013, at 11:19 PM, Jeffrey Walton <email@hidden> wrote:
>>
>>> On Fri, Jun 7, 2013 at 11:14 PM, Koen van der Drift
>>> <email@hidden> wrote:
>>>>
>>>> On Jun 7, 2013, at 3:33 PM, Koen van der Drift <email@hidden> wrote:
>>>>
>>>>> It's a static library (.a), and I don't expect any upstream updates soon. Oh, did I mention this is for an iOS project, that might bring some more fun with it ;-)
>>>>
>>>> So this turns out to be some kind of a hassle. Since the Simulator and the iPhone have two different architectures, I need to have two copies of the library available. Can I just create both, and add them to Xcode with a different name for each architecture? Maybe I should create a framework for the library instead, so I don't have to change the whole time?
>>>>
>>> http://stackoverflow.com/questions/1211854/xcode-conditional-build-settings-based-on-architecture-device-arm-vs-simulat
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden