CMake works! Simple usability - CLion support

Dear OpenFrameworks Developers!
I am happy to announce, that a working beta CMake build system is created for Openframeworks. It allows e.g. CLion usage and export into other IDEs. For now, it only works on Mac OSX, but other OS are in the development.

The approach is, to have a very simple project file (CMakeLists.txt), in which you just have to set your source code files and active addOns (and if you want, AppName). The CMake code is modular and optimised for readability. So extending it, should be easy. For non experts / normal OF users, the large code is hidden.

At the moment, the approach is to have CMake not being intertwined into the OF file structure. This makes it easy to install it, delete it and also update OF, without much work. The down side is, that the addOns are also centralised in the CMake folder. It would be better to have the addOn CMake files in the addOn folder itself. But this requires that the addOn developers write them (or we do it for them) or they have to be copied into the folders. I included examples and templetes for creating new addOn cofigurations.

I would be glad if you try it out. Either command line, QTCreator or CLion.
Useful would be:

  • Feedback on usability
  • Testing (addOn examples do work)
  • Collaboration (especially for other OS – Win, Linux etc.)
  • Creation of external addOn files

Hope you find it useful!

Peter

2 Likes

Nice !

Does it support cotire ? and static linking ?

Nice work!
I can contribute a linux-cmake file, if you like. I took more or less the same approach: a ‘global’ file under /of/cmake, and a (fairly) simple file for the project.
Only real difference I can see is that I generate the necessary includes for addons (based on addons.make) - they don’t need their own CMakeLists.txt

I like the idea to use main of code structure, it is really easy to add it to openframeworks as a submodule for example.
After a quick try on Linux, it doesn’t seem to work out of the box.

Yes, that would be great! I only use the ResperryPi as my Linux system, so every real help would speed up the development.
I worked on some code for Linux yesterday. Have a look at it!

@avilleret: Linux is not tested yet! MacOS works

I have a working template for Clion on Windows
Clion-Windows