Discovering SCons

I was looking for alternative – alternative to what? make, autotools, CMake – software building tools for C++ and I discovered an interesting project I didn’t know about: SCons.

Everybody knows about SCons.

SCons is a software construction tool that lets you write SConstruct files (the SCons makefile counterpart) in a very concise (with respect to classic Makefiles) and powerful way. But the greatest part of it is that you can write Python code inside your SConstruct files!

Imagine you could write a line like this inside your Makefile:

src_files = [src_dir + name for name in src_files]

I think this is enough to decide it could be worth trying it!

Following the SCons User Guide I managed to create a SConstruct file to replace my Makefile in a subdirectory of an existing project in a very short time. And it worked really well.

I had a bit of disappointment when I decided it was time to choose where to put object files, libraries and executables. This is how this must be done in SCons: Separating Source and Build Directories.

Initially I couldn’t believe it had to be so cumbersome, but I had some confirmations:

Anyway, the world is not a perfect place.

Nice to meet you, SCons.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s