Boost logo

Boost-Build :

Subject: Re: [Boost-build] generating headers out of Jamfile
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-01-28 18:13:11


AMDG

On 1/28/2011 2:56 PM, Oliver Kowalke wrote:
> how can I generate headers out of a Jamfile (if possible)?
>
> current Jamfile:
>
> alias sources
> : xyz_windows.cpp
> : <architecture>abc
> <target-os>windows
> <toolset>msvc
> ;
>
> alias sources
> : xyz_posix.cpp
> : <architecture>uvw
> <toolset>gcc
> ;
>
> explicit sources ;
>
> lib boost_xyz
> : sources
> : <link>shared:<define>BOOST_XYZ_DYN_LINK=1
> ;
>
> boost-install boost_xyz ;
>
> I'd like to generate header xyz.hpp out of some template files
> xyz_windows.hpp and xyz_posix.hpp.
>

Use the make rule. Something like this:

actions generate-xyz {
     # shell commands here. $(>) is the source, $(<) is the target
}

alias xyz-source.hpp : xyz_windows.hpp : /properties/ ;
make xyz.hpp : xyz-source.hpp : : @generate-xyz ;

> The idea is to prevent preprocessor stuff dealing with compiler, os,
> architecture etc (especially such thinks like properites <address-model>
> and <instruction-set> etc.).
>
> currently I've solvte the problem with the pimpl idiom but this requires
> a memory allocation which I'd like to prevent. So generating the head
> xyz.hpp depending on the properties given to Jamfile would be the best
> solution (the header file must be generated in <boost-root>/boost/xyz/)..
>

What happens when I use multiple configurations
from the same Boost tree. (I guarantee you that
I will do this. I would consider it a showstopper
if it doesn't work.)

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