2013/8/27 Kristian Høgsberg <[email protected]> > On Wed, Aug 21, 2013 at 08:17:05AM +0200, Pier Luigi Fiorini wrote: > > Make it easier to check for a Weston version. > > --- > > src/version.h.in | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/src/version.h.in b/src/version.h.in > > index f573328..12ad6e4 100644 > > --- a/src/version.h.in > > +++ b/src/version.h.in > > @@ -26,6 +26,13 @@ > > #define WESTON_VERSION_MAJOR @WESTON_VERSION_MAJOR@ > > #define WESTON_VERSION_MINOR @WESTON_VERSION_MINOR@ > > #define WESTON_VERSION_MICRO @WESTON_VERSION_MICRO@ > > -#define WESTON_VERSION "@WESTON_VERSION@" > > + > > +#define WESTON_VERSION ((WESTON_VERSION_MAJOR << 16) | > (WESTON_VERSION_MINOR << 8) | (WESTON_VERSION_MICRO)) > > +#define WESTON_VERSION_STR "@WESTON_VERSION@" > > + > > +/* > > + Can be used like #if (WESTON_VERSION >= WESTON_VERSION_CHECK(1, 2, > 0)) > > +*/ > > +#define WESTON_VERSION_CHECK(major, minor, micro) ((major << 16) | > (minor << 8) | (micro)) > > Not sure about this... we don't guarantee stable plugin-API between > major weston releases (1.1 and 1.2, for example) so it doesn't make > sense to check if the version is at least 1.2.2, for example. Within > a stable branch, we done change the plugin API/ABI, so what you can > check for is a specific major and minor version and a minimum micro > version. > > I'd suggest something linke > > #define WESTON_VERSION_AT_LEAST(major, minor, micro) \ > (WESTON_VERSION_MAJOR == (major) && \ > WESTON_VERSION_MINOR == (minor) && \ > WESTON_VERSION_MICRO >= (micro)) > > Does that work? > > Kristian >
The reason why I did come up with this was related to the surface reference count recently introduced on master. 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. The check would become something like #if WESTON_VERSION_AT_LEAST(1, 3, 0) then and that's fine. Plus if we don't guarantee a stable API between major releases... Sending an updated patch... -- Out of the box experience http://www.maui-project.org/
_______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
