[Cogl] [PATCH] Add a cogl-version header
Robert Bragg
robert at sixbynine.org
Mon Apr 23 08:07:18 PDT 2012
Yeah this looks good to me.
Reviewed-by: Robert Bragg <robert at linux.intel.com>
In addition to this I think it could also be nice to have a macro for
checking that the version is greater than or equal to a some specific
version like COGL_VERSERION_CHECK(MAJOR, MINOR, MICRO) and for more
flexible expressions a macro for conveniently encoding a major, minor,
micro version into an integer could be good too along with a
pre-encoded constant for the cogl version.
kind regards,
- Robert
On Mon, Apr 23, 2012 at 2:27 PM, Neil Roberts <neil at linux.intel.com> wrote:
> This adds a version header which is generated at configure time and
> 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 COGL_{MAJOR,MINOR,MICRO}_VERSION but I
> think the former is nicer and it at least matches Cairo and Pango.
>
> There is also a macro for the entire version as a string called
> COGL_VERSION.
>
> Unlike in Clutter this patch does not add any runtime version
> identification mechanism.
> ---
> .gitignore | 1 +
> cogl/Makefile.am | 6 +-
> cogl/cogl-version.h.in | 64 ++++++++++++++++++++++++++++++++
> cogl/cogl.h | 1 +
> configure.ac | 1 +
> doc/reference/cogl2/cogl2-docs.xml.in | 1 +
> doc/reference/cogl2/cogl2-sections.txt | 9 ++++
> 7 files changed, 80 insertions(+), 3 deletions(-)
> create mode 100644 cogl/cogl-version.h.in
>
> diff --git a/.gitignore b/.gitignore
> index da020a7..b84c2f4 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -31,6 +31,7 @@ stamp-marshal
> /cogl/cogl-defines.h
> /cogl/cogl-enum-types.c
> /cogl/cogl-enum-types.h
> +/cogl/cogl-version.h
> config.h
> config.h.in
> config.h.win32
> diff --git a/cogl/Makefile.am b/cogl/Makefile.am
> index c459140..3a19e97 100644
> --- a/cogl/Makefile.am
> +++ b/cogl/Makefile.am
> @@ -35,8 +35,8 @@ AM_CPPFLAGS = \
> AM_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
>
> BUILT_SOURCES += cogl-defines.h cogl-gl-header.h
> -DISTCLEANFILES += cogl-defines.h cogl-gl-header.h
> -EXTRA_DIST += cogl-defines.h.in cogl-gl-header.h.in
> +DISTCLEANFILES += cogl-defines.h cogl-gl-header.h cogl-version.h
> +EXTRA_DIST += cogl-defines.h.in cogl-gl-header.h.in cogl-version.h.in
>
> pc_files = cogl2.pc
>
> @@ -468,7 +468,7 @@ cogl_headers = \
>
> coglincludedir = $(includedir)/cogl2/cogl
> coglinclude_HEADERS = $(cogl_headers) $(cogl_experimental_h)
> -nodist_coglinclude_HEADERS = cogl-defines.h
> +nodist_coglinclude_HEADERS = cogl-defines.h cogl-version.h
> if USE_GLIB
> nodist_coglinclude_HEADERS += cogl-enum-types.h
> endif
> diff --git a/cogl/cogl-version.h.in b/cogl/cogl-version.h.in
> new file mode 100644
> index 0000000..9d67e37
> --- /dev/null
> +++ b/cogl/cogl-version.h.in
> @@ -0,0 +1,64 @@
> +/*
> + * Cogl
> + *
> + * An object oriented GL/GLES Abstraction/Utility Layer
> + *
> + * Copyright (C) 2012 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/>.
> + *
> + *
> + */
> +
> +#ifndef __COGL_VERSION_H__
> +#define __COGL_VERSION_H__
> +
> +/**
> + * SECTION:cogl-version
> + * @short_description: Macros for determining the version of Cogl being used
> + *
> + * Cogl offers a set of macros for checking the version of the library
> + * at compile time.
> + */
> +
> +/**
> + * COGL_VERSION_MAJOR:
> + *
> + * The major version of the Cogl library (1, if %COGL_VERSION is 1.2.3)
> + */
> +#define COGL_VERSION_MAJOR @COGL_MAJOR_VERSION@
> +
> +/**
> + * COGL_VERSION_MINOR:
> + *
> + * The minor version of the Cogl library (2, if %COGL_VERSION is 1.2.3)
> + */
> +#define COGL_VERSION_MINOR @COGL_MINOR_VERSION@
> +
> +/**
> + * COGL_VERSION_MICRO:
> + *
> + * The micro version of the Cogl library (3, if %COGL_VERSION is 1.2.3)
> + */
> +#define COGL_VERSION_MICRO @COGL_MICRO_VERSION@
> +
> +/**
> + * COGL_VERSION:
> + *
> + * The full version of the Cogl library, in string form (suited for
> + * string concatenation)
> + */
> +#define COGL_VERSION "@COGL_VERSION@"
> +
> +#endif /* __COGL_VERSION_H__ */
> diff --git a/cogl/cogl.h b/cogl/cogl.h
> index 80e6d9c..7ce7e32 100644
> --- a/cogl/cogl.h
> +++ b/cogl/cogl.h
> @@ -55,6 +55,7 @@
> #include <cogl/cogl-texture.h>
> #include <cogl/cogl-types.h>
> #include <cogl/cogl-path.h>
> +#include <cogl/cogl-version.h>
>
> /*
> * 1.x only api...
> diff --git a/configure.ac b/configure.ac
> index 7ebae5d..d51727c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1122,6 +1122,7 @@ cogl/cogl2.pc
> cogl/cogl-defines.h
> cogl/cogl-gl-header.h
> cogl/cogl.rc
> +cogl/cogl-version.h
> cogl-pango/Makefile
> cogl-pango/cogl-pango2.pc
> cogl-pango/cogl-pango.rc
> diff --git a/doc/reference/cogl2/cogl2-docs.xml.in b/doc/reference/cogl2/cogl2-docs.xml.in
> index 6c9b91c..8e3a302 100644
> --- a/doc/reference/cogl2/cogl2-docs.xml.in
> +++ b/doc/reference/cogl2/cogl2-docs.xml.in
> @@ -127,6 +127,7 @@
> <xi:include href="xml/cogl-vector.xml"/>
> <xi:include href="xml/cogl-quaternion.xml"/>
> <xi:include href="xml/cogl-types.xml"/>
> + <xi:include href="xml/cogl-version.xml"/>
> </section>
>
> <section id="cogl-integration">
> diff --git a/doc/reference/cogl2/cogl2-sections.txt b/doc/reference/cogl2/cogl2-sections.txt
> index 9c10d68..aa83eaa 100644
> --- a/doc/reference/cogl2/cogl2-sections.txt
> +++ b/doc/reference/cogl2/cogl2-sections.txt
> @@ -761,6 +761,15 @@ cogl_vector3_distance
> </SECTION>
>
> <SECTION>
> +<FILE>cogl-version</FILE>
> +<TITLE>Versioning utility macros</TITLE>
> +COGL_VERSION_MAJOR
> +COGL_VERSION_MINOR
> +COGL_VERSION_MICRO
> +COGL_VERSION
> +</SECTION>
> +
> +<SECTION>
> <FILE>cogl-types</FILE>
> <TITLE>Common Types</TITLE>
> CoglFuncPtr
> --
> 1.7.3.16.g9464b
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list