Boost logo

Boost-Build :

Subject: Re: [Boost-build] [boost-build] share requirements between projects
From: Vladimir Prus (vladimir.prus_at_[hidden])
Date: 2014-11-06 09:01:01


On 11/06/2014 03:35 AM, Steve Lorimer wrote:
> Hi all
>
> We have multiple repos, each of which has their own Jamroot
>
> We share some code between repos, so for example in a project Jamroot we'll have
>
> use-project /common : ../common/src ;
>
>
> which pulls in common/src/Jamroot
>
> We have a site-config.jam which configures our gcc toolchain etc, but the issue I'm having is specifying common requirements for our various
> projects
> Note below we have a number of repeated requirements. Is there a way to configure this in site-config.jam or somehow share the common parts?
>
> *common/src/Jamroot:*
>
> project common
> : requirements
> <include>.
> <include>third_party
> <link>static
> <find-shared-library>pthread
> ;
>
>
> *porject1/Jamroot:*
>
> project proj1
> : requirements
> <include>.
> <include>../common/src <include>../
> <include>../common/src/third_party
> <link>static
> <find-shared-library>pthread
>
> ;

Steve,

there are two methods that come to mind.

First, you can have your site-config.jam say this:

        constant COMMON_REQUIREMENTS : <link>static <find-shared-library>pthread ;

and then you can use $(COMMON_REQUIREMENTS) in each jamroot.

Second, you can create a custom module, say company.jam, make sure it's in BOOST_BUILD_PATH,
and add this to that module:

        rule common-requirements { return ... ; }

and then a jamroot can do:

        import company ;
        
        proejct proj1 : requirements ... [ company.common-requirements ] ;

> On a final note, and somewhat related, what is the best practice for sharing code between repos / having multiple Jamroots etc?

I think the second approach will work.

HTH,
Volodya

-- 
Vladimir Prus
http://vladimirprus.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