Developing with Xcode

Setting up Xcode to compile Cloudy

Note: Currently IDE features such as autocomplete and "goto declaration" do not work in Xcode when using a makefile

  1. Checkout a version of Cloudy or find the path to a version you already have. Let's assume that it is /Users/username/cloudy
  1. Open Xcode. Select New Project from the Welcome Screen or go to File, New, and then New Project on the menu bar.
  1. Choose External Build System as the template. It is under Mac OS X and Other. Click Next.
  1. Product Name can be whatever you want, I chose Cloudy and I will assume that from now on. Build Tool should point to make. Click Next.
  1. Now choose the location where you want to store the Xcode project files. I decided to separate my Cloudy source from the Xcode files. Click Next.
  1. In the left pane there should be a blue Xcode project icon called Cloudy.
  1. On the menu bar, click File and then Add files to Cloudy. Now you want to choose the Cloudy files. Based on the assumption in Step 1, I would go to /Users/username/cloudy/trunk and select all of the files and folders within. Choose not to Copy items into destination ... and Create folder references ...

Click Add.

  1. Just left of center on the screen there should be a vertical stripe with a white background. I should contain two sections Project and Targets. Below Targets there should be a target named Cloudy. Make sure it is selected and look to the right.
  1. In the right pane, select the Info tab. There should be three textboxes; Build Tool, Arguments, and Directory. Build Tool should point to make still. Arguments should be what you want Xcode to put next to make when it is called (for example Debug). Directory is where the building should occur. Click the icon to the right of the Directory textbox. Assuming that we want to compile with gcc, select the sys_gcc directory. From my assumptions, that would be /Users/username/cloudy/trunk/source/sys_gcc.
  1. If you want to use gcc to compile, click the Build Settings tab. Find GCC_VERSION. To use gcc version 4.2, replace with 4.2.
  1. Now it should be ready to build. Click Product and then Build from the menu bar or use the Command + B keyboard shortcut.
  1. Once the build finishes, click Product and Edit Scheme on the menu bar.
  1. With Run selected in the left pane of the Edit Scheme window, click the Executable drop-down list and select cloudy.exe.
  1. Click View, Debug Area, and Activate Console in the menu bar to see the output console which is where you would type commands when running Cloudy inside Xcode.

Using Instruments for Cloudy testing

Note: Testing with Instruments does not require that the code be built using Xcode

  1. Run Instruments and this should be the first screen you see.

  1. Make sure that Mac OS X is selected and choose which test you want to run. I will choose Leaks. When you have selected, click Choose.

  1. Now that Leaks has been chosen, you need to choose a target process or program to watch. Click the Choose Target dropdown.

  1. The first time through, you will need to click Choose Target two more times. That will open a dialog box which will allow you to find cloudy.exe in the file structure. Since I have used cloudy.exe before, it appears as a recent option.

  1. When you are ready to run it, click the Record button. That will cause Instruments to run cloudy.exe. It won't get very far since cloudy will stop and wait for console inputs. We will need to quickly switch to the console and enter the commands.

  1. To switch to the console, click the dropdown menu that says Statistics, then click Console.

  1. Enter the commands as you normally would, don't forget the extra Enter/Return?. Copy and paste works very well for long input files.

Return to DeveloperPages

Return to main wiki page

Last modified 8 years ago Last modified on 2011-08-15T16:19:05Z