Boost logo

Boost-Build :

From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2007-01-06 17:51:34


Rene Rivera wrote:
> Mateusz Loskot wrote:
>> One of solution I see is to use project.extension rule to configure
>> external project with PostgreSQL library and then import it with 'using'
>> call:
>>
>> using pgsql : "/usr/local/postgresql-8.2" ;
>>
>> This solution is directly based on the concept I found in
>> bbv2-ext-tinyxml.zip, in Boost Vault (tools/build/grafik).
>>
>> This seems to work, but it requires user to manually edit my Jamfile and
>> customize the path to PgSQL.
>
> Not really. The project.extension functionality, like the toolset config
> functionality, is designed to allow you to put those "using" option in
> any config file. If you are willing to ask users to set up a
> user-config.jam (or site-config.jam) they can place those there.

I understand.

> You can also do it "dynamically" in your Jamfile in response to command options.
> Something like:
>
> local with-pgsql
> = [ MATCH --with-pgsql=(.*) : [ modules.peek : ARGV ] ] ;
> if $(with-pgsql)
> {
> using pgsql : $(with-pgsql[1]) ;
> }

Great!
Yes, that's exactly what was looking for.

I did a very simple test of this "dynamically" configured options
building tinyxml.jam project this way:
(I found the tinyxml.jam in the Boost Vault)

Here are files:

D:\dev\tinyxml-2.5.2\ - TinyXML sources
D:\dev\tinyxml.jam - tinyxml.jam from the Boost Vault
D:\dev\Jamroot - my Jamfile that builds TinyXML

And here is my Jamroot file:

local feature-stl = disable ;
if ( [ MATCH ^(--enable-stl) : [ modules.peek : ARGV ] ] )
{
    feature-stl = enable ;
}

using tinyxml : 2.5.0
    : "D:/dev/tinyxml-2.5.2"
    : --$(feature-stl)-stl
    ;

build-project /ext/tinyxml//tinyxml
    ;

Now, I can decide from command line if I want to compile TinyXML with
STL support enabled or not:

bjam --enable-stl
bjam --disable-stl

Similarly, I can provide feature for --with-<pkg>=/path/to/package.
For exmaple to "dynamically" configure path to TinyXML sources.

Bingo!

>> The main problem here is how to maintain configurable options and
>> how to expose these options to users so they can assign appropriate values?
>
> Does my example help?

Absolutely it does!

Thank you very much.

-- 
Mateusz Loskot
http://mateusz.loskot.net

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