[gtk-vnc] src: introduce a vncversion.h header file



commit 1d8f1dca1fa6da98479c488eeec43d51b5d5eba6
Author: Daniel P. Berrangé <dan berrange com>
Date:   Mon Feb 22 14:15:16 2021 +0000

    src: introduce a vncversion.h header file
    
    This header can be used by apps which want to conditionally use newer
    functionality at build time.
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 src/gvnc.h          |  1 +
 src/meson.build     |  9 +++++++++
 src/vncversion.h.in | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)
---
diff --git a/src/gvnc.h b/src/gvnc.h
index a686fb6..b6d23c0 100644
--- a/src/gvnc.h
+++ b/src/gvnc.h
@@ -21,6 +21,7 @@
 #ifndef GVNC_H
 #define GVNC_H
 
+#include <vncversion.h>
 #include <vncbaseframebuffer.h>
 #include <vncconnectionenums.h>
 #include <vnccursor.h>
diff --git a/src/meson.build b/src/meson.build
index 4e9cabf..b5ba036 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -37,6 +37,14 @@ gvnc_enum_sources_dep = declare_dependency(
   sources: gvnc_enum_sources
 )
 
+version_data = configuration_data()
+version_data.set('VNC_MAJOR_VERSION', version_major)
+version_data.set('VNC_MINOR_VERSION', version_minor)
+version_data.set('VNC_MICRO_VERSION', version_micro)
+gvnc_version_header = configure_file(input : 'vncversion.h.in',
+                                     output : 'vncversion.h',
+                                     configuration : version_data)
+
 gvnc_headers = [
   'gvnc.h',
   'vncpixelformat.h',
@@ -57,6 +65,7 @@ install_headers(gvnc_headers, subdir: 'gvnc-1.0')
 gvnc_gir_sources = gvnc_headers + [
   gvnc_enum_headers,
   gvnc_enum_sources,
+  gvnc_version_header,
   'vncpixelformat.c',
   'vncaudioformat.c',
   'vncaudiosample.c',
diff --git a/src/vncversion.h.in b/src/vncversion.h.in
new file mode 100644
index 0000000..2af4850
--- /dev/null
+++ b/src/vncversion.h.in
@@ -0,0 +1,40 @@
+/*
+ * GTK VNC Widget
+ *
+ * Copyright (C) 2009-2010 Daniel P. Berrange <dan berrange com>
+ *
+ * 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.0 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#ifndef VNC_VERSION_H
+#define VNC_VERSION_H
+
+G_BEGIN_DECLS
+
+#define VNC_MAJOR_VERSION (@VNC_MAJOR_VERSION@)
+
+#define VNC_MINOR_VERSION (@VNC_MINOR_VERSION@)
+
+#define VNC_MICRO_VERSION (@VNC_MICRO_VERSION@)
+
+#define VNC_CHECK_VERSION(major, minor, micro) \
+        (VNC_MAJOR_VERSION > (major) || \
+         (VNC_MAJOR_VERSION == (major) && VNC_MINOR_VERSION > (minor)) || \
+         (VNC_MAJOR_VERSION == (major) && VNC_MINOR_VERSION == (minor) && \
+          VNC_MICRO_VERSION >= (micro)))
+
+G_END_DECLS
+
+#endif /* VNC_VERSION_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]