In XCode 4 change output path and run mutiple targets - xcode

Is it possible to change the out put folder for where a target's executable and libraries are built to? Also is it possible to run more than one target at a time within XCode?

You can change where Xcode places derived data from Xcode's Locations Preferences. Choosing File > Project Settings allows you to change the derived data location for a single project.
I don't know of any way to run multiple targets simultaneously in Xcode.

Related

fonts and xmls not found in Xcode's open framework built product

I want to move my open frameworks project to other machines for testing. but when I try to open a build product (exported via the organizer) the app starts up without the text I set (via ofTrueTypeFont). It also won't load any data from the xmls I use. This also happens if I open the exported product on the same machine.
fonts are loaded like:
in .h
ofTrueTypeFont fontLarge;
in .cpp
fontLarge.loadFont("font.ttf", 35);
fontLarge.drawString("Display that String", 30,30);
I have tried various build phases. copied the .ttfs and .xmls to various directories but the app won't find it.
tried a (/bin)data folder within /App/Contents, /Frameworks, /usr/... every folder that i could imagine in the final product. What am I missing here?
Xcode 4.6 / OS X 10.8.2 / OpenFrameworks 0073
Not sure if it's the best approach but this is how I solved it:
Add to your application setup:
ofSetDataPathRoot("../Resources/data/");
Then add a Copy Files Build Phase to your Target and set the Destination to "Resources" and Subpath to "data". From now on you may drag and drop the files you need into the Build Phase and they will be included.

Why doesn't Xcode 4 create any products?

Regardless of build configuration, building my iPad app does not actually output a .app file. It does run in the iPad simulator and on a device, but when I hit build or build and run, the binary appears under Products in red and is not created in the "build" folder as designated in build settings.
Any ideas?
Xcode 4 places its build products and other intermediaries/temporary files/indexes in a derived data directory now instead of a "build" directory that is mixed in with your product files. It does this to deal with the new workspaces and also so that you can have clean builds of different projects in different workspaces without contaminating each other.
If your original template was old, your built product is probably relative to your source directory instead of relative to your built products directory, which is why it's showing up red. By default, your derived data directory will be under ~/Library/Developer/Xcode/DerivedData. To see where your current workspace/project is placing these files, you can File->Workspace Settings... and take a look at the Build Location.
I was having this problem. not only the product .app was red, also simulator wasn't loaded the binary, it was stuck in attaching 'my app'.
i solved it by going to file->project settings. in the tab 'build' changed derived data location to 'project-relative', and in advanced changed build location to 'locations specified by targets'.
with the default options it wasn't possible to run the app, i'm not sure why.
To resolve the issue in XCode 4.x go through following steps :-
Open your project in XCode.
Select .xcodeproj file in XCode project Navigator.
Select the target under the PROJECT Heading. (i.e. the top most target, this target specify your project level build settings)
Now navigate to Build Settings.
Now search for option "Per-Configuration Build Products Path" and update it's value to $(SYMROOT) .

How to exclude image files in Xcode project bundle, conditionally for Release version?

I added .png images to the Xcode project for conditional use like making screenshots of a view
However, since this is not needed for the Release version of the app, I would like to find a way to exclude them using some kind of settings for Target. I expect there can be a solution like using #if DEBUG macro for Debug compilation, which can work for lines of source code. But, in case of files included in project bundle, I am having trouble finding the answers.
In Xcode 3, there's a view above the editor that lists the files in the project. There's a checkbox on the right side of that view for each file, and you can uncheck the box to remove the file from the current target.
In Xcode 4, show the Project Navigator on the left side of the window, and show the File Inspector on the right side, in the Utilities area. When you select a file, you'll see a Target Membership area with a list of targets and checkboxes. If you want to exclude the file from a particular target, uncheck the box next to that target. Here's a picture:
This is a bit different from excluding files from only some builds of a single target. Still, I think it's the simplest mechanism to use for the situation that you describe. Simply duplicate your existing target so that you have a copy that you can use for making screenshots. Remove the extra files from your production target but leave them in the screenshot target, as described above.
A target's inputs are the same for all builds, so there's no checkbox that will do it for you.
All that really happens though is that image files like .png or whatever get added to the copy bundle resources phase. You can remove them from that phase and instead create a custom script build phase using a shell script.
It will default to printing out all the environment variables set by xcode, from there you should be able to write a script which only performs the copy when say ${BUILD_STYLE} is 'Debug'.
You probably want ${BUILD_STYLE}, ${CONTENTS_FOLDER_PATH} and ${INPUT_FILE_PATH} for starters.

Command line tool to add resources to an Xcode project

I've got an Xcode project that creates a standard application that can be branded in multiple ways and contain some custom content. At the moment I have a Resource "Resources > Tour Packages" with the custom files under this. At the moment every time I want to brand the app a different way I have to delete the old files from this resource and then manually add the new versions via the XCode UI. I can't post and image but it is here - http://img.skitch.com/20100121-xub48r6e1p857c84hdrgg25dw6.jpg).
My Question: Is there a command line tool that performs the same operation?
You'd probably be better off just creating multiple targets in your Xcode project, and associating the resources for each branded version of the app with one target.
To do this, just right-click on your target and select Duplicate. You should then remove the custom resources from the Copy bundle resources build phase. You can then add a new set of resources to the Copy bundle resources build phase that are specific to the new target. You can then build any target you like by selecting it from the Active Target popup in the Xcode toolbar or by selecting it in the Project > Set Active Target menu.
This way, you can easily build different versions of your app without having complete duplicates of all your source, difference Xcode projects etc.
Yes, the xcodeproj ruby gem allows you to add resources. https://rubygems.org/gems/xcodeproj/versions/0.28.2

Xcode Different Resources For Different Targets

I am developing an iPhone app and there will be a Full as well as a Lite version of that app. In order get both bundles from the same source code and Xcode project I added another target to the Xcode project.
Now, I want to have the Lite target copy only a subset of the resource files to the bundle. But, Xcode won't simply let me delete individual files from the "Copy Files to Bundle" build step, since I imported all my resources as folder references. I need this in order to maintain a directory structure in the resources directory.
How do I solve this problem? Any suggestions or ideas are greatly appreciated!
In the left-hand panel of Xcode, right-click on the "Groups & Files" bar at the top. Check "Target Membership".
Now you'll see a tick against every file that should be included in your current build target. Untick the ones you don't want, switch to your other target, and repeat.
Instead of manipulating the "Copy Bundle Resources" step of your target, you can right-click resource files or groups (folders), choose "Get Info," and selectively leave stuff out of your Lite build under the Targets tabs of the info window for the file(s) you selected. Doing this on a group (folder) recurses the changes, so using resource groups (folders) is a nice easy way to make separate resources collections for separate builds.

Resources