Boost logo

Boost :

Subject: Re: [boost] [predef] Announce: Build time configuration forPredefdefs.
From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2015-01-28 10:52:35


On Wed, Jan 28, 2015 at 5:26 AM, Peter Dimov <lists_at_[hidden]> wrote:

> Regarding predef-require, is it possible to combine several conditions
>> using and/or? I see that you've said
>>
>> > You can specify multiple checked expressions that are all required.
>>
>> which probably means "and" (predef-require probably returns <build>no
>> when the condition doesn't hold, so I see how it can be repeated).
>>
>
> Looking at the code, I see that what you meant was
>
> [ predef-require "BOOST_COMP_MSVC <= 15.0.0 BOOST_COMP_MSVC >= 12.0.0" ]
>
> that is, multiple expressions can be specified in the string itself, and
> all of them need to hold.
>

Actually it would be "multiple expressions can be specified as individual
string arguments"..

[ predef-require "BOOST_COMP_MSVC <= 15.0.0" "BOOST_COMP_MSVC >= 12.0.0" ]

> Not, as I thought,
>
> [ predef-require "BOOST_COMP_MSVC <= 15.0.0" ] [ predef-require
> BOOST_COMP_MSVC >= 12.0.0" ]
>
> although this should also work, I think.
>

Yes it will also work.

But there seems to be no way to specify logical or.

Correct.

> Although it could probably be done by duplicating the run rule.
>
> run msvc-or-gcc-test.cpp : : : [ predef-require "BOOST_COMP_MSVC" ] ;
> run msvc-or-gcc-test.cpp : : : [ predef-require "BOOST_COMP_GCC" ] ;
>

I don't think so.. As it would create to duplicate target names and BBv2
would complain about that.

If you're taking (feature &~ pull) requests, I would venture that it would
> be more intuitive if it supported
>
> [ predef-require "BOOST_COMP_MSVC <= 15.0.0 && BOOST_COMP_MSVC >= 12.0.0" ]
>

 [ predef-require "BOOST_COMP_MSVC <= 15.0.0" && "BOOST_COMP_MSVC >=
12.0.0" ]

and
>
> [ predef-require "BOOST_COMP_MSVC || BOOST_COMP_GCC" ]
>

[ predef-require BOOST_COMP_MSVC || BOOST_COMP_GCC ]

Subtle change on that one :-)

though :-)

Well.. I actually considered doing logical composition also. But it has one
drawback. Currently each individual expression is cached so that the result
can be reused across all targets that use it. For example: "BOOST_COMP_MSVC
<= 15.0.0" and "BOOST_COMP_MSVC >= 12.0.0" could each be used dozens of
times. But only two config checks would be done (and cached for future
invocations). Supporting logical-or would mean that each full expression
would be considered.

Having said that.. I'm willing to add more complex expression support if
there's enough demand :-)

-- 
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net
-- rrivera/acm.org (msn) - grafikrobot/aim,yahoo,skype,efnet,gmail

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk