[Home]Boost.Build V2/UsingBuiltTool

BOOST WIKI | Boost.Build V2 | RecentChanges | Preferences | Page List | Links List

It's not uncommon for complex source trees to include the source for a tool which must be built and then used, perhaps to preprocess some source files.

Here's the VERBATIM (inline-file) example from the Boost.Build v2 manual, but with the verbatim processor built from C++. The technique (explained to me by Valdimir Prus) is to add a feature with the command to be used, and supply that as a build flag. Here's verbatim.jam, which specifies how .verbatim files are handled:

import feature : feature ;
import generators ;
import toolset ;
import type ;

feature inline-binary : : free dependency ;
toolset.flags verbatim.inline-file COMMAND <inline-binary> ;

type.register VERBATIM : verbatim ;
generators.register-standard verbatim.inline-file : VERBATIM : CPP ;

actions verbatim.inline-file bind COMMAND
{
    $(COMMAND) $(<) $(>)
}

The main application Jamfile now looks like this:

import verbatim ;

exe inliner : inliner.cpp ;

exe application : application.cpp usage.verbatim : <inline-binary>inliner ;

BOOST WIKI | Boost.Build V2 | RecentChanges | Preferences | Page List | Links List
Edit text of this page | View other revisions
Last edited November 21, 2006 6:20 pm (diff)
Search:
Disclaimer: This site not officially maintained by Boost Developers