[Scons-users] Building D release and tests

Russel Winder russel at winder.org.uk
Tue Apr 11 04:56:38 EDT 2017


If you try to use SCons to build release code and test code, life gets
very complicated, and I think shows that whilst variant builds may not
be broken, they are not easy to use. (Meson and CMake make this
relatively easy.)

To build out-of-tree (the only sane way) a release, I compile
source/main.d with an environment that turns on all the optimisations.

To build the unittests (out-of-tree obviously), I compile source/main.d
with different environment.

This causes problems because SCons sees the source/main.o twice in the
tree and says 

scons: *** Two environments with different actions were specified for the same target: /home/users/russel/Repositories/Git/Masters/ApproxGC_D/source/main.o
(action 1: ldc2 -I=/home/users/russel/Repositories/Git/Masters/ApproxGC_D -O -c -of=main.o main.d)
(action 2: ldc2 -I=/home/users/russel/Repositories/Git/Masters/ApproxGC_D -unittest -c -of=main.o main.d)
File "/home/users/russel/Repositories/Git/Masters/ApproxGC_D/SConscripts/UnitTests", line 3, in <module>

The problem here seems to be that the fact that the rule is in the
context of a variant build is not being taken into account. One rule is
making Build/Release/source/main.o the other
Build/UnitTests/source/main.o, but the build DAG appears not to know
this.

I have just put the code up on GitHub if anyone has time to take a peek
at this.

https://github.com/russel/ApproxGC

-- 
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 winder.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: 833 bytes
Desc: This is a digitally signed message part
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170411/8c761147/attachment.pgp>


More information about the Scons-users mailing list