Project generator

Greetings everyone,

Just wanted to highlight an interesting and potentially very helpful development that came out of the OF dev conference and is being actively developed right now – the OF project generator. It’s a combination of scripts we had been writing for making new project files, the _deployExamples project, etc and we’re excited to make one unified tool. It’s written in c++, which means it easier to support it, and we are working on a gui.

It’s currently in the dev apps folder of the OF develop git branch, but we are thinking to move it to a seperate repository shortly, in which case it will be a submodule of OF, so that it can have it’s own separate issues, etc.

here’s what it can do, and a list of next steps:

a) It can (and does) store a path to the base of openframeworks, so that new project can be created at different heights relative to openframeworks (ie, …/…/ instead of …/…/…/)
b) it can make new projects with the right paths and names, and if you choose addons to add, it will add them.
c) it scans addons using file system, looking for things like folders that say “libs”, “src” etc.
d) it can generate a new project file for an existing folder, by recursively scanning the src folder, and looking for an addons.make file (currently used in linux, but will know be used across all platforms) for any addons to make.
e) it has a feature now which can generate all the project files the example folder (right now, it’s a key press option “m”)
f) it makes folders in the project files well, and can add include paths, etc. on xcode this isn’t a big deal because of drag and drop, but on other platforms, this is a huge help.

how it works – it currently uses pugi xml for parsing the xml of project files. Xcode project files are typically plists, but we can (and do) use a utility called plutil to convert those files to xml. pugixml has really good xpath parsing, so it’s possible to do complicated and gnarly requests, which the xcode project generator is full of :slight_smile:

here’s some issues we are working with now:

a) there’s no IOS support – the previous app, deploy examples could make the IOS examples
b) the platform is auto detected, but needs some options for choosing.
c) there’s no checking of the root of OF – easy to choose the wrong root.
d) there’s no windows versions of this project generator yet (ie, we need to have projectGenerator.cbp, etc).
e) the windows versions needs some love – right now, there’s a fair amount of / vs \ issues, as well as some lack of features such as doing the right thing for non …/…/…/ paths, etc.
f) the xcode project generator needs some serious commenting – it’s bonkers crazy! we’ve done it using xml parsing rather then loading the plists to keep it cross platform, but it is some monster voodoo there. having it better commented will help alot.

At any rate, I thought I’d kick off a forum thread, and as we develop it, use this as a place to update about its progress, etc.

also, since system should allow you to use and add any addon to your project, it’s clear we will learn alot of things about how to better structure addons. there are some per platform things to consider (ie, how to specify link order, and add per compiler flags, etc). hopefully having this tool will help standardize the process and address two of the most basic questions people have with OF: how to make a new project and how to add addons.

(your new best friend, hopefully!)

  • zach

This is great work! Something sorely needed. As much as the collection of scripts was really helpful to more advanced devs, it was hard to seriously recommend it to beginners or OF noobs, so I’m really excited to see this going forward. The include paths is a big deal for code::blocks/VS. I’m in the process of getting re-acquainted with VS10, so I’ll check out what’s in the git repo and see if I can be helpful.

This is super fantastic, and will make teaching OF much easier cross-platform.

I’m having a little trouble though with the project generator for the existing examples part. It seems to have an issue with the addons part, and crashes on 3d/modelNoiseExample which is the first one to have an addon.make file. I’ve been stepping through the code, and it crashes in the for loop of ofAddon::fromFS. I’ve put a breakpoint at line 39, and it doesn’t get there.

I’m OSX 10.7.3 with the github development version from about 2 days ago.


It will print out “include path: …/…/…//addons/ofxAssimpModelLoader/libs” then it seems like the recursive call on line 639 of Xcode::includeAddon runs out of memory after 11xxx calls.

Hey there

Today I needed to deploy examples on a win_cb machine and went looking for a code:blocks or vs project file for the actual projects generator…

…not finding them I (perhaps stupidly) fixed the old pull/1121

Looking deeper I can see you guys are working on both CB and VS code for the project generator.

Could you check in the CB and VS projects you are using to test that code? Or should I just make my own? Figured it would be better to contribute using the same project files…



In response to this tweet ( ) about generating cross platform OF projects, I’m posting in this initial Project Generator topic.

Problem: I’ve been using OpenFrameworks for about 6 months now and I’ve come trough many examples and open source OpenFrameworks projects. Most of them compile on Mac, but some are for Windows or Linux; which takes a few minutes to get it to compile. In another case; a friend of mine is on PC and has to manually convert almost every open source project he gets.

Why don’t let it make any Mac / Win / Linux project compatible with all platforms.
This would make it very easy to compile any OF project.

I just downloaded OF 0.8.1 with both the Simple Project Generator and the (new for me) full one.
First, I thought this update fixed this issue, but nope.
It’s OK now when you generate a new project; but not when you update one.
It would be great to allow people to update any OF project so it compiles on any platform.

Edit: So the main question is: Should projects be converted to their own platform by each user or should all project be cross-compiling by default ?

I’m working on a 2.0 version of the project generator that should allow for cross platform updates of an existing project. At the moment, if you want to do this, you can use the project generator that comes in the OF repo (in dev apps) which we use to generate the examples. the repo contains all the relevant templates as well for this.

1 Like

Ok, sounds great! :smile:
I found the full project generator and it works fine to make any project compatible with XCode! :smiley:

This application works great for me on OSX (xCode), but when I switch to a PC I have running the code::blocks version of the project generator in Windows Vista, the generator crashes when trying to change addons. Is there an easy way to fix that?

I believe that OF is no longer maintained for code::blocks…

Hi !

I have developed also one project generator, but currently it aims to target only for Windows & C++.
You can check documentation from here:

And source code from here:

Based on C#, and C# scripting.