开发者

Compiling a C library so it can be used in an iPhone static library

I've never done this before, so I'm not sure where to even start. I have a few projects where I want to use the liblio library, both on 开发者_如何学Cthe iPhone and OS X. I've put the installation instructions in a gist.

Here are my questions, and I'll try and edit these questions as I figure them out.

  1. Do I want to use make install to compile these files? I feel like all the compilation should be done within XCode.
  2. It looks like there are a lot of platform specific settings during compilation. How do I control this from XCode?
  3. It seems like I should be able to add all the .h/.m files to my XCode project and compile them myself. Is this missing something?

For the record, I'm aware of a few LibLO libraries created for use on the iPhone. I may break down and use one, but I'd prefer to learn how to do this myself.


Yes, if you want to compile these projects from within XCode, you need to add the .c/.h files and then setup them accordingly. XCode has support for passing argument to the compiler of course, so it is indeed possible.

From the gist snippet, it looks like the installation instructions are GNU standard instructions, ie. configure; make; make install. You could try playing with arguments to configure (which, btw, creates the Makefile on the spot) and see what options you have for compiling to a different target platform.

However, it may not be worth all the trouble to convert the Makefile's to a pure XCode project. Another approach, which I think I would start with, is to hack the created Makefile until you are able to compile an iPhone friendly lib-file. After that you can tell XCode to run 'make ...' as part of your projects build steps. Then, once you understand the issues, it may be easier to include them in your XCode project proper.


I have not tried this myself, but Building autoconf-configured libraries for iPhone OS might have some useful information for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