[Scons-users] Dependency between generated source files and their VariantDir counterpart

Bill Deegan bill at baddogconsulting.com
Thu Mar 12 13:10:12 EDT 2020


This:

VariantDir(‘build/’, ‘.’, duplicate=1’)

Is never recommended.
Think about what you're telling SCons.

Please make a variant of everything under the current dir into build which
is under the current dir.
Which means after the first build and build is created there should be
build/build, and next time.. build/build/build... (into infinity)

Please don't do that. It will only lead to difficult to understand issues.
I think we'll add an error message into SCons for this in the near future.

Also because you're populating non variantdir after the build has started
for a variant dir, it's not going to find the sources.
How are you building the sources for that? If I'm reading it right, you're
builder calls Program/Object/etc a bunch of times after downloading.
I'd say just specify the targets into your variant dir and the sources into
your download area.

This could work if all the downloading was in place before SCons created
it's internal representation for the files in the variant dir which are
actually into the src dir.
You might try using Repository() (see manpage), but not sure that solves
this either.

Hope this helps!
Also if you want realtime help you can reach out on #scons-help on our
discord server or our IRC channel.



On Thu, Mar 12, 2020 at 12:33 PM ZEISSLOFF Thibaut <
thibaut.zeissloff at hagergroup.com> wrote:

> Hello,
>
>
>
> I am struggling to find the proper way to make SCons aware of my
> dependency tree.
>
>
>
> I would like (and already did) users to be able to write something like :
>
>
>
> cots_sources = env.UseCots(‘math_library at 1.1.0’, install_path=’cots/’)
>
>
>
> and then build their program using the regular Object, Library, Program
> builders.
>
>
>
> Behind this « CotsBuilder » hides the logic of retrieving package metadata
> from a package manager (in emitter) so that SCons knows about sources and
> headers that will be gathered. This Builder action being to actually
> download the package and extract it in given install path.
>
>
>
> This works like a charm until I use VariantDir :
>
>
>
> Basically, retrieved sources lie in : cots/math_library/*.c
>
> While regular sources lie in : src/*.c
>
>
>
> When using VariantDir(‘build/’, ‘.’, duplicate=1’), only regular sources
> are duplicated and I end up with a
>
> scons: *** [build/cots/math_library/math.o] Source
> `build/cots/math_library/math.c ' not found, needed by target
> `build/cots/math_library/math.o’
>
>
>
> After some research, I understood that the problem is that these cots/ are
> “targets” for SCons and therefore expected to be produced in variant dir.
>
>
>
> If I manually fill the dependency gap by setting :
>
> env.Depends(‘build/cots/math_library/math.c’, ‘cots/math_library/math.c’)
>
> it works as expected.
>
>
>
> Now, my point, how can I inform SCons during the emission stage of my
> Builder that its targets shall be considered as sources, or that they
> should not be expected in variant dir ? I cannot do this Depends call in
> emitter because VariantDir method may not have been called yet and I can
> not make assumptions about variant dir.
>
>
>
> I found a very dirty way to do that, “hooking” the VariantDir call but I
> would prefer a SCons-way of doing so.
>
>
>
> Can somebody help ?
>
>
>
> Thanks, Thibaut
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20200312/92aa1c4d/attachment-0001.html>


More information about the Scons-users mailing list