Boost logo

Boost-Build :

Subject: Re: [Boost-build] bjam - win/linux
From: Anthony Foglia (AFoglia_at_[hidden])
Date: 2009-12-04 10:14:40

Johan Nilsson wrote:
> Anant Rao wrote:
>> Hi,
>> To make OS-specific builds using the same bjam script, I see two ways
>> to refer to ThirdParty (TP) lib names and their paths:
>> Define every TP lib as TP_WIN_lib and TP_LINUX_lib and refer to the
>> OS-specific libs in the Jamfiles as something like this:
>> <target-os>linux:<source>TP_LINUX_lib
>> <target-os>windows:<source>TP_WIN_lib
> Do you mean <source> or <file>? I assume you mean <file> and that you
> refer to prebuilt libraries.
>> Define only one var (TP_lib) in user-config.jam. So, this would
>> obviously differ in the two OS's (say, TP_WIN.lib on Win and
>> TP_LINUX.a on Linux). However, the Jamfile just refers to TP_lib.
>> The paths could be say, c:\win\dir on Win and /usr/lib/blah on Linux.
>> Is option 2 considered better? Is there another option better than
>> both?
> I don't believe there's any wide consensus on which one is "better".
> Also, the answer will vary depending on what the actual libraries are
> and where they are located:
> - If the third-party libs should be installed into a location outside
> the project, I suggest using either site-config.jam or plain environment
> variables to define the location (directory) of the thirdparty libs.
> Then use this to set up individual targets (references to libraries) in
> your jamroot, which all other jamfiles within your project can use.
> - If you host the third-party libs inside your project, which I tend to
> do whenever reasonable, I'd suggest the first approach. This totally
> relieves you from maintaining a separate configuration option
> (site-config, user-config, project-config, environment variables).
> Also, remember that you might not only be selecting libraries based on
> OS; there's also threading, debug/release, compiler brand and other
> options.

        On our collection of projects we've chosen the first approach. The
third party libs are installed outside the project, but the boost-build
rules are defined in a jamfile in the top-level of the source code.

        One benefit is that we can easily change/correct the rules, without
requiring root privileges, and the changes get pushed out to everyone.
One drawback is that we are moving towards re-arranging our projects,
with multiple trunks and using svn-externals to share library code, and
figuring out how to avoid having multiple copies of the jamfile is going
to take some playing around.

Anthony Foglia
Princeton Consultants
(609) 987-8787 x233

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at