Boost logo

Boost-Build :

Subject: Re: [Boost-build] duplicate dependencies in bjam backend
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-12-16 14:16:13


AMDG

On 12/16/2016 11:55 AM, Stefan Seefeld wrote:
>
> this question is about the low-level bjam Python module and its use.
>
> It happens that in my Python layer I'm occasionally declaring a
> dependency more than once (for example in the context of generators,
> where a meta-target instantiates multiple variants of a target).
>
> It appears the backend happily accepts that, and then simply invokes the
> registered action multiple times (on the same target). Is that to be
> expected ?
>

Yes.

> How does b2 deal with that ? Does it internally guards against multiply
> declared dependencies ? Or does it have some other mechanism to avoid that ?
>
> Specific example: If I declare an "exe" with a source file "hello.cpp",
> then instantiate that twice (with two sets of features), I get a
> dependency for "hello.o" -> "hello.cpp" twice. Does b2 always make sure
> that the feature-dependent "hello.o" target ends up in a different
> directory, thereby causing these two "hello.o" targets to use different
> names ? Or is there some other trick I'm overlooking ?
>

There are two different mechanisms that affect this:
- virtual-targets are uniqued by virtual-target.register,
  so that identical actions are only run once.
- The build directory is based on the non-free features,
  so targets with different features are built in
  different directories.

In Christ,
Steven Watanabe


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk