gl: also build plugin with -fobjc-arc
authorMatthew Waters <matthew@centricular.com>
Fri, 30 Aug 2019 03:13:54 +0000 (13:13 +1000)
committerMatthew Waters <matthew@centricular.com>
Fri, 30 Aug 2019 03:20:37 +0000 (13:20 +1000)
Fixes macos werror build

../ext/gl/caopengllayersink.m:336:23: error: '__bridge_retained' casts have no effect when not using ARC [-Werror,-Warc-bridge-casts-disallowed-in-nonarc]
    ca_sink->layer = (__bridge_retained gpointer)layer;
                      ^~~~~~~~~~~~~~~~~~

ext/gl/meson.build

index 834c13d..ca15402 100644 (file)
@@ -52,6 +52,7 @@ if get_option('gl').disabled() or not gstgl_dep.found()
 endif
 
 optional_deps = []
+gl_objc_args = []
 
 if gl_dep.found() # have desktop GL
   opengl_sources += [
@@ -112,9 +113,23 @@ if egl_dep.found() and cc.has_header('libdrm/drm_fourcc.h')
   optional_deps += allocators_dep
 endif
 
+if ['darwin', 'ios'].contains(host_system)
+  if not have_objc
+    error('No ObjC compiler found')
+  endif
+
+  objc = meson.get_compiler('objc')
+  if not objc.has_argument('-fobjc-arc')
+    error('ARC is required for building')
+  endif
+
+  gl_objc_args += ['-fobjc-arc']
+endif
+
 gstopengl = library('gstopengl',
   opengl_sources,
   c_args : gst_plugins_base_args,
+  objc_args : gst_plugins_base_args + gl_objc_args,
   link_args : noseh_link_args,
   include_directories : [configinc],
   dependencies : [gstgl_dep, video_dep,
@@ -123,4 +138,4 @@ gstopengl = library('gstopengl',
   install_dir : plugins_install_dir)
 
 pkgconfig.generate(gstopengl, install_dir : plugins_pkgconfig_install_dir)
-plugins += [gstopengl]
\ No newline at end of file
+plugins += [gstopengl]