mutter/cogl/cogl-defines.h.in
Neil Roberts b6b9ac0b85 Add a cogl-version header
This adds a version header which contains macros to define which
version of Cogl the application is being compiled against. This helps
applications that want to support multiple incompatible versions of
Cogl at compile time.

The macros are called COGL_VERSION_{MAJOR,MINOR,MICRO}. This does not
match Clutter which names them CLUTTER_{MAJOR,MINOR,MICRO}_VERSION but
I think the former is nicer and it at least matches Cairo and Pango.

The values of the macro are defined to COGL_VERSION_*_INTERNAL which
is generated by the configure script into cogl-defines.h.

There is also a macro for the entire version as a string called
COGL_VERSION_STRING.

The internal utility macros for encoding a 3 part version number into
a single integer have been moved into the new header so they can be
used publicly as a convenient way to check if the version is within a
particular range. There is also a COGL_VERSION_CHECK macro for the
very common case that a feature will be used since a particular
version of Cogl. There is a macro called COGL_VERSION which contains
the pre-encoded version of Cogl being compiled against for
convenience.

Unlike in Clutter this patch does not add any runtime version
identification mechanism.

A test case is also added which just contains static asserts to sanity
check the macros.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 3480cf140dc355fa87ab3fbcf0aeeb0124798a8f)
2012-08-06 14:27:40 +01:00

51 lines
1.4 KiB
C

/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#ifndef __COGL_DEFINES_H__
#define __COGL_DEFINES_H__
#include <glib.h>
G_BEGIN_DECLS
@COGL_DEFINES@
#ifdef COGL_HAS_EGL_SUPPORT
@COGL_EGL_INCLUDES@
#define NativeDisplayType EGLNativeDisplayType
#define NativeWindowType EGLNativeWindowType
#endif
#define COGL_VERSION_MAJOR_INTERNAL @COGL_MAJOR_VERSION@
#define COGL_VERSION_MINOR_INTERNAL @COGL_MINOR_VERSION@
#define COGL_VERSION_MICRO_INTERNAL @COGL_MICRO_VERSION@
#define COGL_VERSION_STRING_INTERNAL "@COGL_VERSION@"
G_END_DECLS
#endif