Boost logo

Boost-Build :

Subject: Re: [Boost-build] #include with macro
From: Phillip Seaver (phil_at_[hidden])
Date: 2016-09-28 11:55:19


On 9/27/16 5:09 PM, Rene Rivera wrote:
> On Tue, Sep 27, 2016 at 4:03 PM, Phillip Seaver <phil_at_[hidden]
> <mailto:phil_at_[hidden]>> wrote:
>
> On 9/27/16 7:10 AM, Rene Rivera wrote:
> > On Mon, Sep 26, 2016 at 2:49 PM, Phillip Seaver <phil_at_[hidden]
> <mailto:phil_at_[hidden]>
> > <mailto:phil_at_[hidden] <mailto:phil_at_[hidden]>>> wrote:
> >
> > I'm compiling FreeType with boost-build. It has many includes
> > like this
> > "#include FT_ERRORS_H" There's a file that defines those
> macros. It
> > looks like the underlying bjam code has support for it (in
> > hdrmacro.c &
> > headers.c), but I don't see a way to make use of it in
> boost-build.
> >
> > Am I missing something or is it just not exposed in a
> boost-build way?
> >
> >
> > Well.. Had to go investigate that one since I didn't remember
> where it
> > came from and is not used/exposed. Best explanation I found is from
> > where the extension came from, FTJam
> >
> <http://freetype.sourceforge.net/jam/changes.html#builtin-hdrmacro
> <http://freetype.sourceforge.net/jam/changes.html#builtin-hdrmacro>>.
>
> It would be really helpful if I could use it. boost-build doesn't
> recognize that it needs to rebuild files when one of those header
> changes, so we have to rebuild it manually.
>
> Any suggestions on a work-around or a way to use that feature?
>
>
> I guess I wasn't obvious enough about it.. You should be able to use
> it as is. Just call HDRMACRO some place in your Jamfiles like:
>
> HDRMACRO /some/absolute/path/to/header/defs.h ;
>
> Before anything else. And the regular include header scanning will use
> the defs in that file to replace the scanned files auto-magically
> (probably -- have never done it myself but that's what I see from
> reading the engine code).
>
> --
> -- Rene Rivera
> -- Grafik - Don't Assume Anything
> -- Robot Dreams - http://robot-dreams.net <http://robot-dreams.net/>
> -- rrivera/acm.org
> <http://acm.org/> (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

So, it partially worked.

I had to change the last part of the regular expression in hdrmacro from
"[<\"]([^\">]*)[\">].*$" to "([<\"][^\">]*[\">]).*$" I moved the
parentheses so that it captured the double quotes or angle brackets,
since the current code uses those.

Once I did that, it worked, but only in the current boost-build
project. Other projects that use that project have to have the HDRMACRO
calls in their projects, too. It doesn't seem to propagate,
unfortunately, and my boost-build knowledge seems to fade away over
time. :-(

While I was checking my source tree for #include's that use macros, I
noticed that boost has some, including "BOOST_ABI_PREFIX" and
"BOOST_ABI_SUFFIX". There were also some others that won't be handled
by that code, like "BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)" and
"BOOST_PP_LOCAL_ITERATE()"

Phillip


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