I've found a couple of questions about embedding Ruby in a C++ app. Almost all of the top-voted answers suggest using Lua instead.
Given that a project I have in mind would be better served by the grammar already expressed in Rake (it's a rules engine), is there any easy way to embed Rake in a C++ app, or is there a Rake-like module for Lua?
To clarify: I want this to be a self-contained app, if possible. It should have minimal pre-requisites, because it'll be running on a fairly bare-boned (Windows) OS.
There are a number of build systems that can use Lua, based strongly on Lua or even implemented in Lua. Some of them are listed at the Lua User's Wiki.
Of the ones listed at the wiki, Bou was explicitly inspired by Rake. Its author observed that the name "lake" was already in use for another build system at the time the project was started, but didn't provide a link so I have no clue what that one might have been related to. Since that time, Bou has been renamed to Lake and moved to a new home.
Lake is the creation of a regular contributor to the Lua community, steve donovan. As Bou was, it is implemented in nearly pure Lua (it does depend on LuaFileSystem for file system access). Rather than acting as a filter to create Makefile or IDE project files, it drives the compilers directly based on project descriptions written in Lua. Build projects are described in a DSL (domain specific language) that includes access to all of Lua for handling special cases.
The "official" binary releases of Lua all come from a system called tecmake originated at Tecgraf like Lua itself. Tecmake is implemented on top of make, via a wrapping shell script and a common set of Makefile rules implementing its conventions. It works well for them, but personally I've never been able to get it to run on my system. There is work in progress towards moving the LuaBinaries builds away from the quirks of techmake.
LuaRocks uses Lua to describe build requirements, is written almost entirely in Lua, and is intended to be integrated with a distributed application so that applications can be self-updating. As I understand it, one of the goals of LuaRocks is to enable project building to use their platform-independent "rock" files, and using LuaRocks to build a personal project would certainly make it easier to publish it for wider distribution later.
And as a fallback, it is always possible to use Lua as yet another tool for extending a makefile-driven build. I've used it this way for preprocessing tasks that I might otherwise have delegated to awk or perl, such as collecting details from the current fossil revision into my built project.
Update:
And as time passes, knowledge improves. As observed by Victor T in a comment, Steve's Lake is actually the same project that was named Bou. Apparently whatever objections to the name "Lake" had faded, and I simply didn't notice that they were one and the same tool. I've edited the original answer and its update to better reflect my current understanding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With