[Rant-cafe] Library and Program Generators

Russel Winder russel at russel.org.uk
Wed Dec 13 02:35:58 EST 2006


On Fri, 2006-12-08 at 10:05 -0800, Dean Kassmann wrote:

Apologies for not replying sooner.

It seems as though building libraries is the first stop!  I have a
library I can test things against, so feel free to have me try it.

Should we also be looking at Program in parallel (there may be shared
infrastructure)?

Perhaps we actually need C::Program and Cpp::Program ?

> # 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

Is the intention to do what SCons and Waf do which is to parse the
sources and follow #include to build a dependency tree?

I'm not sure :pdb works for me.  All the other keys seem natural but
that one doesn't.

What is the distinction between :type and :runtime?

> 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

I can easily test on Ubuntu, Solaris 10 and Mac OS X.  In principle I
can test on Windoze + Cygwin and Windoze + MSYS, but it takes a lot of
pushing to subject my poor laptop to have to run Windoze :-)

> 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

I am not sure what the shared run time issue here is.

> 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.

Presumably there is a compiler look-up table for any compiler that can
generate linkable object files?  So the table should be extendable in
some way so as not to restrict to C, C++ and Fortran?  On the other hand
C, C++ and Fortran probably require different start up code so mixed
language systems could be difficult? 

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

Presumably Fortran needs a dependency checker?

I am assuming that although it is called C::Dependencies, it works just
fine for C++, It has seemed to for a C++ project of mine.

-- 
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             russel at russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://rubyforge.org/pipermail/rant-cafe/attachments/20061213/e3d34e0d/attachment.bin 


More information about the Rant-cafe mailing list