www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - DUB build questions

reply "uri" <uri.grill gmail.com> writes:
Hi All,

I'm very happy with CMakeD but thought I'd try dub because CMake 
script is a PITA. So I have a couple of questions.

a) Can dub do out out of source builds and how would I set that 
up.

b) Can I do parallel builds with dub. CMake gives me Makefiles so 
I can make -j does dub have a similar option?


I looked around on the DUB registry website but couldn't find any 
info.

Thanks,
uri
Dec 19 2014
parent reply Rikki Cattermole <alphaglosined gmail.com> writes:
On 20/12/2014 11:14 a.m., uri wrote:
 Hi All,

 I'm very happy with CMakeD but thought I'd try dub because CMake script
 is a PITA. So I have a couple of questions.

 a) Can dub do out out of source builds and how would I set that up.
There is e.g. preBuildCommands.
 b) Can I do parallel builds with dub. CMake gives me Makefiles so I can
 make -j does dub have a similar option?
No
 I looked around on the DUB registry website but couldn't find any info.

 Thanks,
 uri
Dec 19 2014
next sibling parent "uri" <uri.grill gmail.com> writes:
On Saturday, 20 December 2014 at 04:15:00 UTC, Rikki Cattermole 
wrote:
 On 20/12/2014 11:14 a.m., uri wrote:
 Hi All,

 I'm very happy with CMakeD but thought I'd try dub because 
 CMake script
 is a PITA. So I have a couple of questions.

 a) Can dub do out out of source builds and how would I set 
 that up.
There is e.g. preBuildCommands.
 b) Can I do parallel builds with dub. CMake gives me Makefiles 
 so I can
 make -j does dub have a similar option?
No
 I looked around on the DUB registry website but couldn't find 
 any info.

 Thanks,
 uri
OK thanks.
Dec 19 2014
prev sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Saturday, 20 December 2014 at 04:15:00 UTC, Rikki Cattermole 
wrote:
 b) Can I do parallel builds with dub. CMake gives me Makefiles 
 so I can
 make -j does dub have a similar option?
No
Worth noting that it is not actually a dub problem as much, it is simply not worth adding parallel builds because separate compilation is much much slower with existing D front-end implementation and even doing it in parallel is sub-optimal compared to "dump-it-all-at-once".
Dec 19 2014
parent reply Russel Winder via Digitalmars-d-learn <digitalmars-d-learn puremagic.com> writes:
On Sat, 2014-12-20 at 05:46 +0000, Dicebot via Digitalmars-d-learn wrote:
 On Saturday, 20 December 2014 at 04:15:00 UTC, Rikki Cattermole 
 wrote:
 b) Can I do parallel builds with dub. CMake gives me Makefiles 
 so I can
 make -j does dub have a similar option?
No
Worth noting that it is not actually a dub problem as much, it is simply not worth adding parallel builds because separate compilation is much much slower with existing D front-end implementation and even doing it in parallel is sub-optimal compared to "dump-it-all-at-once".
From previous rounds of this sort of question (for the SCons D 
tooling), the consensus of the community appeared to be that the only time separate module compilation was really useful was for mixed D, C, C++, Fortran systems. For pure D systems, single call of the compiler is deemed far better than traditional C, C++, Fortran compilation strategy. This means the whole "make -j" thing is not an issue, it just means that Dub is only really dealing with the "all D" situation. The corollary to this is that DMD, LDC and GDC really need to make use of all parallelism they can, which I suspect is more or less none. Chapel has also gone the "compile all modules with a single compiler call" strategy as this enables global optimization from source to executable. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.net 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Dec 20 2014
parent reply "uri" <uri.grill gmail.com> writes:
On Saturday, 20 December 2014 at 08:36:15 UTC, Russel Winder via 
Digitalmars-d-learn wrote:
 On Sat, 2014-12-20 at 05:46 +0000, Dicebot via 
 Digitalmars-d-learn wrote:
 On Saturday, 20 December 2014 at 04:15:00 UTC, Rikki 
 Cattermole wrote:
 b) Can I do parallel builds with dub. CMake gives me 
 Makefiles so I can
 make -j does dub have a similar option?
