Implementing Static Libraries In iPhone

一曲冷凌霜 提交于 2019-11-30 07:41:51

You can use cross-project referencing as in the posts but this has several downturns.

I use this setup that works on Xcode in general (not only for the iPhone) and adds compile-time static library version control.

I put my static libraries in ~/Library/MyLibraries/, the .a archive along with their public headers. This way you can have different versions of them:

~/Library/MyLibraries/
                     /MyLib-1.0.0/Headers/header1.h
                                         /header2.h
                                 /libmylib.a
                                 /libmylib_debug.a
                     /MyOtherLib-2.1.0/Headers/...
                                      /libmyotherlib.a

Then in Xcode settings add the user variables:

LIBRARIES_DIR      $(USER_LIBRARY_DIR)/MyLibraries
MYLIBRARY_LIBROOT  $(LIBRARIES_DIR)/MyLib-1.0.0

and modify the settings

HEADER_SEARCH_PATHS $(MYLIBRARY_LIBROOT)/Headers
OTHER_LDFLAGS       $(MYLIBRARY_LIBROOT)/libmylib.a

Now change MYLIBRARY_LIBROOT to choose your library version. More on this blog post by me.

If you want to keep it simple then just compile the library and setup HEADER_SEARCH_PATHS and OTHER_LDFLAGS.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!