Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to get a default value for BOOST_BUILD_PATH ?
From: Thomas Suckow (thomas.suckow_at_[hidden])
Date: 2014-02-10 11:36:58


On 02/10/2014 04:41 AM, Samuel Debionne wrote:
> Hello,
> I'm using Boost Build for my own project. Boost.Build is installed on my
> system using "b2 install --prefix=/somewhere/bbv2".
>
> This is working fine for the "hello" example.
>
> For a specific project, I would like to add some custom rules to the
> BBv2 path so I added a boost-build.jam at the root of the project :
>
> MYPROJECT_ROOT = $(.boost-build-file:D) ;
>
> BOOST_BUILD_PATH = $(DEFAULT_BOOST_BUILD_PATH) ;
>
> if ! $(MYPROJECT_ROOT)/tools/build in $(BOOST_BUILD_PATH)
> {
> BOOST_BUILD_PATH += $(MYPROJECT_ROOT)/tools/build ;
> }
>
> BOOST_BUILD = [ MATCH --boost-build=(.*) : $(ARGV) ] ;
> BOOST_BUILD ?= $(BOOST_BUILD_PATH) ;
> boost-build $(BOOST_BUILD) ;
>
> My question is how should I define DEFAULT_BOOST_BUILD_PATH (something
> like "../share/boost-build" relative to bjam executable path) ? Is there
> such variable predefined ? If I could avoid defining it by hand that
> would be great !

I believe what you want is something along the lines of $(self:D)/kernel
or possibly $(self:D)/../share/boost-build/kernel

I suspect this may change in the future with modular boost having moved
bootstrap.jam

I would recommend moving to a format like the following, so you may add
multiple search paths.

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

local boost-src = [ if-has-file boost.css :
     [ MATCH --boost=(.*) : $(ARGV) ]
     $(BOOST)
     $(BOOST_ROOT)
     $(self:D)
] ;

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

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

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

--
Thomas

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