Re: Including bjam code based on the address_model
Rene Rivera via Boost-build <[email protected]> Tue, 9 Jul 2019 21:01:31 -0500
| Newsgroups | gmane.comp.lib.boost.build |
|---|---|
| Message-ID | <CAHEh_GjioLV+9EWtL-uF5ZnsSFFD+ec4Sm0qFXFrWreZWikbXw@mail.gmail.com> |
On Tue, Jul 9, 2019 at 7:58 PM Edward Diener via Boost-build < [email protected]> wrote: > On 7/9/2019 11:30 AM, Edward Diener via Boost-build wrote: > > On 7/9/2019 8:47 AM, Edward Diener via Boost-build wrote: > >> I would like to include different bjam code, using the 'include' rule, > >> into a jamfile based on the address-model used when b2 is invoked. Is > >> this doable, and if so how ? Would it make any difference if the > >> jamfile involved were 'user-config.jam' ? > >> > >> Essentially I need to use different toolset definitions depending on > >> whether the compile is for 32 bit or 64-bit code and I thought the > >> easiest way to do this would be just to include different toolset > >> definitions into my user-config.jam depending on the address model. If > >> there is a better way to do this within bjam I would love to know what > >> it is. Most of the toolsets involved are compilers but some are just > >> other tools such as zip libraries like bzip2 and there is also the > >> python toolset. > >> > >> My current method of doing this is to link a 32-bit user-config to > >> user-config.jam when I do 32-bit compile and a 64-bit user-config to > >> user-config.jam when I do a 64-bit compile, but this has always seemed > >> to me to be kludgy even if it does work, and I am hoping that bjam has > >> the ability to solve this without my kludge. > > > > Solved ! Evidently with 'using' rule for the various compilers and tools > > I can add target alternatives in the requirements section and so can > > have <address-model>32 and <address-model>64 to achieve my goal. > > I spoke too soon. Using the <address-model>32 and <address-model>64 as > target alternatives in toolset 'using' statements does not work to > distinguish 'using' statements with the same name and version. Instead I > get from Boost Build the error of: > > error: duplicate initialization of xxx with the following parameters etc. > > for toolset 'xxx', as in > > using xxx : nnn : some_command : <address-model>32 ; > using xxx : nnn : some_other_command : <address-model>64 ; > > I guess I must go back to my original kludge as there seems to be no way > to have Boost Build pick out the correct toolset based on whether I am > compiling with a 32-bit or 64-bit address model. > You can add a global toolset requirement to do that selection. Some toolsets initializations take those extra arguments and apply it. For example: using gcc : : c++ -fx32 : : <address-model>32 ; But the common ones don't have that, yet. Instead you can go the post init route: using toolset ; using clang : 9.1 : g++ ; toolset.add-requirements <toolset>clang,<address-model>32:<toolset-clang:version>9.1 ; The syntax for that long requirements might need some tweaking for your use case. -- -- Rene Rivera -- Grafik - Don't Assume Anything -- Robot Dreams - http://robot-dreams.net _______________________________________________ Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build