Recommendation for a D build system

Jacob Carlborg doob at me.com
Wed Jul 24 07:07:49 PDT 2013


On 2013-07-24 14:34, Dicebot wrote:

> If code amount is relatively small (and building does not involve
> calling any external tools), I'd stick with rdmd.
> `rdmd --build-only <any dmd flags here> main.d` and let it figure out
> all imports.

I use rdmd as well. I'm using two shell script, one to build the 
application and one to run it. Looking something like this:

#!/bin/sh

## Choose the compiler to use, if DVM is available
if [ -s "$HOME/.dvm/scripts/dvm" ] ; then
     . "$HOME/.dvm/scripts/dvm" ;
     dvm use 2.063.2
fi

## Compile the file containing the main function, in this case main.d
rdmd --build-only -ofbin/main "$@" main.d

And then the script for running:

#!/bin/sh

# Build the application
./build.sh

# Run the application if the build succeeded
if [ "$?" = 0 ] ; then
   ./bin/main "$@"
fi

The "$@" allows to pass in arguments to the compiler when building and 
arguments to the application when running.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list