[Spice-devel] [PATCH spice-gtk] fixup! Add support for building with meson/ninja

Eduardo Lima (Etrunko) etrunko at redhat.com
Mon Aug 6 14:29:41 UTC 2018


Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---

It turns out there was quite a lot ot stuff to fix based on what you
suggested, this is what I will send for v3.

Regards, Eduardo.

 meson.build     | 43 +++++++++++++++++++++++++------------------
 src/meson.build |  5 +----
 2 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/meson.build b/meson.build
index bed74f2..cc0da86 100644
--- a/meson.build
+++ b/meson.build
@@ -32,19 +32,14 @@ spice_gtk_global_cflags = ['-DHAVE_CONFIG_H',
                            '-Wall',
                            '-Wextra',
                            '-Wno-sign-compare',
-                           '-Wno-unused-parameter',
-                           ]
-
-foreach arg : spice_gtk_global_cflags
-  add_project_arguments(arg, language : 'c')
-endforeach
+                           '-Wno-cast-function-type',
+                           '-Wno-unused-parameter']
 
 # other global vars
 compiler = meson.get_compiler('c')
 spice_gtk_config_data = configuration_data()
 spice_protocol_min_version='0.12.13'
 spice_gtk_include = [include_directories('.')]
-spice_gtk_c_args = []
 spice_gtk_libs = []
 spice_gtk_deps = []
 spice_gtk_link_args = []
@@ -89,7 +84,7 @@ endforeach
 #
 spice_protocol_version='0.12.15'
 
-glib_version = '2.38'
+glib_version = '2.46'
 glib_version_info = '>= @0@'.format(glib_version)
 pixman_version = '>= 0.17.7'
 
@@ -140,16 +135,9 @@ endforeach
 
 # gtk
 spice_gtk_has_gtk = false
-spice_gtk_gtk_version_required = '>= 3.12'
+gtk_version_required = '3.22'
 if get_option('gtk')
-  gtk_dep = dependency('gtk+-3.0', version : spice_gtk_gtk_version_required)
-  gtk_encoded_version='GDK_VERSION_3_12'
-  spice_gtk_c_args += ['-DGDK_VERSION_MIN_REQUIRED=@0@'.format(gtk_encoded_version),
-                       '-DGDK_VERSION_MAX_ALLOWED=@0@'.format(gtk_encoded_version)]
-  if compiler.has_function('gdk_event_get_scancode', dependencies : gtk_dep)
-    spice_gtk_config_data.set('HAVE_GDK_EVENT_GET_SCANCODE', '1')
-  endif
-  spice_gtk_deps += gtk_dep
+  spice_gtk_deps += dependency('gtk+-3.0', version : '>= @0@'.format(gtk_version_required))
   spice_gtk_deps += dependency('x11')
   if spice_gtk_host_system != 'windows'
     spice_gtk_deps += dependency('epoxy')
@@ -387,6 +375,25 @@ if get_option('smartcard')
   endif
 endif
 
+#
+# global C defines
+#
+glib_major_minor = glib_version.split('.')
+glib_encoded_version = 'GLIB_VERSION_ at 0@_ at 1@'.format(glib_major_minor[0], glib_major_minor[1])
+spice_gtk_global_cflags += ['-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_encoded_version),
+                            '-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_encoded_version)]
+
+if spice_gtk_has_gtk
+  gtk_major_minor = gtk_version_required.split('.')
+  gtk_encoded_version='GDK_VERSION_ at 0@_ at 1@'.format(gtk_major_minor[0], gtk_major_minor[1])
+  spice_gtk_global_cflags += ['-DGDK_VERSION_MIN_REQUIRED=@0@'.format(gtk_encoded_version),
+                              '-DGDK_VERSION_MAX_ALLOWED=@0@'.format(gtk_encoded_version)]
+endif
+
+foreach arg : spice_gtk_global_cflags
+  add_project_arguments(arg, language : 'c')
+endforeach
+
 #
 # Subdirectories
 #
@@ -435,6 +442,6 @@ if spice_gtk_has_gtk
   pkgconfig.generate(spice_client_gtk_lib,
                      description : 'SPICE Client Gtk 3.0 library',
                      subdirs : 'spice-client-gtk-3.0',
-                     requires : 'spice-client-glib-2.0 gtk+3.0 @0@'.format(spice_gtk_gtk_version_required),
+                     requires : 'spice-client-glib-2.0 gtk+3.0 >= @0@'.format(gtk_version_required),
                      variables : 'exec_prefix=${prefix}')
 endif
diff --git a/src/meson.build b/src/meson.build
index 6ec2551..04cc9cb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -184,7 +184,6 @@ spice_client_glib_lib = library('spice-client-glib-2.0', spice_client_glib_sourc
                                 version : '8.6.0',
                                 install : true,
                                 include_directories : spice_gtk_include,
-                                c_args : spice_gtk_c_args,
                                 link_args : spice_gtk_link_args + [spice_gtk_version_script],
                                 link_depends : spice_client_glib_syms,
                                 link_with : spice_gtk_libs,
@@ -193,7 +192,6 @@ spice_client_glib_lib = library('spice-client-glib-2.0', spice_client_glib_sourc
 spice_client_glib_dep = declare_dependency(sources : [spice_marshals[1], spice_client_glib_enums[1]],
                                            link_with : spice_client_glib_lib,
                                            include_directories : spice_gtk_include,
-                                           compile_args : spice_gtk_c_args,
                                            link_args : spice_gtk_link_args,
                                            dependencies : spice_gtk_deps)
 
@@ -222,11 +220,10 @@ spice_client_glib_gir = gnome.generate_gir(spice_client_glib_lib,
 # spice-client-glib-usb-acl-helper
 #
 if spice_gtk_has_polkit
-  usb_acl_helper_c_args = spice_gtk_c_args
   usb_acl_helper_link_args = spice_gtk_link_args
 
   if spice_gtk_has_pie
-    usb_acl_helper_c_args += compiler.get_supported_arguments(['-fPIE'])
+    usb_acl_helper_c_args = compiler.get_supported_arguments(['-fPIE'])
     usb_acl_helper_link_args += compiler.get_supported_link_arguments(['-pie', '-Wl,-z,relro', '-Wl,-z,now'])
   endif
   executable('spice-client-glib-usb-acl-helper',
-- 
2.14.4



More information about the Spice-devel mailing list