Boost logo

Boost-Build :

From: Michael Caisse (boost_at_[hidden])
Date: 2007-07-19 12:50:55


Roland Schwarz wrote:
> I am wondering what is the best practice for specifying pre-built boost
> libraries.
>
> E.g.
>
> lib boost_thread : : <name>boost_thread ;
>
> exe hello : hello.cpp boost_thread ;
>
> is not enough, since the actual name of boost_thread is decorated with
> debugging variant, threading, compiler ....
>
> As I understand it would be possible to come up with a site-config.jam
> file that could perform this kind of mapping. But this is tedious...
>
> I guess a better way would be to write a boost.jam and put it into the
> tools of boost-build.
>
> In user-config.jam I would need simply say "using boost" and in my
> projects e.g.
>
> exe hello : hello.cpp /boost//boost_thread ;
>
> Is this possible, i.e. does anyone know of (or intend to write) such a
> boost.jam module?
>
> regards
> Roland
>
>
>

Roland -

This might not be the best way to do it... but this is what I do (I figure Volodya or Rene
will correct me if I'm leading you astray). In fact I do something similar for all of the
libraries that I use and it works well for me.

I have described a project ID in my Jamroot that looks like this:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jamroot line ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

use-project /vendor/boost : library/vendor/boost/build ;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The library/vendor/boost/build directory is at the same level as my boost versions such
as library/vendor/boost/1_34_0. The Jamfile in the boost/build directory looks like this.
It's job is to provide me with the latest version right now. It can do that via normal
header and library or just header. As you can see, I simply provide a <library-path>
directive to the usage requirements section for the alias.

~~~~~~~~~~~~~~~~~~~~~~~~~~ library/vendor/boost/build/Jamfile ~~~~~~~~~~~~~~~~~~~~~~~~

import os ;

if [ os.name ] = NT
{
        LIB_SEARCH_PATH = stage/lib ;
}

LATEST_RELEASE = 1_34_0 ;

# This Jamfile is used to help point other projects that
# use boost in the right direction.

project /vendor/boost
        :
        :
        :
        :
        ;

alias latest
        :
        :
        :
        : <include>../$(LATEST_RELEASE)
          <library-path>../$(LATEST_RELEASE)/stage/lib
        ;

alias latest_header_only
        :
        :
        :
        : <include>../$(LATEST_RELEASE)
        ;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When I want to use a boost library in something I simply add the project//target that
I need. For example:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ snipet from Jamfile ~~~~~~~~~~~~~~~~~~~~~~~~~~~

exe test_0_DispatcherService
        : test_0_DispatcherService.cpp
          /omd/common//header_only
          /vendor/boost//latest
        : <include>.
        ;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hopefully this is useful for you.

Best Regards -
Michael

-- 
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com

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