meson: Build GIR files
authorThibault Saunier <thibault.saunier@osg.samsung.com>
Mon, 23 Jan 2017 15:12:06 +0000 (12:12 -0300)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Mon, 23 Jan 2017 15:48:53 +0000 (12:48 -0300)
gst-libs/gst/gl/meson.build
gst-libs/gst/insertbin/meson.build
gst-libs/gst/mpegts/meson.build
gst-libs/gst/player/meson.build
meson.build
meson_options.txt

index b228c7e..4231240 100644 (file)
@@ -595,9 +595,27 @@ if build_gstgl
     # Don't need vs_module_defs for gstgl because we do symbol exporting in the
     # function definitions via __declspec(dllexport/import)
   )
-  # TODO: generate gir
+  gen_sources = []
+  if build_gir
+    gl_gir = gnome.generate_gir(gstgl,
+      sources : gl_sources + gl_headers,
+      namespace : 'GstGL',
+      nsversion : api_version,
+      identifier_prefix : 'Gst',
+      symbol_prefix : 'gst',
+      export_packages : 'gstreamer-gl-1.0',
+      includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'],
+      install : true,
+      extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API',
+        '--c-include=gst/gl/gl.h'],
+      dependencies : [gst_dep, gstbase_dep, gstvideo_dep]
+    )
+    gen_sources += gl_gir
+  endif
+
 
   gstgl_dep = declare_dependency(link_with : gstgl,
     include_directories : [libsinc],
+    sources: gen_sources,
     dependencies : [gstbase_dep, gstvideo_dep] + gl_winsys_deps)
 endif
index 565be5f..20d71c6 100644 (file)
@@ -12,8 +12,25 @@ gstinsertbin = library('gstinsertbin-' + api_version,
   dependencies : [gst_dep],
   vs_module_defs: vs_module_defs_dir + 'libgstinsertbin.def',
 )
-# TODO: generate gir
+
+gen_sources = []
+if build_gir
+  insertbin_gir = gnome.generate_gir(gstinsertbin,
+    sources : insert_sources + insert_headers,
+    namespace : 'GstInsertBin',
+    nsversion : api_version,
+    identifier_prefix : 'Gst',
+    symbol_prefix : 'gst',
+    export_packages : 'gstreamer-insertbin-1.0',
+    includes : ['Gst-1.0'],
+    install : true,
+    extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API'],
+    dependencies : [gst_dep]
+  )
+  gen_sources += insertbin_gir
+endif
 
 gstinsertbin_dep = declare_dependency(link_with : gstinsertbin,
   include_directories : [libsinc],
+  sources: gen_sources,
   dependencies : [gst_dep])
index b189e69..ea430b3 100644 (file)
@@ -25,6 +25,7 @@ mpegts_h = custom_target('mpegtsenum_h',
   install : true,
   install_dir : 'include/gstreamer-1.0/gst/mpegts',
   command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+gen_sources = [mpegts_h]
 
 mpegts_c = custom_target('mpegtsenum_c',
   output : 'gstmpegts-enumtypes.c',
@@ -41,9 +42,24 @@ gstmpegts = library('gstmpegts-' + api_version,
   dependencies : [gst_dep],
   vs_module_defs: vs_module_defs_dir + 'libgstmpegts.def',
 )
-# TODO: generate gir
+if build_gir
+  mpegts_gir = gnome.generate_gir(gstmpegts,
+    sources : mpegts_sources + mpegts_headers,
+    namespace : 'GstMpegts',
+    nsversion : api_version,
+    identifier_prefix : 'Gst',
+    symbol_prefix : 'gst',
+    export_packages : 'gstreamer-mpegts-1.0',
+    includes : ['Gst-1.0'],
+    install : true,
+    extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API'],
+    dependencies : [gst_dep]
+  )
+  gen_sources += mpegts_gir
+endif
+
 
 gstmpegts_dep = declare_dependency(link_with : gstmpegts,
   include_directories : [libsinc],
   dependencies : [gst_dep],
-  sources : [mpegts_h])
+  sources : gen_sources)
index d881d54..5033d1a 100644 (file)
@@ -33,9 +33,28 @@ gstplayer = library('gstplayer-' + api_version,
                   gsttag_dep, gstpbutils_dep],
   vs_module_defs: vs_module_defs_dir + 'libgstplayer.def',
 )
-# TODO: gir
+
+gen_sources = []
+if build_gir
+  player_gir = gnome.generate_gir(gstplayer,
+    sources : gstplayer_sources + gstplayer_headers,
+    namespace : 'GstPlayer',
+    nsversion : api_version,
+    identifier_prefix : 'Gst',
+    symbol_prefix : 'gst',
+    export_packages : 'gstreamer-player-1.0',
+    includes : ['Gst-1.0', 'GstPbutils-1.0', 'GstBase-1.0', 'GstVideo-1.0',
+      'GstAudio-1.0', 'GstTag-1.0'],
+    install : true,
+    extra_args : gir_init_section + ['-DGST_USE_UNSTABLE_API'],
+    dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep,
+                  gsttag_dep, gstpbutils_dep]
+  )
+  gen_sources += player_gir
+endif
 
 gstplayer_dep = declare_dependency(link_with : gstplayer,
   include_directories : [libsinc],
+  sources: gen_sources,
   dependencies : [gstbase_dep, gstvideo_dep, gstaudio_dep,
                   gsttag_dep, gstpbutils_dep])
index 5c0a9cc..5ef8747 100644 (file)
@@ -373,6 +373,14 @@ vs_module_defs_dir = meson.current_source_dir() + '/win32/common/'
 # Used by the *_mkenum.py helper scripts
 glib_mkenums = find_program('glib-mkenums')
 
+gir = find_program('g-ir-scanner', required : false)
+gnome = import('gnome')
+build_gir = gir.found() and not meson.is_cross_build() and not get_option('disable_introspection')
+gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**);' + \
+    'g_setenv("GST_REGISTRY_1.0", "@0@", TRUE);'.format(meson.current_build_dir() + '/gir_empty_registry.reg') + \
+    'g_setenv("GST_PLUGIN_PATH_1_0", "", TRUE);' + \
+    'g_setenv("GST_PLUGIN_SYSTEM_PATH_1_0", "", TRUE);' + \
+    'gst_init(NULL,NULL);' ]
 subdir('gst-libs')
 subdir('gst')
 subdir('sys')
index ed97cda..5d66945 100644 (file)
@@ -5,3 +5,6 @@ option('with_gl_winsys', type : 'string', value : 'auto', description : 'A comma
 option('with_egl_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libEGL.so library (default: libEGL.so)')
 option('with_opengl_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libGL.so library (default: libGL.so)')
 option('with_gles2_module_name', type : 'string', value : '', description : 'The file to pass to g_module_open to open the libGLESv2.so library (default: libGLESv2.so)')
+option('disable_introspection',
+        type : 'boolean', value : false,
+        description : 'Whether to disable the introspection generation')