Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Xcode 4 support and static lib #162

Open
wants to merge 8 commits into from

2 participants

@jonah-williams

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.

@jonah-williams

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.

@hawkinsw

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
Commits on Apr 6, 2011
  1. Add static library build target

    Brian Ng authored
Commits on Apr 7, 2011
  1. Revert "Add static library build target", use build target added in X…

    Jonah Williams authored
    …code_4_static_lib branch instead.
    
    This reverts commit 23fe4283071766f6d61ca92e34634945a59f6215.
  2. Make static library project (can be used from other projects)

    Arne Schmitz authored Jonah Williams committed
  3. Added an Xcode 4 workspace to contain all three projects

    Jonah Williams authored
  4. iPhone project depends on static lib

    Jonah Williams authored
  5. Update README with basic Xcode 4 usage instructions

    Jonah Williams authored
Something went wrong with that request. Please try again.