I am sure this has been asked before, however I have been banging my head against a brick wall all afternoon trying to figure out how to achieve this using XCode 4.
I have a lib which was distributed by a 3rd party. They actually ship 2 different versions, one for use in the simulator, and one for use with the actual device.
I would like to know, what is the recommended way for handling situations like this in XCode 4; in XCode 3, I could simply have specified a new target. I wish to avoid creating a fat binary via lipo containing both libs, but if that is the only feasible option available to me, then so be it.
Ideally what I would like to do is modify the Library Search path based upon the current device the project is being compiled for such as:
Simulator: /path/to/simulator/lib.a
Device /path/to/device/lib.a
If I could automate the process so once I had set it up, it was transparent, all the better.
Many thanks for taking the time to read this.
The libraries will be located under lib .
$(SRCROOT) (aka $(SOURCE_ROOT) ) is a path to your location where a .
BUILT_PRODUCTS_DIR. Description: Directory path. Identifies the directory under which all the product's files can be found. This directory contains either product files or symbolic links to them.
XCode define $(EFFECTIVE_PLATFORM_NAME)
to be 'iphoneos' or 'iphonesimulator' base on the target "device". As long as your library path includes one of those strings, you can set
LIBRARY_SEARCH_PATHS
in your targets or project to something like:
/path/to/$(EFFECTIVE_PLATFORM_NAME)/lib.a
Hint: you can see this in action by clicking "All" in Building Settings, and then selecting Editor > Show Setting Names and Editor > Show Setting Definitions in the menus. To see if the final value is what you expect, switch back to values using Editor > Show Setting Values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With