meson: add option for opengl and the misc optional gl plugin deps
authorTim-Philipp Müller <tim@centricular.com>
Thu, 16 Aug 2018 09:28:48 +0000 (10:28 +0100)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 16 Aug 2018 09:56:58 +0000 (10:56 +0100)
Finer control over the opengl integration library dependencies
is already implemented via the gl_api, gl_platform, and gl_winsys
options.

https://bugzilla.gnome.org/show_bug.cgi?id=796947

ext/gl/meson.build
gst-libs/gst/gl/meson.build
meson_options.txt

index 0f588a0..7eba0b3 100644 (file)
@@ -47,80 +47,82 @@ opengl_sources = [
   'gstglutils.c'
 ]
 
-if build_gstgl and gstgl_dep.found()
-  optional_deps = []
+if get_option('gl').disabled() or not gstgl_dep.found()
+  subdir_done()
+endif
 
-  if gl_dep.found() # have desktop GL
-    # These have to stay in -bad until we can move GstVideoAggregator to -base
-    # 'gstglmosaic.c',
-    opengl_sources += [
-      'gstglfilterglass.c',
-    ]
-  endif
+optional_deps = []
+
+if gl_dep.found() # have desktop GL
+  # These have to stay in -bad until we can move GstVideoAggregator to -base
+  # 'gstglmosaic.c',
+  opengl_sources += [
+    'gstglfilterglass.c',
+  ]
+endif
 
-  graphene_dep = dependency('graphene-1.0', version : '>=1.4.0', required : false)
-  if graphene_dep.found()
-    optional_deps += graphene_dep
-    core_conf.set('HAVE_GRAPHENE', true)
+graphene_dep = dependency('graphene-1.0', version : '>=1.4.0', required : get_option('gl-graphene'))
+if graphene_dep.found()
+  optional_deps += graphene_dep
+  core_conf.set('HAVE_GRAPHENE', true)
+  opengl_sources += [
+    'gstgltransformation.c',
+    'gstglvideoflip.c',
+  ]
+endif
+
+png_dep = dependency('libpng', version : '>=1.0', required : get_option('gl-png'))
+jpeg_dep = cc.find_library('jpeg-mmx', required : false)
+if not jpeg_dep.found()
+  jpeg_dep = cc.find_library('jpeg', required : get_option('gl-jpeg'))
+endif
+
+if png_dep.found()
+  optional_deps += png_dep
+  core_conf.set('HAVE_PNG', true)
+  opengl_sources += [
+    'gstgldifferencematte.c',
+  ]
+  if jpeg_dep.found()
+    optional_deps += jpeg_dep
+    core_conf.set('HAVE_JPEG', true)
     opengl_sources += [
-      'gstgltransformation.c',
-      'gstglvideoflip.c',
+      'gstgloverlay.c',
     ]
   endif
+endif
 
-  png_dep = dependency('libpng', version : '>=1.0', required : false)
-  jpeg_dep = cc.find_library('jpeg-mmx', required : false)
-  if not jpeg_dep.found()
-    jpeg_dep = cc.find_library('jpeg', required : false)
-  endif
-
-  if png_dep.found()
-    optional_deps += png_dep
-    core_conf.set('HAVE_PNG', true)
+if glconf.has('GST_GL_HAVE_WINDOW_COCOA')
+  quartzcore_dep = dependency('QuartzCore', required : false)
+  if quartzcore_dep.found() # have cocoa
     opengl_sources += [
-      'gstgldifferencematte.c',
+      'caopengllayersink.m',
     ]
-    if jpeg_dep.found()
-      optional_deps += jpeg_dep
-      core_conf.set('HAVE_JPEG', true)
-      opengl_sources += [
-        'gstgloverlay.c',
-      ]
-    endif
+    optional_deps += quartzcore_dep
   endif
+endif
 
-  if glconf.has('GST_GL_HAVE_WINDOW_COCOA')
-    quartzcore_dep = dependency('QuartzCore', required : false)
-    if quartzcore_dep.found() # have cocoa
-      opengl_sources += [
-        'caopengllayersink.m',
-      ]
-      optional_deps += quartzcore_dep
-    endif
-  endif
+if x11_dep.found()
+  # for XInitThreads()
+  optional_deps += x11_dep
+endif
 
-  if x11_dep.found()
-    # for XInitThreads()
-    optional_deps += x11_dep
-  endif
+if bcm_host_dep.found()
+  optional_deps += bcm_host_dep
+endif
 
-  if bcm_host_dep.found()
-    optional_deps += bcm_host_dep
-  endif
+if egl_dep.found() and cc.has_header('libdrm/drm_fourcc.h')
+  optional_deps += allocators_dep
+endif
 
-  if egl_dep.found() and cc.has_header('libdrm/drm_fourcc.h')
-    optional_deps += allocators_dep
-  endif
+gstopengl = library('gstopengl',
+  opengl_sources,
+  c_args : gst_plugins_base_args,
+  link_args : noseh_link_args,
+  include_directories : [configinc],
+  dependencies : [gstgl_dep, video_dep,
+                  gst_base_dep, gst_controller_dep, libm] + optional_deps,
+  install : true,
+  install_dir : plugins_install_dir)
 
-  gstopengl = library('gstopengl',
-    opengl_sources,
-    c_args : gst_plugins_base_args,
-    link_args : noseh_link_args,
-    include_directories : [configinc],
-    dependencies : [gstgl_dep, video_dep,
-                    gst_base_dep, gst_controller_dep, libm] + optional_deps,
-    install : true,
-    install_dir : plugins_install_dir,
-  )
-  pkgconfig.generate(gstopengl, install_dir : plugins_pkgconfig_install_dir)
-endif
+pkgconfig.generate(gstopengl, install_dir : plugins_pkgconfig_install_dir)
index 65fc7f5..4379a8d 100644 (file)
@@ -1,3 +1,10 @@
+if get_option('gl').disabled()
+  message('GStreamer OpenGL integration disabled via options.')
+  gstgl_dep = disabler()
+  build_gstgl = false
+  subdir_done()
+endif
+
 gl_sources = [
   'gstglapi.c',
   'gstglbasefilter.c',
@@ -821,4 +828,7 @@ if build_gstgl
     include_directories : [libsinc, compat_includes],
     sources: gen_sources,
     dependencies : [video_dep, gst_base_dep] + gl_winsys_deps)
+
+elif get_option('gl').enabled()
+  error('GStreamer OpenGL integration required via options, but needed dependencies not found.')
 endif
index bd4e325..ea3728c 100644 (file)
@@ -21,6 +21,12 @@ option('opengl_module_name', type : 'string', value : '',
 option('gles2_module_name', type : 'string', value : '',
        description : 'The file to pass to g_module_open to open the libGLESv2 library (default: libGLESv2)')
 
+# Feature option for opengl plugin and integration library
+option('gl', type : 'feature', value : 'auto', description : 'OpenGL integration library and OpenGL plugin')
+option('gl-graphene', type : 'feature', value : 'auto', description : 'Use Graphene in OpenGL plugin')
+option('gl-jpeg', type : 'feature', value : 'auto', description : 'Use libjpeg in OpenGL plugin')
+option('gl-png', type : 'feature', value : 'auto', description : 'Use libpng in OpenGL plugin')
+
 # Feature options for plugins with no external deps
 option('adder', type : 'feature', value : 'auto')
 option('app', type : 'feature', value : 'auto')