Boost logo

Boost-Build :

Subject: Re: [Boost-build] order of include directories in python extension
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2011-02-24 05:25:52


John Reid wrote:
> Gevorg Voskanyan wrote:
> > lib a : a.cpp : : :<include>foo<define>bar<link>static:<define>static_macro
> > <include>duplicate ;
> >
> > import targets : generate-from-reference ;
> > import property-set ;
> > import project ;
> >
> > rule collect_usage_reqs ( target_ref : properties * )
> > {
> > local result = [ generate-from-reference $(target_ref) : [ project.current ]
>: [
> > property-set.create $(properties) ] ] ;
> > local ps = $(result[1]) ;
> > return [ $(ps).raw ] ;
> > }
> >
> > lib b : :<conditional>@a_usage_reqs ;
> > lib c : :<link>static<conditional>@a_usage_reqs ;
> >
> > rule a_usage_reqs ( properties * )
> > {
> > local result = [ collect_usage_reqs a : $(properties) ] ;
> > ECHO $(result) ;
> > return $(result) ;
> > }
> >
> > lib no_duplicate : :<conditional>@no_dup_a_usage_reqs ;
> >
> > import set ;
> >
> > rule no_dup_a_usage_reqs ( properties * )
> > {
> > local reqs = [ a_usage_reqs $(properties) ] ;
> > local result = [ set.difference $(reqs) :<include>duplicate ] ;
> > ECHO "After filtering:" ;
> > ECHO $(result) ;
> > ECHO ;
> > return $(result) ;
> > }
>
> I've had a look through this and I think I can more or less guess what's
> going on where. It seems like the "a" target and the
> "<include>duplicate" are hard-coded into the rules. Would it be possible
> to make these arguments? I really don't know enough about
> bjam/boost.build to say myself without a lot of trial and error.

A rule for <conditional> must have 'signature' ( properties * ). So you can't
pass extra arguments to the direct rule specified as <conditional>. The specific
values will be hard-coded in that rule, but nothing prevents you to create
another rule that accepts those extra arguments + properties, and just call that
rule from the one directly specified to <conditional>. Something like this:

# Code

rule filtered_usage_reqs ( target : exclude * : properties * )
{
   return [ set.difference [ collect_usage_reqs $(target) : $(properties) ] :
$(exclude) ] ;
}

# Specific example 1:
rule no_dup_a_usage_reqs ( properties * )
{
   return [ filtered_usage_reqs a : <include>duplicate : $(properties) ] ;
}

# Specific example 2:
rule no_define_thing_x_usage_reqs ( properties * )
{
   return [ filtered_usage_reqs x : <define>THING <define>ANOTHER_THING=9 :
$(properties) ] ;
}

# End code

Hope I managed to convey my point here.

> For the time being, I've created symbolic links to my include
> directories that are in the correct alphabetic order. This is doing the
> job for me. If I have time, I will come back and try your example.
>
> Thanks,
> John.

Regards,
Gevorg


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