Lua As a Build System

277 views
Skip to first unread message

Andrew Kent

unread,
May 2, 2024, 7:42:04 PM5/2/24
to lua-l
Hey all,

Slightly new to Lua and I've been lurking on the Google Group for a little bit now. 

I wanted to share this little Lua script that I created to help me out with compiling C projects. 

I created this because I get a little overwhelmed with cmake, make, and zig. So I wanted to see if I could create something that fit the way that I think/work. 

Bear in mind that this doesn't do everything that a cmake or make can do, but it gets the job done for my small little projects. 

Essentially you would create a new "step" (I was thinking of adding the ability to create build steps, but didn't need that functionality now, so the naming convention is there...) and then add your library paths, include paths, and libraries to link. 

You can change the order of the flags that are input into the command string (wasn't sure if this would be necessary or not, I see variations some times on the internet...), set a compiler (gcc is the default), and set the source c file and output file. 

I will probably slowly add in stuff if I continue down the path of C programming. Who knows. 

https://github.com/venduplicate/LuaBuild

Luiz Henrique de Figueiredo

unread,
May 2, 2024, 9:04:31 PM5/2/24
to lu...@googlegroups.com

Pierre Chapuis

unread,
May 3, 2024, 3:24:33 AM5/3/24
to lu...@googlegroups.com
There are many build tools based on Lua but in the "more complex and powerful" category https://xmake.io/ deserves a mention too. It supports many languages natively, including Zig.

-- 
Pierre Chapuis

bil til

unread,
May 3, 2024, 3:50:47 AM5/3/24
to lu...@googlegroups.com
Am Fr., 3. Mai 2024 um 01:42 Uhr schrieb Andrew Kent <andrew....@gmail.com>:
> Slightly new to Lua and I've been lurking on the Google Group for a little bit now.

VS Studio Code with Add-On "Lua programmed in Lua" by Sumneko is
strong recommendation if you look for good Lua editor. (do NOT mix up
with VS Studio compiler framework, which costs money - the "VS Studio
Code" in contrast is free...).

(if you create you own Lua libs, you can quite easily add there help
info for your lib functions including markup ascii text formatting,
then you get a sort of auto-complete and auto-help for your own libs
very straight forward).

(and if you do not see any red or yellow markings of the "inline Lua
interpreter" any more, you can be quite sure that your Lua code is
fine for first try... at least without syntax errors).
Reply all
Reply to author
Forward
0 new messages