How to setup Xcode to share code across iPhone projects
The long story is here: http://www.clintharris.net/2009/iphone-app-shared-libraries/
The short story is here.
Global Settings, i.e. do this once:
- Set up a shared build output directory that will be shared by all Xcode projects.
- Add a “Source Tree” variable that Xcode can use to dynamically find the static library project. (for each project to be shared)
Per Project Settings, i.e. for each project that uses the shared code
- Add the shared project to this project, DON’T select “Copy items into…”
- On linked project properties/General tab, select “Relative to COCOS2D_SRC”
- On the Target properties/General tab, add “Direct Dependencies” for the shared libs, e.g. cocos2d
- On the Target properties/Build tab, ensure there is no hard coded path in the “Library Search Paths” also add a “User Header Search Path” of $(COCOS2D_SRC)
- Drag the required static libraries from the shared project into the “Link Binary with Libraries” folder for your target.
And thats it :)