Xcode 4 support and static lib #162

wants to merge 8 commits into


None yet
2 participants

I grabbed root42's static library target and adapted it to match what I think is a reasonable project structure for Xcode 4 projects.

This branch includes an ASIHTTPRequest workspace which contains the Mac, iPhone, and libasihttp projects.

The iPhone project has a dependency on the libasihttp static library build product instead of having both project reference the same sources. This way the iPhone project demonstrates use of ASI as a static library rather than recompiling the same code.

The Mac project is unmodified.

I'm hopeful that this provides a simpler way for Xcode 4 users to include ASIHTTPRequest in their projects as the process for adding ASI to an existing project becomes:

  1. Create a workspace containing your app's project.
  2. Add the libasihttp project to your workspace.
  3. Add libasihttp.a to your target's "Link Binary With Libraries" build phase.
  4. Add "$(BUILT_PRODUCTS_DIR)/asihttp" to your target's "User Header Search Paths" build setting.
  5. Add the libasihttp build target to your scheme before your application's target.

No more need to list out a long set of class files which should be added as references and libraries which must be linked against. Hopefully this pattern is not only easier to use but also makes it easier for users of ASI to pull down updates with more confidence that they won't have to figure out if the new version changes classes or introduces new code which must be added to their project. All the ASI headers are public for now but packaging everything in a static library would allow us to limit the publicly visible classes to provide a stable interface for other developers to work with.

I described the overall strategy I used to setup cross project dependencies within a workspace here: http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/

Since the Xcode 3 installation instructions did not use the projects or build targets distributed with ASI I think that these changes do not prevent Xcode 3 users from using ASI. However Xcode 3 users are probably no longer able to build the targets in the iPhone project. If that's a concern please consider pulling this work into a branch instead of master. I think it would be helpful for Xcode 4 users and would love to see feedback on how well this sort of library structure works for sharing.

Looks like I was careless and didn't consider the implications of asi's dependencies on dynamic libs when linking it as a static library, you'd still need to have the project which depends on asi link against the same set of libs.

I pulled Jonah's branch and followed his instructions and it worked great. Thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment