|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-06-18 02:48:57
Hi Jürgen,
> I just tested out my bin stage targets and found the following when
> running $PROGRAM//bin
>
> gcc.link bin/§PROGRAM
> common.copy bin/libX.a
> common.copy bin/lm_new.o
> common.copy bin/liblmgr.a
>
> the bin stage is defined:
>
> stage bin : $(TARGET) : <location>../bin : ;
>
> Why are the additional files copied ?
I don't know. What's the value of $(TARGET) above?
> I'm building a static linked application where those files are
> incorporated anyway. And even for a dynamic build, at least the last
> files (flexlm)-specific, should not be copied, because shall always be
> linked static. (Security reasons ;-)))
What happens here is that stage rule gets a number of targets, including the
libraries. Why it gets the libraries depends on the answer about $(TARGET).
After it gets them, it diligently copies everything it got.
There a couple of solutions:
1. Use <include-type>EXE property for stage, so that it copies only binaries
2. Make sure libraries are not passed to 'stage' -- again this depends on why
they are passed.
3. Introduce another mechanism to exclude specific targets from staging.
>
> And I think that at least on Unix (and using gcc) hardcode-dll-paths
> should be enough to avoid copying shared libraries around.
>
> Or am I missing something here ?
Given that stage rules can be use for installing, we can't expect that
hardcode-dll-paths is always on.
> Btw, is there any mechanism to invoke _all_ stage defined in sub-project
> which are normally build by using "build-project $SUBPROJECT" from
> top-level Jamfile ?
The following code works for me. You'd need revision 1.81 of build/project.jam
that I've just comitted, though. The name of child project, "b" is hardcoded,
but it's easy the change.
import targets ;
import project ;
import "class" ;
import modules ;
local other-targets ;
local child = [ targets.find "b" : [ project.target $(__name__) ] ] ;
local targets = [ $(child).targets-to-build ] ;
for local t in $(targets)
{
local alts = [ modules.peek $(t) : self.alternatives ] ;
local is-stage ;
while $(alts) && ! $(is-stage)
{
if [ class.is-a $(alts[1]) : stage-target-class ]
{
is-stage = true ;
}
alts = $(alts[2-]) ;
}
if $(is-stage)
{
local name = [ $(t).name ] ;
other-targets += b//$(name) ;
ECHO "Stage target" [ $(t).full-name ] ;
}
}
alias other : $(other-targets) ;
- 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