summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2023-01-16 14:27:44 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2023-01-16 14:27:44 +0100
commit368335a2970865e79c16eb0f71b43e88422dce15 (patch)
tree087a4e2c42fe9b9dc8039323b4d531ed4f0dfed4
parente6f3c665517d3605c57d233312cfe49e701c3e52 (diff)
downloadglibmm-368335a2970865e79c16eb0f71b43e88422dce15.tar.gz
Add the GLIBMM_CHECK_VERSION() preprocessor macro
-rw-r--r--glib/glibmm.h1
-rw-r--r--glib/glibmm/filelist.am1
-rw-r--r--glib/glibmm/meson.build1
-rw-r--r--glib/glibmm/version.h78
4 files changed, 81 insertions, 0 deletions
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 <glibmm/variantiter.h>
#include <glibmm/varianttype.h>
#include <glibmm/vectorutils.h>
+#include <glibmm/version.h>
#include <glibmm/wrap.h>
#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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmmconfig.h>
+
+// 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 <tt>true</tt> 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 <tt>true</tt> 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