Boost logo

Boost-Build :

From: Chris Fairles (chris.fairles_at_[hidden])
Date: 2007-07-16 09:36:22


On 7/16/07, Dmitry Teslenko <dteslenko_at_[hidden]> wrote:
> Hello!
> I'm new to boost-build and I want to use it in a project which making
> use of some of the boost libraries.
>
> I've been looking through boost-build and boost tutorials, googled for
> "getting started"s and "best practice"s but could not find answer to
> question: which is the easiest way to make binary with boost-build
> which links against some of the boost libraries.
>
> The one solution I found is:
> BOOST_PATH = ../../../downloads/distributive/boost_1_34_0 ;
>
> project
> : requirements <include>$(BOOST_PATH) <threading>multi
> ;
>
> lib boost-filesystem
> : [ glob $(BOOST_PATH)/libs/filesystem/src/*.cpp ]
> : <link>static
> ;
>
> exe boost-test
> : main.cpp boost-filesystem
>
> This works but seems to me bit inconvenient: I'm to write library
> target myself. The more obvious and elegant way is to include target
> of library (boost libraries are utilizing boost-bouild too). Here's
> the way I do it:
>
> BOOST_PATH = ../../../downloads/distributive/boost_1_34_0 ;
>
> exe boost-test
> : main.cpp $(BOOST_PATH)/libs/filesystem/build//boost_filesystem
>
> But bjam says there's error:
> ..\..\..\downloads\distributive\boost_1_34_0\Jamfile.v2:341: in load-aux
> rule path.glob-tree unknown in module Jamfile</D:/downloads/distributive/
> D:/downloads/distributive/boost-build/build\project.jam:318: in load-jamf
> D:/downloads/distributive/boost-build/build\project.jam:68: in load
> D:/downloads/distributive/boost-build/build\project.jam:120: in load-pare
> D:/downloads/distributive/boost-build/build\project.jam:447: in initializ
> D:/downloads/distributive/boost-build/build\project.jam:301: in load-jamf
> D:/downloads/distributive/boost-build/build\project.jam:68: in load
> D:/downloads/distributive/boost-build/build\project.jam:170: in project.f
> D:/downloads/distributive/boost-build/build\targets.jam:353: in find-real
> D:/downloads/distributive/boost-build/build\targets.jam:407: in object(pr
> .find
> D:/downloads/distributive/boost-build/build\targets.jam:855: in resolve-r
> D:/downloads/distributive/boost-build/build\targets.jam:874: in targets.g
> rence
> D:/downloads/distributive/boost-build/build\targets.jam:1123: in generate
> D:/downloads/distributive/boost-build/build\targets.jam:1164: in object(t
> generate
> D:/downloads/distributive/boost-build/build\targets.jam:759: in generate-
> D:/downloads/distributive/boost-build/build\targets.jam:735: in object(ma
> nerate
> D:/downloads/distributive/boost-build/build\targets.jam:252: in object(pr
> .generate
> D:/downloads/distributive/boost-build\build-system.jam:298: in load
> D:\downloads\distributive\boost-build/kernel\modules.jam:261: in import
> D:\downloads\distributive\boost-build/kernel/bootstrap.jam:132: in boost-
> D:\downloads\distributive\boost-build\boost-build.jam:1: in module scope
>
> Guide me. please.
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
>

What I do is (as the BB doc's suggest in the FAQ) is create a global
site-config.jam file.

Now I use, gcc so this might look different than what you might use
but it looks like:

import project ;
project.initialize $(__name__) ;
project site-config ;
using gcc : 4.1.1 ;
using gcc : 3.4.6 : g++34 ;

lib boost_thread : : <name>boost_thread-mt <threading>multi ;
lib boost_program_options : : <name>boost_program_options-mt <threading>multi ;
lib boost_program_options : : <name>boost_program_options <threading>single ;
... all other boost libs installed

I also add "pkg-config"-like aliases for other non-boost libs :

alias ffmpeg : : : : <find-shared-library>avformat
<find-shared-library>avutil <find-shared-library>avcodec ;

(to my knowledge <find-shared-lib> works for unix only)

So in my Jamfile's files I just do:
exe main: main.cpp /site-config//boost_filesystem ;

HTH,
Chris


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