Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode Framework Reference Paths and Build Output Directory

I have a workspace, Application.xcworkspace, that builds two frameworks and an executable that uses those frameworks. Here is roughly how they are laid out:

  • Framework_1 - Built and output to ugly DerivedData path.

  • Framework_2 - Depends on Framework_1, which is included in the Frameworks area of the project and specified in the "Link Binary with Libraries" Build Phase, and output to ugly DerivedData path.

  • Application - Depends on Framework_1 and Framework_2, which are included in the Frameworks area of the project and specified in the "Link Binary with Libraries" Build Phase. Output directory is again that ugly DerivedData path.

The problem I have is that the paths in the project file for the referenced frameworks are the DerivedData ugly path - they are like ../../Library/Developer/XCode/DerivedData/Application-longuglyuniquestring/Build/Products/Release/Framework_1.framework.

If I copy the source to another directory, or check it into version control and check it out to another machine, then those framework paths are no longer valid. They get re-generated. The referenced frameworks show up as red in the project.

So far, when I want to build the workspace in another folder, the way I have fixed the problem is to:

  • Build the workspace - Framework_1 builds.
  • Go to the "Products" node for that framework and show it in Finder.
  • Copy the new ugly path.
  • Open the project files for Framework_2 and Application and correct the path for Framework_1 and Framework_2.
  • All the red items should be resolved and everything should build.

That process is tedious and I am lucky the project file can be edited. It is worse for colleagues that do not understand the little I know about the project files, and just want to check the code out and have it build.

Is there something I need to do to the Build Output Directory for the frameworks? I have been leery of changing it since the ugly path is recommended. Is there a copy files option I can use to put those frameworks in some predictable location relative to my workspace?

Any help would be appreciated. I am sure I am missing something simple - it makes no sense that code checked out of source control or copied to another directory would not just build.

like image 221
GTAE86 Avatar asked Oct 10 '13 15:10

GTAE86


People also ask

Where is Xcode build output?

It should by located in: ~/Library/Developer/Xcode/DerivedData . Show activity on this post. You can configure the output directory using the CONFIGURATION_BUILD_DIR environment variable.

What is build folder in Xcode?

Xcode build directory is used to save iOS app binary files when you build your Xcode app. Xcode provides you several ways to specify the build output directory location.


1 Answers

Looks like there is a way to set the DerivedData directory on a per-workspace basis - Xcode 4 - build output directory

I just set DerivedData to be relative to my workspace, then edited the project files accordingly. The only down-side is if I were to use one of those projects in another workspace that was using the default DerivedData path, I would have to change them back.

Many thanks to user DaGaMs - he got an upvote.

I am still seeing bad behavior from XCode 5: I got the project working on my machine. Copied it to another, lower, directory and verified it still worked. Exited XCode and copied the containing directory to a network drive, and from there onto another Mac. When I opened it on the other Mac it was like I never made some of the changes. Even worse, as I worked to fix it, XCode went nuts and added 6 extra '\' characters to each end of my FRAMEWORK_SEARCH_PATHS paths!

Part of the problem stems from the subproject directories in my app being absolute rather than relative. The projects in the top of the workspace are "Relative to Group", so I changed the subprojects to have the same attribute. That seems to have solved the problem, though for some reason when I copy all the files to another machine, the Derived Data redirection does not go with it.

like image 154
GTAE86 Avatar answered Oct 21 '22 03:10

GTAE86