Add version information related functions
This commit is contained in:
parent
8a5d700d93
commit
75a9318629
1
.gitignore
vendored
1
.gitignore
vendored
@ -89,6 +89,7 @@ Makefile.in
|
||||
/data/swe-glib.pc
|
||||
/data/swe-glib.spec
|
||||
/src/*.vapi
|
||||
/src/gswe-version.h
|
||||
|
||||
# Documentation related files
|
||||
/docs/reference/*/*.args
|
||||
|
@ -92,6 +92,7 @@ AC_CONFIG_FILES([
|
||||
])
|
||||
AM_COND_IF([ENABLE_GTK_DOC], [
|
||||
AC_CONFIG_FILES([
|
||||
src/gswe-version.h
|
||||
docs/reference/swe-glib/version.xml
|
||||
docs/reference/swe-glib/Makefile
|
||||
])
|
||||
|
@ -32,6 +32,7 @@
|
||||
<xi:include href="xml/swe-glib.xml"/>
|
||||
<xi:include href="xml/gswe-moment.xml"/>
|
||||
<xi:include href="xml/gswe-timestamp.xml"/>
|
||||
<xi:include href="xml/gswe-version.xml"/>
|
||||
|
||||
</chapter>
|
||||
<chapter id="object-tree">
|
||||
|
@ -309,3 +309,11 @@ GSWE_ERROR
|
||||
gswe_init
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gswe-version</FILE>
|
||||
GSWE_MAJOR_VERSION
|
||||
GSWE_MINOR_VERSION
|
||||
GSWE_MICRO_VERSION
|
||||
GSWE_CHECK_VERSION
|
||||
gswe_check_version
|
||||
</SECTION>
|
||||
|
@ -21,7 +21,9 @@ INST_H_SRC_FILES = \
|
||||
$(NULL)
|
||||
|
||||
INST_H_BUILT_FILES = \
|
||||
gswe-enumtypes.h
|
||||
gswe-enumtypes.h \
|
||||
gswe-version.h \
|
||||
$(NULL)
|
||||
|
||||
PRIV_H_SRC_FILES = \
|
||||
swe-glib-private.h \
|
||||
@ -55,6 +57,7 @@ libswe_glib_2_0_la_SOURCES = \
|
||||
gswe-moment.c \
|
||||
gswe-timestamp.c \
|
||||
gswe-enumtypes.c \
|
||||
gswe-version.c \
|
||||
$(NULL)
|
||||
|
||||
libswe_glib_2_0_la_CFLAGS = $(GLIB_CFLAGS) $(GOBJECT_CFLAGS) -Wall
|
||||
|
78
src/gswe-version.c
Normal file
78
src/gswe-version.c
Normal file
@ -0,0 +1,78 @@
|
||||
/* gswe-version.c: SWE-GLib version information
|
||||
*
|
||||
* Copyright © 2013 Gergely Polonkai
|
||||
*
|
||||
* SWE-GLib is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SWE-GLib 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "gswe-version.h"
|
||||
|
||||
/**
|
||||
* SECTION:gswe-version
|
||||
* @short_description: SWE-GLib version information
|
||||
* @title: Version information
|
||||
* @stability: Stable
|
||||
* @include: swe-glib/swe-glib.h
|
||||
*
|
||||
* Version information of the SWE-GLib library.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GSWE_MAJOR_VERSION:
|
||||
*
|
||||
* The major version number of the SWE-GLib library.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GSWE_MINOR_VERSION:
|
||||
*
|
||||
* The minor version number of the SWE-GLib library.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GSWE_MICRO_VERSION:
|
||||
*
|
||||
* The micro version number of the SWE-GLib library.
|
||||
*/
|
||||
|
||||
/**
|
||||
* GSWE_CHECK_VERSION:
|
||||
* @major: the major version to check for
|
||||
* @minor: the minor version to check for
|
||||
* @micro: the micro version to check for
|
||||
*
|
||||
* Checks the version number of the SWE-GLib library that is being comipled
|
||||
* against.
|
||||
*
|
||||
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
|
||||
*/
|
||||
|
||||
/**
|
||||
* gswe_check_version:
|
||||
* @required_major: the required major version
|
||||
* @required_minor: the required minor version
|
||||
* @required_micro: the required micro version
|
||||
*
|
||||
* Checks that the SWE-GLib library in use is compatible with the given
|
||||
* version.
|
||||
*
|
||||
* Returns: TRUE if the required version is satisfied; FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
gswe_check_version(guint required_major, guint required_minor, guint required_micro)
|
||||
{
|
||||
return (GSWE_CHECK_VERSION(required_major, required_minor, required_micro));
|
||||
}
|
||||
|
34
src/gswe-version.h.in
Normal file
34
src/gswe-version.h.in
Normal file
@ -0,0 +1,34 @@
|
||||
/* gswe-version.h: SWE-GLib version information
|
||||
*
|
||||
* Copyright © 2013 Gergely Polonkai
|
||||
*
|
||||
* SWE-GLib is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* SWE-GLib 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __GSWE_VERSION_H__
|
||||
#define __GSWE_VERSION_H__
|
||||
|
||||
#define GSWE_MAJOR_VERSION @SWE_GLIB_MAJOR_VERSION@
|
||||
#define GSWE_MINOR_VERSION @SWE_GLIB_MINOR_VERSION@
|
||||
#define GSWE_MICRO_VERSION @SWE_GLIB_MICRO_VERSION@
|
||||
|
||||
gboolean gswe_check_version(guint required_major, guint required_minor, guint required_micro);
|
||||
|
||||
#define GSWE_CHECK_VERSION(major,minor,micro) \
|
||||
(GSWE_MAJOR_VERSION > (major) || \
|
||||
(GSWE_MAJOR_VERSION == (major) && GSWE_MINOR_VERSION > (minor)) || \
|
||||
(GSWE_MAJOR_VERSION == (major) && GSWE_MINOR_VERSION == (minor) && \
|
||||
GSWE_MICRO_VERSION >= (micro)))
|
||||
|
||||
#endif /* __GSWE_VERSION_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user