www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Recommendation for a D build system

reply =?UTF-8?B?Ikx1w61z?= Marques" <luismarques gmail.com> writes:
I have some old D code and I wanted to improve its build system: 
that code was using a .bat and shell script with dmd, manually 
listing all the .d files to be linked! Don't ask me why I didn't 
use at least a Makefile, I don't recall, this is quite old code.

What would you currently recommend to build a not very big D 
codebase?

(if you use just dmd / rdmd, to not depend on another tool, *how* 
do you use it?)

--
Luís
Jul 24 2013
next sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Wednesday, 24 July 2013 at 12:24:26 UTC, Luís Marques wrote:
 I have some old D code and I wanted to improve its build 
 system: that code was using a .bat and shell script with dmd, 
 manually listing all the .d files to be linked! Don't ask me 
 why I didn't use at least a Makefile, I don't recall, this is 
 quite old code.

 What would you currently recommend to build a not very big D 
 codebase?

 (if you use just dmd / rdmd, to not depend on another tool, 
 *how* do you use it?)

 --
 Luís

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.
Jul 24 2013
parent Jacob Carlborg <doob me.com> writes:
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
Jul 24 2013
prev sibling parent "Rob T" <alanb ucora.com> writes:
On Wednesday, 24 July 2013 at 12:24:26 UTC, Luís Marques wrote:
 I have some old D code and I wanted to improve its build 
 system: that code was using a .bat and shell script with dmd, 
 manually listing all the .d files to be linked! Don't ask me 
 why I didn't use at least a Makefile, I don't recall, this is 
 quite old code.

 What would you currently recommend to build a not very big D 
 codebase?

 (if you use just dmd / rdmd, to not depend on another tool, 
 *how* do you use it?)

 --
 Luís

This may be more than you need if your code base is very small, but this build system looks promising for medium sized and up code base. Worth a look if you plan to expand, or have mixed in C/C++ code. Bottom-up-build (bub) http://forum.dlang.org/thread/kqfvts$2ut8$1 digitalmars.com --rt
Jul 24 2013