views:

565

answers:

2

I've developed a static library that I'd like to share between XCode projects. I did some reading to learn exactly how to include this library as a binary dependency so that it runs on both the device and the simulator and that lead to a couple of manual steps which I'd now like to automate. Overall I'd like to be able to release new versions of my library and have a simple upgrade process for any project using the older version. Currently that process consists of deleting and/or copying the new binary files over the original location, deleting copying over new header files. The initial install consists of the same two steps along with additional project/target level configuration to set conditional linker flags based on the target SDK. Is there a way this could be automated? I mean I know I could do something like write an Applescript to do the heavy lifting but how? Has anyone ever automated xcode build settings via applescript? How would I call into XCode via Applescript? Are there any other alternatives? Is there a better way to maintain binary level dependencies?

Update

I'm looking to maintain a binary level dependency where project A depends on a static library created by project B. Something similar to a framework that can be included into an XCode iPhone project easily. After building "B" I want something that can practically be dropped into and project including A. While I am becoming aware of all the procedures around leveraging such a dependency I am looking for some solutions to soften up all of the rough edges.

A: 

Hello,

You just have to drag & drop your library project in your project. xCode will dot the rest...

Regards,

Thierry

thierryb
I'm not looking to use source dependency, rather I'm trying to figure out best practice for library binary dependencies. With an A->B dependency, I want the B output to be a a product that can be easily included into any XCode project sans source code.
Cliff
+1  A: 

Add a custom build script through Xcode:
-select your target under the Targets group on the left
-select Add -> New Build Phase -> New Run Script Build Phase
-double click on the new Run Script item underneath your target -this allows you to write a shell script, accessing most of the Xcode environment variables related to the current build, e.g. $BUILT_PRODUCTS_DIR
-if you check the "Show environment variables in build log" and view the detailed build output you can see all the variables available.

Have a Google search and you'll find lots of examples, e.g. section 20.3 here etc.

If you are using Subversion I believe you can use SVN externals to specify which particular version of your library to use.

Dan J