|
Boost-Build : |
Subject: Re: [Boost-build] Reporting include paths for a project
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-12-05 20:06:00
AMDG
On 11/15/2013 01:50 AM, Mateusz Loskot wrote:
>
> That could serve as a little prosthesis for a solution I'm looking for.
>
> I don't want to actually build, just inspect some build setup.
> So, I'd have to do sort of a dry-run, I guess, with:
>
> b2 -d2 -n
>
> However, I'd have to implement compiler-specific parsing, meaning,
> I'd have to do the job Boost.Build already does, doesn't it?
>
> Alternative solution is to create Jamfile parser on my own,
> but that's scary overkill that would repeat the job already done.
>
> Shortly, if Boost.Build knows what to pass to compiler, why it couldn't
> echo it out in an easily consumable form.
>
The biggest problem with that is what should it echo?
There's a lot of information, and what's convenient
for your use case isn't necessarily what anyone else
needs.
What you can do is write a Jamfile that prints
out this information. You can get access to
the virtual-target level infrastructure using
the generate rule. (There's some documentation
here: http://www.boost.org/boost-build2/doc/html/bbv2/builtins/raw.html)
Anyway, you'll want to use virtual-target.traverse
to iterate over all targets.
It would look something like this (untested):
import virtual-target ;
rule print-all-includes ( project name : property-set : sources * )
{
local result ;
for local s in $(sources)
{
for local t in [ virtual-target.traverse $(s) ]
{
if [ $(t).action ]
{
local action = [ $(t).action ] ;
local properties = [ $(action).properties ] ;
result += [ $(properties).get <include> ] ;
}
}
}
for local include-path in [ set.unique $(result) ]
{
ECHO $(include-path) ;
}
return $(sources) ;
}
generate print-includes : path/to/your/project/ : @print-all-includes ;
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