<div dir="ltr">2013/8/27 Kristian Høgsberg <span dir="ltr"><<a href="mailto:hoegsberg@gmail.com" target="_blank">hoegsberg@gmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<div class=""><div class="h5">On Wed, Aug 21, 2013 at 08:17:05AM +0200, Pier Luigi Fiorini wrote:<br>
> Make it easier to check for a Weston version.<br>
> ---<br>
>  src/<a href="http://version.h.in" target="_blank">version.h.in</a> | 9 ++++++++-<br>
>  1 file changed, 8 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/<a href="http://version.h.in" target="_blank">version.h.in</a> b/src/<a href="http://version.h.in" target="_blank">version.h.in</a><br>
> index f573328..12ad6e4 100644<br>
> --- a/src/<a href="http://version.h.in" target="_blank">version.h.in</a><br>
> +++ b/src/<a href="http://version.h.in" target="_blank">version.h.in</a><br>
> @@ -26,6 +26,13 @@<br>
>  #define WESTON_VERSION_MAJOR @WESTON_VERSION_MAJOR@<br>
>  #define WESTON_VERSION_MINOR @WESTON_VERSION_MINOR@<br>
>  #define WESTON_VERSION_MICRO @WESTON_VERSION_MICRO@<br>
> -#define WESTON_VERSION "@WESTON_VERSION@"<br>
> +<br>
> +#define WESTON_VERSION ((WESTON_VERSION_MAJOR << 16) | (WESTON_VERSION_MINOR << 8) | (WESTON_VERSION_MICRO))<br>
> +#define WESTON_VERSION_STR "@WESTON_VERSION@"<br>
> +<br>
> +/*<br>
> +    Can be used like #if (WESTON_VERSION >= WESTON_VERSION_CHECK(1, 2, 0))<br>
> +*/<br>
> +#define WESTON_VERSION_CHECK(major, minor, micro) ((major << 16) | (minor << 8) | (micro))<br>
<br>
</div></div>Not sure about this... we don't guarantee stable plugin-API between<br>
major weston releases (1.1 and 1.2, for example) so it doesn't make<br>
sense to check if the version is at least 1.2.2, for example.  Within<br>
a stable branch, we done change the plugin API/ABI, so what you can<br>
check for is a specific major and minor version and a minimum micro<br>
version.<br>
<br>
I'd suggest something linke<br>
<br>
#define WESTON_VERSION_AT_LEAST(major, minor, micro) \<br>
        (WESTON_VERSION_MAJOR == (major) && \<br>
         WESTON_VERSION_MINOR == (minor) && \<br>
         WESTON_VERSION_MICRO >= (micro))<br>
<br>
Does that work?<br>
<span class=""><font color="#888888"><br>
Kristian<br>
</font></span></blockquote></div><br>The reason why I did come up with this was related to the surface reference count recently introduced on master.</div><div class="gmail_extra">What I was trying to accomplish was to keep the code from building if my shell plugin is built against Weston 1.2.x, and a WESTON_VERSION_AT_LEAST fullfill my requirement.</div>

<div class="gmail_extra">The check would become something like #if WESTON_VERSION_AT_LEAST(1, 3, 0) then and that's fine.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Plus if we don't guarantee a stable API between major releases...</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">Sending an updated patch...<br clear="all"><div><br></div>-- <br>Out of the box experience<br><a href="http://www.maui-project.org/" target="_blank">http://www.maui-project.org/</a>
</div></div>