Thursday 30 December 2010

Why did Cmake was choosen for this project?


Cmake, an advanced building utility, allows to generate Anim-it's makefiles easily. These makefiles are used to compile the project from source code to binary executable code.

But this is not the only feature Cmake have. This tool can generate lots of project files for lots of EDIs (such like CodeBlocks, Visual Studio, and many others...)
This is a really nice advantage : the Anim-it project is supposed to be a quite big one, so it may be useful to have the ability to generate project files for several OS and development softwares. Currently the only one developer is using Linux, but in the future it could be an other one which needs the project to run on Windows for example. In that way it is possible to generate a Visual Studio project file. In addition, Cmake provides a dynamic way to add libraries, with the module system : modules can find a library checking where they commonly are located on each operating system. In this way, you don't have to configure the project depending on your operating system for linking and compiling. You don't waste time and efforts making your project compile on Linux, MacOS or Windows.

Cmake also provides various utilities, for adding all files that are in one directory (even if you add files after!), checking libraries versions, display warning and errors while looking for libraries and many others...

One example of handy utility for that project was the ability to generate Qt MOC files : when you are using Qt (it is currently the case for this project), you need to execute a command to generate some kind of files before compiling. On Codeblocks, all the explainations found on the Internet were quite unclear and it was not handy at all to setup the automatic launch of the command before compiling. With Cmake, even if it seems more complicated at the beginning, once done, it works well and it is possible to add files to MOC really simply.

One last great advantage for that project : because Cmake can generate makefiles, all the compiling process could be done in one command line, that never change (basically something like "cmake . && make" on Linux based OS). In that way you can setup any text editor as your EDI. For example, Geany, a text editor, was setted up like that for that project : once Geany's build commands changed, the compile button can compile the whole project with all its files and libraries!

No comments:

Post a Comment