Errors compiling DSSS

Tavi Cacina octavian.cacina at outlook.com
Fri Nov 30 00:19:37 PST 2012


On Thursday, 29 November 2012 at 20:47:49 UTC, Jacob Carlborg 
wrote:
> What's the difference compared to any other build tool. Where 
> you have to learn some kind of special syntax. This is a 
> special syntax as well, just happens to be a real language as 
> well.

In D could be quite elegant. Here a simplified sample how I think 
it could look like:

-----------------------
// Builder Library
module dlang.builder;

struct Target
{
     string output;
     string[] source;
     string[] libs;
}

alias Target Executable;

alias Target StaticLib;

struct Environment
{
     bool tests = false;
     bool verbose = false;
     string[] importDirs;
}

mixin template Builder()
{
     int main(string[] args)
     {
         // enumerate and build the targets...
     }
}

-----------------------
// build.d in project folder
#!/usr/bin/env rdmd

import dlang.builder;

// version(X) to differentiate
Environment env = {
     tests: true,
     verbose: true,
     importDirs: ["../deimos"]
}

Executable myapp = {
     output: "myapp.exe",
     source: ["app/a.d", "app/b.d"],
     libs: ["libutil"]
}

StaticLib libutil = {
     source: ["util/*.d"]
}

mixin Builder;

------------------------
invocation would be basically rdmd build.d
>./build.d --variant=release --toolset=dmd_2_060



More information about the Digitalmars-d mailing list