Build script generation.

So I’ve been working on getting Piko3D ported to Maemo5 for the Nokia N900, and one thing I need for that is a proper build script. So far, I’ve done everything for Piko3D in Visual Studio 2008 express edition.

I don’t want to maintain all changes to piko3d in a dozen different build scripts for different platforms, so I thought I’d look into build script generators, like Automake, Cmake, and Premake.

Everyone told me how Automake was old and tends to get messy, so at first I turned to CMake. I have to admit, I didn’t look far into CMake.. I looked into it, but it seems cumbersome to me somehow.

Warning: Next part expresses my personal views on the subject and should not be used for reference 😛

With CMake, you make CMakeLists.txt files for whatever you want to build. They suggest to put one of these files in every subdirectory you have in your source, and put the build rules in there. If you don’t want to create a lib from every source directory you have, Cmake quickly turns into a mess. Correct me if I’m wrong here, but if I am, the interface and documentation could be clearer 😉 And then, I found Premake! and I would have sworn to have heard angels sing 😛

Compared to whatever I read on how to do stuff in Cmake, Premake is a complete fresh spring breeze! (at least for what I was trying to do ;-)) Premake’s documentation is a bit scattered around… and It could be better… maybe I’ll do a tutorial about it… but what I did find was very pleasing to me.

First of all: Premake uses lua script for its config files. This means that yes, you can do loops, ifs, whatever floats your boat, in order to generate your buildscripts. Lua is widely used and well documented.

Second: Premake lets you put your files wherever you like. You can also put everything in one big file, or add separate premake scripts into the mix for parts you want. It’s very easy to just use a bunch-o-files to make your project, or split it up in libs and link them together.

I guess that people who are used to visual studio like myself, might find premake easier to use than others. It seems like they used a lot of terms from visual studio, like solutions, projects, configurations etc… I personally think this is a plus since I think it’s a clear structure, but I might be biased 🙂

Anywayz, there you have it. I’ve finished my premake script for piko3d, and it now generates nice and cleanly structured project files for visual studio 2k5 and 2k8. I will continue on with it and see if I can make an ubunto and maemo5 makefile next 🙂

Keep ya posted!


1 Comment »

Comment by starkos — February 4, 2010 @ 7:02 pm

Very pleased to hear that Premake is working out for you. If you get a minute, I’d love to hear your thoughts on the documentation: what areas in particular you found troublesome, and any ideas you might have to improve it. Having looked at it so long it is often hard for me to see the forest for the trees. Feel free to email me directly.

RSS feed for comments on this post. TrackBack URL

Leave a comment


Creative Commons License
This work by piko3d.net is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License
Powered by WordPress