Boost logo

Boost-Build :

Subject: Re: [Boost-build] Preprocessed output
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-03-29 15:39:39


On 3/29/2011 2:34 PM, Steven Watanabe wrote:
> AMDG
>
> On 03/29/2011 11:10 AM, Edward Diener wrote:
>> How do I tell Boost Build to generate preprocessed output, either when
>> using the 'compile' rule or using some other rule ?
>>
>> I tried, for gcc, adding an -E to the command line as a cxxflag but the
>> compile rule still attempted to compile the file and no output was
>> produced. I need to send preprocessed output to a file without compiling
>> the preprocessed output.
>>
>
> I don't think there's a way to do this at present.

That is unfortunate. I guess I am forced to do it by hand after manually
copying the command-line output of the 'compile' rule for a given
compiler and altering it as necessary.

> It shouldn't be too hard to add, though. There would
> need to be a new target type and rules in the toolset
> modules to generate it.
>
> I needed this for my template profiler, but I only
> implemented it for msvc and gcc and not in a particularly
> reusable way.

Right now I only need it for msvc and gcc on Windows also.

>
> a) Does it need to distinguish between C and C++?
> I think so, since we want exactly the same compiler
> flags that would be passed to create an object file.

That would be ideal, if the preprocessor really works differently
depending on whether the compiling mode is for C or C++. I was not aware
that it does.

> b) What should the name of the type be? This will
> also control the name of the main target rule.

preproc

> c) What should the extension be. I know msvc uses .i
> by default for preprocessor output. Unless they're
> already used by something else, we could make it
> .i and .ipp.

I think that is fine.


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