Boost logo

Boost-Build :

Subject: Re: [Boost-build] using boost build outside of boost tree
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2012-05-13 14:54:04


On 5/13/2012 1:27 PM, Robert Ramey wrote:
> Is it possible to use boost build on projects which are not part of the
> boost tree.

Yes.

> If so, what kind of setup has to be done to accomplish this.

All you need is a "boost-build.jam" file anywhere "above" the project
files with, at minimum this in it:

==
boost-build <path-to-boost-build-source-root> ;
==

How you set the path can be as simple as hard wiring.. Or as complex as
doing some smart file searching to find it. For example I use a search
that looks for some common env vars, common relative boost source trees,
some local minimal boost source trees. For example:

==
# Copyright Redshift Software, Inc. 2008.
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

# For instructions see Jamfile.v2, or "bjam --help".

local rule if-has-file ( file + : dir * )
{
     local result ;
     if $(dir)
     {
         result = [ GLOB $(dir) : $(file) ] ;
     }
     return $(result[1]:P) ;
}

#~ Attempts to find the Boost source tree...

local boost-src = [ if-has-file configure :
     [ MATCH --boost=(.*) : $(ARGV) ]
     $(BOOST)
     $(.boost-build-file:D)/../boost
     $(.boost-build-file:D)/sdk/boost-mini
     ] ;

#~ Attempts to find the Boost.Build files...

local boost-build-src = [ if-has-file bootstrap.jam :
     [ MATCH --boost-build=(.*) : $(ARGV) ]
     $(BOOST_BUILD_PATH)
     $(BOOST_BUILD)
     $(boost-src)/tools/build/v2
     $(.boost-build-file:D)/vendor/Boost/boost-build/trunk/v2
     ] ;

#~ Set some common vars to refer to the Boost sources...

BOOST ?= $(boost-src) ;
BOOST_ROOT ?= $(boost-src) ;

#~ Our preferred jamfiles...

JAMFILE = build.jam ;
JAMROOT = root.jam ;

#~ Add the build extensions to the search path...

BOOST_BUILD_PATH +=
$(.boost-build-file:D)/vendor/Boost/boost-build/trunk/ext/ext ;

#~ And load up Boost.Build...

boost-build $(boost-build-src) ;
==

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org (msn) - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim,yahoo,skype,efnet,gmail

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