Embedded Projects and Linking

Member
Posts: 241
Joined: 2008.07
Post: #1
Hello, I was hoping someone could suggest the best way to solve this problem I'm having with this mess of a project I inherited.

The way it's set up, there's a main project and within that project are two other projects. Project A depends on the target of Project B. Project B produces a .framework.

The problem I'm having is finding a consistent way of linking to the framework produced by Project B. There's got to be an easier way to link to a framework created by a project during the build without having to look at those nasty temporary directories in the DerivedData folder. I can't link to the build directory because I don't know how to get the relative path. The project has been using absolute paths, but that's bad because if we need to use the project on another computer, a knowledgable developer must intervene and there shouldn't be that kind of dependency on one person.

I tried creating a script that simply copies the finished product to a known location via:

Code:
mkdir -p ./build/$CONFIGURATION$EFFECTIVE_PLATFORM_NAME/

cp -r $PROJECT_TEMP_DIR/../../Products/$CONFIGURATION$EFFECTIVE_PLATFORM_NAME/ProjectB.framework ./build/$CONFIGURATION$EFFECTIVE_PLATFORM_NAME/

and then adding ./build/$CONFIGURATION$EFFECTIVE_PLATFORM_NAME/ to the search paths of ProjectA. This works fine for development, but when it comes to archiving in preparation for ad-hoc distribution it breaks.

This is because the archive folder within the DerivedData folder is not the same as the build folder.

So, is there a way to detect if I'm building for archive and run the script differently if so? Maybe there's a $TEMP_ARCHIVE_FOLDER (or something) variable that I don't know about. Maybe there's a much easier way to link ProjectB to ProjectA.

Any suggestions are greatly appreciated, even if it means something drastically different than what I'm doing now. If anything is unclear, I will be happy to clarify. Big thanks in advance.
Quote this message in a reply
⌘-R in Chief
Posts: 1,247
Joined: 2002.05
Post: #2
It's trivial. All of my apps share two common frameworks. AraeliumAppKit and AraeliumFoundation. AraeliumAppKit also depends on AraeliumFoundation.

In the AA project I add AF as a dependency. In my application's project, I add both AA and AF as dependencies. When you add them to the link phase you can either drag the framework products from the project navigator, or hopefully use the nice add sheet. Sometimes a product doesn't show up in that sheet's list though so dragging it from the navigator straight to the link list is required.

In the image below, I deleted the AF framework from the link list to take a screenshot of the add process and AF won't show back up in the linkable items list in the sheet. So I'll have to drag it from the navigator on the left (the selected item).

[Image: upshot_zTfMK80b.jpg]
Quote this message in a reply
Member
Posts: 241
Joined: 2008.07
Post: #3
How did you go about getting the dependency into the target? If I have to go into the DerivedData folder and drag the dependency to the target, it doesn't really help me. I tried dragging the product but it won't accept it.
In fact, I can't add anything to the target dependencies that I can tell. Clicking the '+' brings up a box that says "No items are available", "Add" is grayed out, and there's really nothing that allows me to add something.
Quote this message in a reply
⌘-R in Chief
Posts: 1,247
Joined: 2002.05
Post: #4
You first need to add the dependency's project to your project. Just drag and drop it into the file list in the project navigator like you would any source file. Then you can add one of its products as a dependency to your target.
Quote this message in a reply
Post Reply