Re: adding an OS X target to an iPhone project
Re: adding an OS X target to an iPhone project
- Subject: Re: adding an OS X target to an iPhone project
- From: James Bucanek <email@hidden>
- Date: Thu, 10 Dec 2009 09:08:01 -0700
Roland King <mailto:email@hidden> wrote (Thursday, December 10,
2009 11:48 PM +0800):
Should I even be really doing this? Is trying to add an OSX app to the same
project as an iPhone one just asking for pain and misery because there is
basic configuration information baked in which says 'this is an iPhone app' or
'this is a Cocoa app'? I could just make a brand new project, keep the few
common files in a single directory and reference them without copying, but I
always thought it should/would/could be easy to add nicely totally independent
targets and executables to the same project and have one nice codebase you
just compile different targets with.
I would suggest that these should be two projects. There are
scores of build settings and other aspects of an iPhone and Mac
OS X project that are fundamentally different. Trying to mix
them in the same project seems like a recipe for disaster--which
you've already discovered.
Here's how I'd do it:
1) Create a second Mac OS X project. Close it.
2) Move the project document from the new OS X project folder
(and any other source files) into the project folder of your
iPhone project.
You now have two (!) project documents sharing the same project
folder. This has a number of advantages:
- They can share the same source files, and all source files are
contained in the project folder.
- They can/will share the same build folder so you can reference
target products from one project in the other.
- Each has a completely independent set of build settings,
configurations, and active target settings.
- You can add one project to the other project as a source item.
Once you do that, you can make cross-project target dependencies
so that targets in on project automatically build targets in the
other project.
The only things you really have to worry about are:
- Be careful of conflicting product names. Two products with the
same name sharing the same build folder will overwrite each
other. I'm not sure about module names, but it's worth checking
out. You might need to do some fiddling with the build settings
so that intermediate files for one project are written to a
(slightly) different location in the build folder.
- If there are two or more project documents a the project
folder, you must explicitly tell the xcodebuild tool which
project document to build.
James Bucanek
____________________________________________________________________
Author of Beginning Xcode ISBN: 047175479X
<http://www.beginningxcode.com/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden