2

Creating a new plugin project in Xcode

For the newbies among our fellow readers, here is a complete step by step walkthrough for creating a new plugin project in Apple Xcode. The screenshots show Xcode 4.5, but it works the same in any version of Xcode 4.

You start with just the standard folder structure, containing a “res” folder with your symbols, icons, and string tables, and a “source” folder, containing your C++ Sources (subfolders are – of course – possible).

Take a look into the “cinema4dsdk” folder and locate the Xcode project.

Copy & paste the project into your plugin’s folder.

Rename the project as you wish, using the title of your plugin might be a good idea.

Open the project in Xcode. Select all the SDK files that are under the “source” folder on the left side of the window…

…and remove them by pressing the “Del” key. In the dialog that pops up, click “Remove Reference” and not “Move to Trash”.

Drag & drop your source files (including subfolders) from the Finder into the “source” folder in your project.

A dialog pops up. Don’t change any settings, just click the “Finish” button. Your project now contains all the sources, and even resembles the original folder structure.

Select the project (on the top of the source/_libs/Products tree), then select the project in the second column (do not select the target “cinema4dsdk”! [1]), then search for “product name” in the Build Settings.

Change the product name. This will determine the filename of the plugin binary.
Don’t worry about the filename under the “Products” folder on the left side not adapting to the new product name, that seems to be a bug that has been in Xcode since ages.

Click on the Scheme Selector on top of the Xcode window, just right beneath the Run and Stop buttons. Make sure you click on the left half of the Scheme Selector. From the menu that pops up, choose “Manage Schemes…”.

In the scheme list, select the “cinema4dsdk” scheme.

Double-click on “cinema4dsdk” and change the name to something else. Once again, using your plugin’s title would be a good idea.
Then, click “OK”.

In the Scheme Selector, make sure that the entry with your plugin’s name is selected, as well as the “My Mac 64-bit” entry.

We’re not done renaming stuff yet. Double-click on the target “cinema4dsdk” and change the name to – you guessed it – your plugin’s name.

If there are any additional include directories where you have stored header files, you must add them to the project’s header search paths. Select the project from the center column (do not select the target “cinema4dsdk”!), then search for “header search” in the Build Settings. Double-click on the entry “Header Search Paths” to edit them.

A list dialog will pop up. To add a header search path, click the “+” button, and enter the path into the new list item (you can use absolute paths, or paths relative to the project location). If you also want subfolders to be searched for header files, choose “recursive” from the little selector on the right.

That should be it. Close the Xcode window to save the project (as there is no “Save Project” menu option in Xcode).

Footnotes

[1]If you want to change build settings for your project, always select the project in the center column and not any of the targets. If you select the project, your changes will apply to the whole project including all targets. If you select a target, the changed setting will only apply to this specific target.

Avatar

Frank Willeke

worked with computers since more than 20 years | got hooked on computer graphics back on the AMIGA | started programming at the age of 13 | relesed some successful plugins for cinema 4d | started working for maxon computer gmbh in 2009 | now contributing to cinema 4d as a senior developer making electronic music since 1993 | playing the electric guitar since 1995 age of 14 | first live gigs in 1997 | playing the bass guitar 2005 | playing keyboards and synths since 2012 experimenting with photography since 2003

2 Comments

  1. For the life of me I can’t get this to work. I keep getting compline errors that Xcode can’t find c4d.h:

    “Lexical or Preprocessor Issue: ‘c4d.h’ file not found”

    Everything compiles fine in the example folder, but not when I move it into a new folder. Any thoughts?

  2. Hi Rich,
    please come over to the PluginCafe forums, so we can properly support you. Though we appreciate every comment in here, we’d like to keep discussions and problem solving in the PluginCafe forums.

Comments are closed.