From 368335a2970865e79c16eb0f71b43e88422dce15 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Mon, 16 Jan 2023 14:27:44 +0100 Subject: Add the GLIBMM_CHECK_VERSION() preprocessor macro --- glib/glibmm.h | 1 + glib/glibmm/filelist.am | 1 + glib/glibmm/meson.build | 1 + glib/glibmm/version.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 glib/glibmm/version.h diff --git a/glib/glibmm.h b/glib/glibmm.h index 7ea7b9fa..4e4e8b01 100644 --- a/glib/glibmm.h +++ b/glib/glibmm.h @@ -151,6 +151,7 @@ #include #include #include +#include #include #endif /* _GLIBMM_H */ diff --git a/glib/glibmm/filelist.am b/glib/glibmm/filelist.am index 6bd16f1c..890997cf 100644 --- a/glib/glibmm/filelist.am +++ b/glib/glibmm/filelist.am @@ -70,6 +70,7 @@ glibmm_files_extra_h = \ value_custom.h \ variantdbusstring.h \ vectorutils.h \ + version.h \ wrap.h \ wrap_init.h diff --git a/glib/glibmm/meson.build b/glib/glibmm/meson.build index df5580b2..abb96906 100644 --- a/glib/glibmm/meson.build +++ b/glib/glibmm/meson.build @@ -110,6 +110,7 @@ glibmm_extra_h_files = [ 'i18n.h', 'priorities.h', 'refptr.h', + 'version.h', 'wrap_init.h', ] diff --git a/glib/glibmm/version.h b/glib/glibmm/version.h new file mode 100644 index 00000000..a5953dba --- /dev/null +++ b/glib/glibmm/version.h @@ -0,0 +1,78 @@ +#ifndef _GLIBMM_VERSION_H +#define _GLIBMM_VERSION_H + +/* Copyright (C) 2023 The gtkmm Development Team + * + * 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.1 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 . + */ + +#include + +// GLIBMM_M*_VERSION are defined in glibmmconfig.h. +// They are described here because Doxygen does not document glibmmconfig.h. + +#ifdef DOXYGEN_SHOULD_SKIP_THIS +// Only Doxygen sees this. +#define GLIBMM_MAJOR_VERSION +#define GLIBMM_MINOR_VERSION +#define GLIBMM_MICRO_VERSION +#endif + +/** @defgroup Version Version + * Glibmm version + * @{ + */ + +/** @def GLIBMM_MAJOR_VERSION + * The major version number of the GLIBMM library. + * + * From the headers used at application compile time. + * E.g. in GLIBMM version 2.76.1 this is 2. + */ + +/** @def GLIBMM_MINOR_VERSION + * The minor version number of the GLIBMM library. + * + * From the headers used at application compile time. + * E.g. in GLIBMM version 2.76.1 this is 76. + */ + +/** @def GLIBMM_MICRO_VERSION + * The micro version number of the GLIBMM library. + * + * From the headers used at application compile time. + * E.g. in GLIBMM version 2.76.1 this is 1. + */ + +/** Checks the version of the GLIBMM header files at compile time. + * + * Returns true if the version of the GLIBMM header files + * is the same as or newer than the passed-in version. + * + * @newin{2,76} + * + * @param major Major version (e.g. 2 for version 2.76.1) + * @param minor Minor version (e.g. 76 for version 2.76.1) + * @param micro Micro version (e.g. 1 for version 2.76.1) + * @returns true if GLIBMM headers are new enough. + */ +#define GLIBMM_CHECK_VERSION(major, minor, micro) \ + (GLIBMM_MAJOR_VERSION > (major) || \ + (GLIBMM_MAJOR_VERSION == (major) && GLIBMM_MINOR_VERSION > (minor)) || \ + (GLIBMM_MAJOR_VERSION == (major) && GLIBMM_MINOR_VERSION == (minor) && \ + GLIBMM_MICRO_VERSION >= (micro))) + +/** @} */ // end of group Version + +#endif // _GLIBMM_VERSION_H -- cgit v1.2.1