views:

322

answers:

1

hi. i have a very basic question. i've never worked in XCode before but i am designing a plugin (objective-c) for an open source radiology program called OsiriX. i can get the thing to compile fun and i can even get the plugin to run in OsiriX. but i'm not sure how to run/debug it from XCode. Run/Debug is grayed out on my xcode. is it because there's no main program? i'm confused. please help. thanks!

-chris

+4  A: 

(1) "Clean all" your projects so that there isn't detritus left around when you do this.

(2) Set Xcode to use a common build products directory (I stick mine in /tmp/ so that it periodically gets nuked). The preference is under the "Building" section.

(3) Re-build OsiriX (so that it'll be built in the shared location).

(4) Make sure the active configuration in your plug-in project has the exact same name as the configuration in OsiriX that you built in (3). (It should probably be "Debug" or "Release", depending on which you build). The configurations can be edited in the build settings editor.

(5) Build your plug-in.

(6) Add a custom executable to your plug-in project and set the path to OsiriX (Project -> New Custom Executable...).

You should now be able to build-and-run or build-and-debug your project. It will launch OsiriX from the build products directory. You might also want to set OsiriX to look for bundles in your build products directory, if it doesn't already. Or you could create a symbolic link from one of OsiriX's plug-in directories to the bundle in your build products directory.

cd /path/to/OsiriX's/bundle/directory
ln -s /path/to/build/products/YourPlugin.bundle

This is a very standard way of ocnfiguring Xcode for development of plug-ins. For example, preference pane developers will set up a custom executable for SystemPreferences.app (even in /Applications -- there is no need to point to a "debug" build of the application).

bbum