Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-02-13 04:30:35


On Friday 10 February 2006 17:47, Daniel Einspanjer wrote:

> "Vladimir Prus" <ghost_at_[hidden]> wrote in message
> news:200602101146.08385.ghost_at_cs.msu.su...
>
> > That's just fine, if the build platform and the target platforms is the
> > same
> > -- which is the case now since we don't, at least officially, support
> > cross-compiling.
>
> Would the right way to support a cross-compilation-aware BB be the first
> method of using empty aliases and alternatives?

Yes, or using conditional requirements, or indirect conditional requirements.
In fact, any method that only looks on build properties, but not on the value
of [ os.name ] -- which is the host OS, and not a target OS in any case.

> >> and it almost works, but since we don't have any NT specific files, the
> >> rule bombs out.
> >
> > Ah, true, but what do you want in that case? Skip building of 'example2'
> > completely? Then, you can either wrap it in "if [ os.name ] = NT", or you
> > can
> > use newly introduced <build>no properties:
>
> My example was a bit contrived here. In reality, these source files get
> compiled into a lib that has other source files that are always part of it.
> I trimmed a bit too much away to give a clear representation.

I see.

> > or you can combine indirect conditional requirements with <build>on and
> > the
> > <source> feature like this:
>
> I tried implementing this method with the following code. I used an
> intermediate obj target so I could have the <build>no stop it but not the
> parent. It works, but I did notice something a bit strange. The Skipping
> message appears *very* early in the build progress.. While it is very
> clear in its statement, I think it might be just a bit disconcerting when
> one of my developers sees it at the top of a Windows build.
......
> [C:\src\testproj\engine\cpp\util\common]bjam util
> Skipping build of
> ../../../../engine/cpp/util/common/platform_specific_sources -- <build>no
> in properties.
> ...patience...
> ...found 468 targets...
> ...updating 91 targets...
> MkDir1 ..\..\..\..\product\build
>
>
> Does it seem right to you that the Skipping message appears so early?

Technically, that's right. The message is printed when Boost.Build converts
"main targets", defined in Jamfiles, into real Jam targets that correspond to
files with specific names, in specific directories and with specific updating
actions.

All those "MkDir1" messages are printed when those actual targets are built,
so they come *after* the "Skipping" message. But note that as long as your
'util' target always have regular target, you don't need '<build>no' at all.

You can just add:

   <conditional>@select_platform_specific_sources

to requirements of 'util', and instead of returning <build>no, return nothing,
that is:

  rule select_platform_specific_sources ( properties * )
  {
    if <os>NT in $(properties)
    {
        # No NT-specific sources.
    }
    ......
  }

That '<build>no' is only necessary if you have a target that must be skipped
for certain platform, completely. This sounded necessary from your previous
example, but as we've settled above, that was just over-simplified
example ;-)

- Volodya


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