Boost logo

Boost-Build :

From: Dirk Griffioen (dirk_at_[hidden])
Date: 2008-02-10 17:46:58


Hi Stefan,

Wha we usualy do is the following:

- add a reference to the boost root in your projects root

after that you can refer to anything in boost in your own project.

example:

a directory structure:

$HOME/test
                /src
                /boost_1_34_1

1) the test dir will have 3 files: project-root.jam, boost-build.jam and
jamfile

*jamfile* - you can use it to define all kinds of shared settings, in it
you will see something like:

use-project /boost : $(ROOT)/boost_1_34_1 ;

project test
  : requirements
     <use>/boost
     # all your defines & stuff for the platforms you need
  : default-build debug
    <link>shared
    <threading>multi
    <runtime-debugging>on
    <runtime-link>shared
  ;

*project-root.jam* - used to set your $ROOT (and possibly other
globals/constants):

path-constant ROOT : . ;

*boost-build.jam* - where the boost-build engine stuff lives (compiler
settings, tools etc):

if $(JAM_VERSION:J="") < 030114
{
    ECHO "error: Boost.Jam 3.1.14 or later required" ;
    EXIT ;
}
else
{
    JAMFILE = [Jj]amfile ;
    boost-build boost_1_34_1/tools/build/v2 ;
}

probably this could be done simpeler, but it always worked so far so I
never bothered :)

2) the src dir will also have a file called 'jamfile' and in it you can
now refer to anything in boost:

project src
  : source-location .
  : requirements
  : usage-requirements
    <include>.
  ;

lib my_test
  : my_test.cpp
    /boost/filesystem
  ;

run
    my_unit_test.cpp
    my_test
    /boost/test//boost_unit_test_framework
  ;

this implies you install the source yourself on your own system (I never
tried the packaged versions - they're ususally behind in release
anyway); and by installing I mean, unzip/tar it somewhere, building is
done autmatically when you refer from your own project (this works for
any 3rd party stuff you need)

we even put boost in our projects svn (direct or by svn:exernal) - so we
control the version we work with, not the packagers :)

it all kind of models a mount point with $ROOT as '/' - you can
move/copy the whole test-dir anywhere on any platform (boost.build
supports many) and building it will 'just work ...

if you like it, I could send you a zip with a working setup?

Dirk

Stefan Arentz wrote:
> I have installed all Boost 1.34.1 packages on an Ubuntu system,
> including bjam and Boost.Build (2.0m11).
>
> Getting the most simple example from
>
> http://boost.org/boost-build2/doc/html/bbv2/tutorial.html#bbv2.tutorial.hello
>
> to work is a no-brainer.
>
> But now I want this example to use for example the Boost.Filesystem library.
>
> What is the proper way to do this on a system like Ubuntu where there
> is no Boost root but instead just installed headers and libraries?
>
> Can anyone show a minimal Jamroot that depends on a boost library?
>
> Sorry for the noob questions but the lack of documentation for
> Boost.Build makes it really difficult to do these trivial things.
>
> S.
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>
>

-- 
CodeShop BV
www.code-shop.com
+31 6 411 92 024


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