[Rant-cafe] Library and Program Generators

Dean Kassmann deankassmann at gmail.com
Fri Dec 8 13:05:16 EST 2006


I'm working on a c++/c/fortran library generator for rant

The syntax looks something like this:

# beginning of Rantfile

# This is a prototype Rantfile for library to generate discussion
regarding syntax and features

import 'md5'
import 'library'

# some custom configuration
var :build_dir => "build"

# use the library generator to create a static library:

libd = gen Library, "myfoo",
                       :sources => sys["source/**/*.cpp"],
                       :builddir => "#{var :build_dir}/debug",
                       :pdb => "myfoo",
                       :type => 'static',
                       :debug => true,
                       :runtime => 'shared'
                       :multithreaded => true

desc "build static library "
task :debug => libd.path

# end of Rantfile

This will create a _static_ library called "test". On Windows it will create:
./build/libmyfoo.lib
On Linux/OSX/ etc it will create
./build/myfoo.a

If I had specified :type => 'dynamic' instead the generator would
create the following on Windows:
../build/myfoo.lib
./build/myfoo.dll
and on linux we'd have
./build/myfoo.so

It will enable debugging, and use a shared version of the cpp/c
runtime libraries and support multi-threaded operation

The idea is that sources can be any mixture of c, cpp, and fortran
files. The generator will use the appropriate compiler for each file
and take care of creating either .obj or .o files for the given
platform in the specified build directory. It will then link the the
files into the appropriately named executable.

The generator will use C::Dependencies generator plus the
DirectedRule, and Rule tasks, internally.

Any thoughts?

Oh and very similar syntax will exist for a Program generator that
produces .exe's on Windows etc.


More information about the Rant-cafe mailing list