Re: "Installing" iOS libraries
Re: "Installing" iOS libraries
- Subject: Re: "Installing" iOS libraries
- From: Andreas Grosam <email@hidden>
- Date: Sat, 14 Jan 2012 16:25:27 +0100
On Jan 14, 2012, at 1:18 AM, Thomas Davie wrote:
> Hi there,
>
> I have a project that I'm working on that's split up into a number of libraries, I'm trying to figure out the best solution for installing libraries and headers so that I can use them without setting ugly paths into my home directory in the projects.
>
> I don't want to install to /usr because these are not Mac OS libraries that will work on my machine.
> I don't want to install into the SDK root because I get the impression these should always be virgin copies of the SDK, not messed with by users.
> I don't want them left in my home directory because that will cause every user to have to mess about changing references.
>
> What's my best approach here?
>
> Thanks
>
> Tom Davie
If you would want to *install* your own Mac OS X dynamic library which shall be used by other applications (e.g. your app and possibly from many users) on the system, /usr/local is the best place to *install* them. (Note that "usr" originally does not mean "user" but "Unix System Resources"). Of course, you never ever modify SDK root, and you shall not install libraries into /usr directly.
But since the libraries you are working on do not "work on your machine" you don't need to and you should not *install* these libraries at all on your machine!
Well, if you possibly want to link against iOS static libraries within other projects, your best bet is to share the Xcode *library project* within a workspace where your other project is also included. In this case you don't share the *products* directly, but the *project* - including all the sources and the build information.
You may wish to set a few build settings for the other project and the static library project in order to make this work seamlessly:
1) in the static library project define where the public headers shall be installed. Modify "Installation Directory", usually: INSTALL_PATH = $(BUILT_PRODUCTS_DIR) (note: default and suitable for dynamic libs is /usr/local/lib/)
Xcode will create a directory with name <product> within BUILT_PRODUCTS_DIR and will copy all public headers into it.
Furthermore: ensure "Skip Install" is disabled (a static library should not be installed).
2) In the "other project", link against the library using the corresponding Xcode's panes to accomplish this. Add a header search path in the build settings in order to be able to locate the public headers from your other project sources. Usually you will add the path BUILD_PRODUCTS_DIR. Then, in your sources, include public library headers *qualified* with the library name via
#include "MyLib/myheader.h"
If for some reason you want to share the iOS *library products* (static lib, framework containing static lib) you require something like a fat library which includes binaries for arm(s) and Simulator. Accomplishing this is not directly supported by Xcode but you can accomplish it with help from others, but only if you know what you are doing. This can be quite complex, and a newer version of Xcode may break it.
Pointers for this: <https://github.com/kstenerud/iOS-Universal-Framework>, <http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4>
Andreas _______________________________________________
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