If you want to use Xcode to work on Drizzle, these are the steps you need to take to setup a project. Note that Xcode doesn't support Bazaar so you still need to do some things from the command line. (Come on, Apple. CVS and Subversion just plain suck)
These instructions assume that the Drizzle repo is located in $drizzle-repo, as described here in the Drizzle wiki.
First, we need to create a new branch (we'll call it xcode-branch) of Drizzle trunk to use for our yet to be created Xcode project.
bzr branch trunk xcode-branch
Next, we'll go into Xcode and create a new project. Choose the External Build System project. With this type of project, we'll be able to click on Build to run make for us.
After saving, your project window should appear. At this point, we have no source code files in our project, so we need to tell Xcode to use our xcode-branch as the location of our source. We do that by right-clicking on our project name in the Groups & Files section of the project window and selecting Add -> Existing Files...
Navigate to your xcode-branch directory, select the directory, and click the Add button. In the window that appears, make sure that Copy items into destination group's folder option is NOT selected. We don't want to copy the source files into the Xcode project directory, we want to use them from within the Bazaar branch. We do this so that after we make changes with Xcode, we can easily open a Terminal window and commit our changes from the command line. (Again, this is because Xcode does not have Bazaar direct integration.) Also, make sure that Recursively create groups for any added folders is selected. So you should have:
Click Add and a folder for your xcode-branch should appear under your project name in the Groups & Files section.
So what have we just done? We basically did two things here:
- Created a Bazaar branch for our modifications we will make under Xcode
- Created an Xcode project that points to our Bazaar branch.
Our working Xcode project is split up into two separate directories: one for the Xcode project files, and one for the Bazaar source files. This may seem a bit odd if you expected everything to be under a single directory, but we have to do it this way so that we can still use Bazaar commands.
There is one last thing to do now. Xcode is now setup to automatically just call 'make' when we click on our Build button, but it will attempt to run 'make' in the Xcode project directory, not in our xcode-branch directory. This is an easy fix. Double-click on the target underneath Targets in the Groups & Files section of the project window. This will open up the following window:
Set the Directory under Custom Build Command to the location of your xcode-branch. Once you do this, then clicking Build will run 'make' from within the xcode-branch.
That's it! You can now edit the source, use Xcode features to jump to various definitions, search project files, and build the project using Command-B or the Build menu option. Obviously, you'll first have to create and run the configure script in your xcode-branch directory by hand before you can build. And you will not be able to use the other build commands, like Build and Run, or use the debugger until you setup an executable for the project. I'll cover that in a future post.