Xcode 4: How to Add Static Library Target Dependency to Project - xcode4

I know, this has been asked a few times, but mostly for Xcode 3.x. For the iPad, I have two projects both living in a common workspace
Foo, a view-based application and
Foolib, a static Cocoa-Touch library
the former depending on the latter. I seem unable to work out how to add that dependency. It's not well explained in the documentation, so I tried the following:
Click on the Foo project in the Navigation Area on the left,
Select Build Phases up the top and expand the Target Dependencies section
Click the plus button, but the resulting list is empty.
I have also tried to drag/drop the .a file into that section, with little success. Also, the documentation states
If the build product of one project in a workspace is dependent on the build product of another project in the workspace (for example, if one project builds a library used by the other project), Xcode discovers such implicit dependencies and builds in the correct sequence.
I wonder how Xcode discovers those dependencies. Is Apple saying I don't have to add this target dependency at all? But then how would Xcode discover that one is using the other?
Last but not least, I will need to get the .h files from Foolib across to Foo somehow. What is the recommended way of doing that? Obviously, I don't want to just copy them. With frameworks the header files come included, but what do people generally do when working with static libraries that they themselves develop in parallel.
A nudge in the right direction would be much appreciated. Thank you.

In general Xcode 4 seems to discover the dependencies automatically as the Edit Scheme sheet implies. Other developers have mentioned that the dependencies are not automatically discovered and require explicitly listing them:
So, Edit Scheme -> Build -> add targets from your workspace.
As far as the static library header files go, Xcode 4 seems to have a problem, at least with code completion and syntax highlighting. The only way I can get either to work properly with classes in static libraries to to drag a copy of the header files in question to a location into a group folder in the main project. Note that you should uncheck Add to Target... That takes care of the syntax highlighting and code completion. The rest should be handled by giving it the proper header search path. That would be User Header Search Paths = $(BUILT_PRODUCTS_DIR) - depending on how you set up your locations preferences.
See: this link

Related

Use custom made widget in another project

I have come across this custom widget,
https://github.com/akontsevich/WidgetBox
however I am unable to work out how to use it in my current project.
I have tried including the files in my project, as well as including a .pri file in my project.pro but it won't.
How do you use custom widgets, (this one for example) in a project?
You've got two ways to work with that.
First look at the project file for the widget: WidgetBox pro.
Notice the lines:
TEMPLATE = lib
...
creator_target.output = WidgetBoxPlugin.dll
This means you can build a library from the project and use it inside yours (after including proper headers)
Another way would be to include all the sources from the WidgetBox project into yours and build them along with your source.
Which approach to use depends on your needs. If you don't plan to modify the widget building it once from the authors project should be enough for you.

Can I selectively refactor files from a non-ARC project to be ARC compliant?

Scenario:
I have inherited a non-ARC project that I wish to refactor.
Problem:
There's a few CF-dependent files (some 3-party) that are screwing up the refactoring.
How can I use the automated ARC refactoring whilst avoiding these troublesome files?
... or do I merely selectively set -fno-objc-arc/-fobjc-arc flags around them in the build phase instead of via the 'front-door' refactoring option?
When you use the Convert to ARC tool in Xcode, you should be presented with a preview of the changes. On the left of that panel is a list of the files that will be changed. Unchecking the files that you want to leave untouched should make the refactoring tool skip over them:
Then add the -fno-objc-arc flag to these files in the Build Phases Pane
and you should be all set.

Help context tagging Qt with slickedit

I am trying to get Slickedit working with the Qt framework so that I can navigate the codebase easily and because of the other features it provides. To context tag the library I go to Tools > Tag Files, then I right click on C/C++ to add tag file. I name it Qt.vtg and then select the following trees:
C:\Qt\2010.05\qt\src
C:\Qt\2010.05\qt\include
I get context tagging for something, but I can't get context tagging for some scenarios where I normally get it:
When I try to get the parameters for a second pointer, it shows nothing:
oldAddress = ui->addressText->
When I try to complete specific headers it also gives no help
#include <QtCore/ >
I don't know if I am missing a step for context tagging QT, or the additional steps for context tagging QT.
Ted.
You have to provide the include directories of QT for your project, either in your project's properties (Menu Project, Project properties, directories' tab), or in your compiler's properties (Menu Tools, Options, search for "Compiler properties"). This will enable your project to find the include files; the tag file alone doesn't really help, since you may have conflicting tags in the many tag files you could have, so the include files are necessary.
Make sure you have activated all the macros QT provides to your build system. It's been ten years since I used Qt, but IIRC there were several macro defines optionally specified on a compiler command line; make sure SlickEdit knows about them. (Menu Project, Project properties, compile/link tab).
If that's not sufficient, please give more details (where the definition is contained, settings for autocomplete, for context tagging, etc).

Project or Workspace specific Indentation in Xcode4

Is there any way to setup different indentation values for a specific project or workspace?
I've started working on a new project that uses a different indentation level then I've been using, and I would love to be able to set a custom value for that project, or setup a workspace for it, so that I don't have to think about changing indentation values when moving between projects. I've searched around but haven't had any luck finding any discussion about it.
I came across this question/answer: Is it possible to set indent settings in Xcode per project (or per file, even)? This is the exact same problem that I have, however the solution does not seem to be available in Xcode 4.
Open the file inspector by choosing View > Utilities > File Inspector. Select the project file from the project navigator. Use the Text Settings section in the file inspector to set the indentation for the project.

IDE does not treat mx:Module descendants as Modules?

I'm playing with Modules and they work as advertised: the module swf's ares
built and deployed in the output directories automatically.
My problem is that if I use descendants of mx:Module, the IDE does NOT do all
this nice work for me. I've listed the module in the Flex Modules section of the
project properties, but still nothing.
I'm going to end up repeating a lot of code in each module (to fulfill an
interface) if I cannot figure out how to make the IDE do its thing.
Any ideas?
Right click on your project, go to properties and there's a Modules sections. You can add any classes that extends Sprite.

Resources