Boost logo

Boost-Build :

Subject: Re: [Boost-build] bjam - win/linux
From: Ian Emmons (iemmons_at_[hidden])
Date: 2009-12-04 09:33:35


On Dec 4, 2009, at 3:03 AM, 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.
>
> HTH / Johan

Johan offers several useful suggestions (environment variables, in particular, are quite helpful), but I tend to use the site-config file for this. I set up a separate site-config.jam file for each platform, so each one can be OS and compiler-specific. (I use only one compiler per OS.) And since I build for each platform on a separate machine (often virtual), each machine has just one site-config in one of the canonical locations.

Cheers,

Ian



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