SCons support for D

Russel Winder russel at russel.org.uk
Wed Dec 7 10:02:06 PST 2011


On Wed, 2011-12-07 at 14:38 +0100, Jacob Carlborg wrote:
[...]
> Example:
> 
> $ tool build main.d
> 
> That's all that should be needed to build an executable. You could have 
> the same in a build script:
> 
> // buildfile
> main.d
> 
> $ tool build

Currently with SCons, you type:

$ scons

and the default activity occurs.  With the SConstruct file:

	Program ( "main.d" )

the result is the construction of the executable, ready for execution.

If there is to be a D specific build tool then I would suggest that
there has to be even less work than using SCons for it to be appealing.
So my current "straw man" use case would be that there is no
configuration file at all just a naming convention and a default target
so that:

$ tool

infers the project structure and compiles the executable -- i.e.
something along the lines of what Go is doing since it eschewed Make as
the standard build tool.

> For a library it should be similar:
> 
> $ tool build foo
> 
> Where "foo" is a directory. I don't know if that's possible to have in a 
> build tool not specifically developed for D.

With SCons you specify the list of object files that comprise the
archive or the shared object depending on whether it is a static library
or a shared library.  The list is generally constructed
programmatically, so for example, something akin to:

	contributors = Glob ( '*.d' )
	Library ( 'flob' , contributors )
	SharedLibrary ( 'flob' , contributors )

I am sure a convention could make this such that no specification would
be needed.  If we could come up with a executable and library project
convention it could be encoded in the SCons dmd tool so it can improve
and continue to act as a straw man against which arguments can be made.
 

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111207/10b27970/attachment-0001.pgp>


More information about the Digitalmars-d mailing list