CMake Lua


For anybody who accidentally stumbles on this, we're trying to organize a continuation of a CMake/Lua experiment. Dr. Ken Martin of Kitware recently decided to try embedding 

Lua in CMake.

For those who don't know, CMake is a 'build system generator' or 

'meta-build system'. You provide a build description in a simple script like language and CMake generates a (native) project that you request. Among the project types CMake can generate are Visual Studio, GNU Makefiles, Xcode, KDevelop, and more. This allows developers to have one single unified build description, but yet allow people to use their favorite IDEs and build systems. For anybody who is serious about cross-platform development, CMake is a must-look-at.

While CMake's build generation system is currently unmatched, the home-grown description language leaves much to be desired. For simple/trivial build systems, the language is adequate, but for complex things, the language can be painful. There are also strange bugs and quirks in the language that make it even more painful. 

While trying to advocate the use of CMake to people, the number one obstacle has been the language. The primary audience of CMake tends to be people who use C influenced languages/syntax so CMake syntax is a system shock as it bares little resemblance.

The idea of embedding a 'real' language in CMake has appeared multiple times on the CMake mailing list. There is great division on the merits of doing this.

So recently, the topic came up again. As expected, the language wars materialized, though this discussion did manage to stay surprisingly civil. I've been advocating Lua. For those who don't know, Lua is a higher-level language that is designed for embedding. It is extremely popular in the game industry and has been used in such games as The Curse of Monkey Island, FarCry, and World of Warcraft. It is small, lightweight, fast, and simple to pick up (yet amazingly powerful). Since Lua is designed for embedding, Lua seems like the best candidate to integrate in with the existing CMake C++ code base.

It appears that our arguments that Lua would be best for this task were apparently persuasive. It seems that Dr. Martin wanted to establish how possible/feasible embedding a second language into CMake would be. So he actually tried it and released the source of a simple proof of concept working prototype.

Dr. Martin said, It was very easy to add Lua to CMake which is nice (literally it was probably 15 hours of effort). Part of this experiment was to see if it was even programtically practical to add a second language. It turns out it is.

Unfortunately, at this time, it sounds like there are no plans to continue this experiment.

So rather than let this fade into oblivion, I have taken the code and put it into a Mercurial repository hoping that work can continue. Using a tool called Tailor, I can create a bridge between CMake's official CVS and a Mercurial repository so changes/enhancements can be made to the CMake Lua experiment, while still being able to keep up to date (merge) with official CMake changes. (This is what distributed repositories excel at.)

So a few of us like minded individuals who would like to see Lua and CMake together have started organizing. It's unclear whether we will be able to take this beyond the original little experiment (we're still looking for some heroes). So if you would like to participate (lead), please join us at the CMakeLua repository hosted at Assembla (and the Google Group we setup to act as a mailing list).

Copyright © PlayControl Software, LLC / Eric Wing