On Feb 16, 2006, at 11:10 AM, Jim Wrenholt wrote:
On Feb 16, 2006, at 8:39 AM, Daniel Jalkut wrote: Now coming from the Windows Visual C world, I first thought I'd be better off making a project for each of these things and then somehow linking them together so that when I build App, it builds the others as well. Well this just didn't work. If I changed a source file in the statlib project, it wouldn't compile the dynamic lib or App.
Question one is - Can it be done this way, and is it the best way to do a project like this? Question two - is there any sort of 'Solution' concept in XCode like there is in Visual C?
Yes it can be done this way. I don't know what solutions are entirely but it sounds like what you're getting at is that Visual C lets you have "uber-projects" that contain other projects. I think the difference with Xcode is that any project can behave in this fashion - you just have to add other projects to it.
you might want to also investigate Frameworks.
and Bundles
The project that I'm working with now has two different types of applications that it builds. The first is The main app the second app is the Unit Testing app. By using different targets and specifiing what files get compiled into it you can have essentially different projects. In thinking of the VS way of having a solution and projects I'd say Xcodes way is you have the project which is going to be equivalent to VS's solution. The Targets in Xcode are then equivalent to the projects in VS.
The files listed under the Project mean nothing to the project until you add a target to use them. It' more of a browser of files added to the project. When you add that target you then give xcode something to do with them.
Heres a sample of my project Tree
Project | |--engine | |--engine files | |--unit test classes |-- mac files |-- windows files | |-- Targets |--App |--Unit Testing App
So for in the above example I have files that belong to the unit test app, the main app, files specific to the mac and files specific to windows. The windows files are not part of either target they are there so i can edit them if needed. In the engine folder there is a main file that merges the mac and win mains together and has the common main code. This main is not part of the unit test app. In the unit test folder is another main that does the same thing but geared towards the unit test app.
So lets go a step further and say I wanted to create some frameworks from the engine I'd add a new target that is a framework and add the files that it needs to compile and set up any of it's build settings that I wanted it to have. I'd then need to go into the main app and remove the framework files from being compiled into it and then add the framework to the main app target.
So when coming from VS think of the Xcode project as the solution in VS and the Xcode targets as the projects in VS.
A thing to note I'm sure you've seen the little target icon with the checkboxes below it. These specify whether the file is part of the ACTIVE target if you remove the check mark or add one then the file will be compiled or not compiled into the project. So this is one way to make sure a file is added or not added and to add or remove it from the active target. There is also the drag it down to the target build phase as well and probably a few others as well.
Hope this doesn't make any one more confused than they are.
|