No
Worth noting that it is not actually a dub problem as much, it is simply not worth adding parallel builds because separate compilation is much much slower with existing D front-end implementation and even doing it in parallel is sub-optimal compared to "dump-it-all-at-once".
From previous rounds of this sort of question (for the SCons D
tooling), the consensus of the community appeared to be that the only time separate module compilation was really useful was for mixed D, C, C++, Fortran systems. For pure D systems, single call of the compiler is deemed far better than traditional C, C++, Fortran compilation strategy. This means the whole "make -j" thing is not an issue, it just means that Dub is only really dealing with the "all D" situation. The corollary to this is that DMD, LDC and GDC really need to make use of all parallelism they can, which I suspect is more or less none. Chapel has also gone the "compile all modules with a single compiler call" strategy as this enables global optimization from source to executable.
Thanks for the info everyone. I've used dub for just on two days now and I'm hooked! At first I was very unsure about giving up my Makefiles, being the build system control freak that I am, but it really shines at rapid development. As for out of source builds, it is a non-issue really. I like running the build outside the project tree but I can use gitignore and targetPath. For larger projects where we need to manage dependencies, generate code, run SWIG etc. I'd still use both SCons or CMake. Regarding parallel builds, make -j on CMake Makefiles and "dub build" feel about the same, and that's all I care about. I'm still not sure how dub would scale for large projects with 100s-1000s of source modules. DMD ran out of memory in the VM (1Gb) at around 70 modules but CMake works due to separate compilation of each module ... I think. However, I didn't investigate due to lack of time so I wouldn't score this against dub. I am sure it can do it if I take the time to figure it out properly. Cheers, uri
Dec 22 2014
parent Rikki Cattermole <alphaglosined gmail.com> writes:
On 23/12/2014 1:39 a.m., uri wrote:
 On Saturday, 20 December 2014 at 08:36:15 UTC, Russel Winder via
 Digitalmars-d-learn wrote:
 On Sat, 2014-12-20 at 05:46 +0000, Dicebot via Digitalmars-d-learn wrote:
 On Saturday, 20 December 2014 at 04:15:00 UTC, Rikki Cattermole wrote:
 b) Can I do parallel builds with dub. CMake gives me > >
Makefiles so I can
 make -j does dub have a similar option?
 No
Worth noting that it is not actually a dub problem as much, it is simply not worth adding parallel builds because separate compilation is much much slower with existing D front-end implementation and even doing it in parallel is sub-optimal compared to "dump-it-all-at-once".
 From previous rounds of this sort of question (for the SCons D
tooling), the consensus of the community appeared to be that the only time separate module compilation was really useful was for mixed D, C, C++, Fortran systems. For pure D systems, single call of the compiler is deemed far better than traditional C, C++, Fortran compilation strategy. This means the whole "make -j" thing is not an issue, it just means that Dub is only really dealing with the "all D" situation. The corollary to this is that DMD, LDC and GDC really need to make use of all parallelism they can, which I suspect is more or less none. Chapel has also gone the "compile all modules with a single compiler call" strategy as this enables global optimization from source to executable.
Thanks for the info everyone. I've used dub for just on two days now and I'm hooked! At first I was very unsure about giving up my Makefiles, being the build system control freak that I am, but it really shines at rapid development. As for out of source builds, it is a non-issue really. I like running the build outside the project tree but I can use gitignore and targetPath. For larger projects where we need to manage dependencies, generate code, run SWIG etc. I'd still use both SCons or CMake. Regarding parallel builds, make -j on CMake Makefiles and "dub build" feel about the same, and that's all I care about. I'm still not sure how dub would scale for large projects with 100s-1000s of source modules. DMD ran out of memory in the VM (1Gb) at around 70 modules but CMake works due to separate compilation of each module ... I think. However, I didn't investigate due to lack of time so I wouldn't score this against dub. I am sure it can do it if I take the time to figure it out properly. Cheers, uri
To build anything with dmd seriously you need about 2gb of ram available. Yes its a lot, but its fast. Also use subpackages. They are your friend.
Dec 22 2014