After months of experimenting with media frameworks in various languages I’ve decided to dive further into Cinder. It offers excellent functionality out of the box and has a great community of developers working with it. You can download and install Cinder and be running the demo apps in no time. There are very few, external dependencies and each demo compiles and runs, even on my slightly older laptop, without issue. It is almost magical in comparison to many dependency heavy media frameworks out there.
As a first step in understanding the structure of Xcode/Cinder projects and the dev environment itself, I thought it would be convenient to create an Xcode style project template for a basic Cinder app. After a couple of hours of digging through existing project template files I hacked together a basic app template that operates in an identical way to the built in Xcode projects.
The template builds a basic Cinder project that is very similar to those in the samples directory. It includes a main .cpp file named after the project with stub methods for setup, mouse down, resize and draw methods. It also embeds an application icon. As soon as a project is built it can be compiled and run.
Installing the template is pretty straightforward. You need to make at least one change to configure the location of the Cinder libs on your machine.
- Download the template
- Unzip and copy the Cinder Projects directory to /Users/YOUR_USERNAME/Library/Application Support/Developer/Shared/Xcode/Project Templates.
- From the Cinder Projects directory navigate to Cinder Project/Basic Cinder App/.
- Cntrl+click the file called ___PROJECTNAME___.xcodeproj and choose Show Package Contents.
- Open the file called project.pbxproj with a text editor.
- Search for the text YOUR_PATH_TO_CINDER_HERE and replace it with an absolute path to the location of Cinder on you machine. Be sure not to include a trailing slash on the path.
- Save and close the file.
- Open Xcode and choose File » New Project
You should now see a listing under User Templates for Cinder Projects. From there you just choose the Basic Cinder App option and a location for your new project.
One thing to note here is that, as previously mentioned, I’m on an older laptop. Some of the settings in the template might not be compatible with your system. Correcting this is quite easy. Whereas in the install instructions you edited the project.pbxproj file to change the path to Cinder, you can also open the ___PROJECTNAME___.xcodeproj with Xcode and edit the project settings by going to Project » Edit Project Settings and changing the configuration. Once you have set this up, just close the project.
When the project template file is opened, Xcode will also auto generate a few files. These can optionally be deleted. You can navigate to the project templates dir and delete the build folder. Using the Show Package Contents step from the install instructions, you will see that two new files have been created. On my system they are preceded by my username. The two files can also be deleted.
Once the configuration is complete you should not have to change these settings again.
If this is not working for you, leave a comment and hopefully me or another reader can guide the way.
I’m looking forward to writing more articles about c++ and Cinder… did I mention that Cinder has an audio synthesis API…