vulkan: Add iOS window implementation
[platform/upstream/gst-plugins-bad.git] / ext / vulkan / meson.build
index 4b64f78..218bd6e 100644 (file)
@@ -25,7 +25,11 @@ if get_option('vulkan').disabled()
   subdir_done()
 endif
 
-vulkan_dep = cc.find_library('vulkan', required : get_option('vulkan'))
+if host_system == 'ios'
+  vulkan_dep = cc.find_library('MoltenVK', required : get_option('vulkan'))
+else
+  vulkan_dep = cc.find_library('vulkan', required : get_option('vulkan'))
+endif
 has_vulkan_header = cc.has_header('vulkan/vulkan.h')
 if not has_vulkan_header and get_option('vulkan').enabled()
   error('vulkan plugin enabled, but vulkan.h not found')
@@ -69,25 +73,43 @@ if vulkan_dep.found() and has_vulkan_header
     endif
 
     vulkan_objc_args += ['-fobjc-arc']
-  endif
 
-  if host_system == 'darwin'
     foundation_dep = dependency('appleframeworks', modules : ['Foundation'], required : get_option('vulkan'))
     quartzcore_dep = dependency('appleframeworks', modules : ['QuartzCore'], required : get_option('vulkan'))
     corefoundation_dep = dependency('appleframeworks', modules : ['CoreFoundation'], required : get_option('vulkan'))
+    if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found()
+      optional_deps += [foundation_dep, corefoundation_dep, quartzcore_dep]
+    endif
+  endif
+
+  if host_system == 'darwin'
     cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : get_option('vulkan'))
 
-    if foundation_dep.found() and quartzcore_dep.found() and corefoundation_dep.found() and cocoa_dep.found()
+    if cocoa_dep.found()
       vulkan_sources += [
         'cocoa/vkdisplay_cocoa.m',
         'cocoa/vkwindow_cocoa.m',
       ]
-      optional_deps += [foundation_dep, corefoundation_dep, quartzcore_dep, cocoa_dep]
+      optional_deps += [cocoa_dep]
       have_vulkan_windowing = true
       vkconf.set10('GST_VULKAN_HAVE_WINDOW_COCOA', 1)
     endif
   endif
 
+  if host_system == 'ios'
+    uikit_dep = dependency('appleframeworks', modules : ['UIKit'], required : get_option('vulkan'))
+
+    if uikit_dep.found()
+      vulkan_sources += [
+        'ios/vkdisplay_ios.m',
+        'ios/vkwindow_ios.m',
+      ]
+      optional_deps += [uikit_dep]
+      have_vulkan_windowing = true
+      vkconf.set10('GST_VULKAN_HAVE_WINDOW_IOS', 1)
+    endif
+  endif
+
   if have_vulkan_windowing
     configure_file(input : 'vkconfig.h.meson',
       output : 'vkconfig.h',
@@ -99,7 +121,7 @@ if vulkan_dep.found() and has_vulkan_header
       objc_args : gst_plugins_bad_args + vulkan_defines + vulkan_objc_args,
       link_args : noseh_link_args,
       include_directories : [configinc],
-      dependencies : [vulkan_dep, gstvideo_dep, gstbase_dep] + optional_deps,
+      dependencies : [gstvideo_dep, gstbase_dep, vulkan_dep] + optional_deps,
       install : true,
       install_dir : plugins_install_dir,
     )