diff --git a/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h b/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h index 5486d785e9..a3ca90d58e 100644 --- a/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h +++ b/gst-libs/gst/vulkan/cocoa/gstvkdisplay_cocoa.h @@ -23,13 +23,8 @@ #include -#ifndef VK_USE_PLATFORM_MACOS_MVK -#error "VK_USE_PLATFORM_MACOS_MVK not defined before including this header" -#error "Either include vkapi.h or define VK_USE_PLATFORM_MACOS_MVK before including this header" -#endif -#include - #include +#include G_BEGIN_DECLS diff --git a/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h b/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h index 4697570f26..07d87970fa 100644 --- a/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h +++ b/gst-libs/gst/vulkan/cocoa/gstvkwindow_cocoa.h @@ -22,6 +22,7 @@ #define __GST_VULKAN_WINDOW_COCOA_H__ #include +#include G_BEGIN_DECLS diff --git a/gst-libs/gst/vulkan/gstvkapi.h b/gst-libs/gst/vulkan/gstvkapi.h index ddb0267745..2d6c377f16 100644 --- a/gst-libs/gst/vulkan/gstvkapi.h +++ b/gst-libs/gst/vulkan/gstvkapi.h @@ -28,37 +28,6 @@ #include #include -/* Need these defined to have access to winsys functions before including vulkan.h */ -#if GST_VULKAN_HAVE_WINDOW_XCB -#ifndef VK_USE_PLATFORM_XCB_KHR -#define VK_USE_PLATFORM_XCB_KHR -#endif -#endif - -#if GST_VULKAN_HAVE_WINDOW_WAYLAND -#ifndef VK_USE_PLATFORM_WAYLAND_KHR -#define VK_USE_PLATFORM_WAYLAND_KHR -#endif -#endif - -#if GST_VULKAN_HAVE_WINDOW_COCOA -#ifndef VK_USE_PLATFORM_MACOS_MVK -#define VK_USE_PLATFORM_MACOS_MVK -#endif -#endif - -#if GST_VULKAN_HAVE_WINDOW_IOS -#ifndef VK_USE_PLATFORM_IOS_MVK -#define VK_USE_PLATFORM_IOS_MVK -#endif -#endif - -#if GST_VULKAN_HAVE_WINDOW_WIN32 -#ifndef VK_USE_PLATFORM_WIN32_KHR -#define VK_USE_PLATFORM_WIN32_KHR -#endif -#endif - -#include +#include #endif /* __GST_VULKAN_API_H__ */ diff --git a/gst-libs/gst/vulkan/gstvkcommandpool-private.h b/gst-libs/gst/vulkan/gstvkcommandpool-private.h index 36d41b6916..e544e5d1f8 100644 --- a/gst-libs/gst/vulkan/gstvkcommandpool-private.h +++ b/gst-libs/gst/vulkan/gstvkcommandpool-private.h @@ -1,6 +1,6 @@ /* * GStreamer - * Copyright (C) 2016 Matthew Waters + * Copyright (C) 2019 Matthew Waters * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -30,4 +30,4 @@ void gst_vulkan_command_pool_release_buffer (GstVulkanCommandPool * G_END_DECLS -#endif /* __GST_VULKAN_IMAGE_BUFFER_POOL_H__ */ +#endif /* __GST_VULKAN_COMMAND_POOL_PRIVATE_H__ */ diff --git a/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h b/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h index 393274ddca..3bce155686 100644 --- a/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h +++ b/gst-libs/gst/vulkan/ios/gstvkdisplay_ios.h @@ -23,13 +23,8 @@ #include -#ifndef VK_USE_PLATFORM_IOS_MVK -#error "VK_USE_PLATFORM_IOS_MVK not defined before including this header" -#error "Either include vkapi.h or define VK_USE_PLATFORM_IOS_MVK before including this header" -#endif -#include - #include +#include G_BEGIN_DECLS diff --git a/gst-libs/gst/vulkan/ios/gstvkwindow_ios.h b/gst-libs/gst/vulkan/ios/gstvkwindow_ios.h index be95c84a24..831c623daa 100644 --- a/gst-libs/gst/vulkan/ios/gstvkwindow_ios.h +++ b/gst-libs/gst/vulkan/ios/gstvkwindow_ios.h @@ -22,6 +22,7 @@ #define __GST_VULKAN_WINDOW_IOS_H__ #include +#include G_BEGIN_DECLS diff --git a/gst-libs/gst/vulkan/meson.build b/gst-libs/gst/vulkan/meson.build index 09c15755da..5d5e286353 100644 --- a/gst-libs/gst/vulkan/meson.build +++ b/gst-libs/gst/vulkan/meson.build @@ -93,7 +93,7 @@ elif host_system == 'windows' required : get_option('vulkan')) vulkan_inc_dir = join_paths(vulkan_root, 'Include') - has_vulkan_header = cc.has_header('vulkan/vulkan.h', + has_vulkan_header = cc.has_header('vulkan/vulkan_core.h', args: '-I' + vulkan_inc_dir) if vulkan_lib.found() and has_vulkan_header @@ -102,19 +102,25 @@ elif host_system == 'windows' endif endif else - vulkan_dep = cc.find_library('vulkan', required : get_option('vulkan')) + vulkan_dep = dependency('vulkan', method: 'pkg-config', required : false) + if not vulkan_dep.found() + vulkan_dep = cc.find_library('vulkan', required : false) + endif endif if host_system != 'windows' - has_vulkan_header = cc.has_header('vulkan/vulkan.h') + has_vulkan_header = cc.has_header('vulkan/vulkan_core.h') endif if not has_vulkan_header and get_option('vulkan').enabled() error('vulkan plugin enabled, but vulkan.h not found') endif +if not vulkan_dep.found() and get_option('vulkan').enabled() + error('vulkan plugin enabled, but could not find vulkan library') +endif xcb_dep = dependency('xcb', version : '>=1.10', required : get_option('x11')) -if xcb_dep.found() +if xcb_dep.found() and cc.has_header('vulkan/vulkan_xcb.h', dependencies : vulkan_dep) vulkan_sources += [ 'xcb/gstvkdisplay_xcb.c', 'xcb/gstvkwindow_xcb.c', @@ -130,7 +136,7 @@ if xcb_dep.found() endif wayland_client_dep = dependency('wayland-client', version : '>=1.4', required : get_option('wayland')) -if wayland_client_dep.found() +if wayland_client_dep.found() and cc.has_header('vulkan/vulkan_wayland.h', dependencies : vulkan_dep) vulkan_sources += [ 'wayland/gstvkdisplay_wayland.c', 'wayland/gstvkwindow_wayland.c', @@ -164,7 +170,7 @@ endif if host_system == 'darwin' cocoa_dep = dependency('appleframeworks', modules : ['Cocoa'], required : get_option('vulkan')) - if cocoa_dep.found() + if cocoa_dep.found() and cc.has_header('vulkan/vulkan_macos.h', dependencies : vulkan_dep) vulkan_sources += [ 'cocoa/gstvkdisplay_cocoa.m', 'cocoa/gstvkwindow_cocoa.m', @@ -178,7 +184,7 @@ endif if host_system == 'ios' uikit_dep = dependency('appleframeworks', modules : ['UIKit'], required : get_option('vulkan')) - if uikit_dep.found() + if uikit_dep.found() and cc.has_header('vulkan/vulkan_ios.h', dependencies : vulkan_dep) vulkan_sources += [ 'ios/gstvkdisplay_ios.m', 'ios/gstvkwindow_ios.m', @@ -192,7 +198,7 @@ endif if host_system == 'windows' gdi_dep = cc.find_library('gdi32', required : get_option('vulkan')) - if gdi_dep.found() + if gdi_dep.found() and cc.has_header('vulkan/vulkan_win32.h', dependencies : vulkan_dep) vulkan_sources += ['win32/gstvkwindow_win32.c'] optional_deps += [gdi_dep] vulkan_windowing = true @@ -204,69 +210,72 @@ if not vulkan_windowing warning('No Windowing system found. vulkansink will not work') endif -if vulkan_dep.found() and has_vulkan_header - gen_sources = [] +if not vulkan_dep.found() or not has_vulkan_header + if get_option('vulkan').enabled() + error('GStreamer Vulkan integration required via options, but needed dependencies not found.') + else + gstvulkan_dep = dependency('', required : false) + subdir_done() + endif +endif - install_headers(vulkan_headers, subdir : 'gstreamer-1.0/gst/vulkan') - install_headers(vulkan_xcb_headers, subdir : 'gstreamer-1.0/gst/vulkan/xcb') - install_headers(vulkan_wayland_headers, subdir : 'gstreamer-1.0/gst/vulkan/wayland') +gen_sources = [] - configure_file(input : 'gstvkconfig.h.meson', - output : 'gstvkconfig.h', - install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/vulkan'), - configuration : vulkan_conf) +install_headers(vulkan_headers, subdir : 'gstreamer-1.0/gst/vulkan') +install_headers(vulkan_xcb_headers, subdir : 'gstreamer-1.0/gst/vulkan/xcb') +install_headers(vulkan_wayland_headers, subdir : 'gstreamer-1.0/gst/vulkan/wayland') - vulkan_enums = gnome.mkenums_simple('vulkan-enumtypes', - sources : vulkan_headers, - body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif', - header_prefix : '#include ', - decorator : 'GST_VULKAN_API', - install_header: true, - install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/vulkan')) - vulkan_enumtypes_c = vulkan_enums[0] - vulkan_enumtypes_h = vulkan_enums[1] - gen_sources += [vulkan_enumtypes_h] +configure_file(input : 'gstvkconfig.h.meson', + output : 'gstvkconfig.h', + install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/vulkan'), + configuration : vulkan_conf) - gstvulkan = library('gstvulkan-' + api_version, - vulkan_sources, vulkan_enumtypes_c, vulkan_enumtypes_h, - c_args : gst_plugins_bad_args + vulkan_defines + ['-DBUILDING_GST_VULKAN'], - objc_args : gst_plugins_bad_args + vulkan_defines + vulkan_objc_args + ['-DBUILDING_GST_VULKAN'], - include_directories : [configinc, libsinc], - version : libversion, - soversion : soversion, - darwin_versions : osxversion, - install : true, - dependencies : [gstbase_dep, gstvideo_dep, vulkan_dep] + optional_deps) +vulkan_enums = gnome.mkenums_simple('vulkan-enumtypes', + sources : vulkan_headers, + body_prefix : '#ifdef HAVE_CONFIG_H\n#include "config.h"\n#endif', + header_prefix : '#include ', + decorator : 'GST_VULKAN_API', + install_header: true, + install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/vulkan')) +vulkan_enumtypes_c = vulkan_enums[0] +vulkan_enumtypes_h = vulkan_enums[1] +gen_sources += [vulkan_enumtypes_h] - if build_gir - extra_gir_includes = [] - gobject_introspection_dep = dependency('gobject-introspection-1.0') - if gobject_introspection_dep.version().version_compare('>=1.61.1') - # This is the first version that contains Vulkan-1.0.gir - extra_gir_includes += ['Vulkan-1.0'] - endif +gstvulkan = library('gstvulkan-' + api_version, + vulkan_sources, vulkan_enumtypes_c, vulkan_enumtypes_h, + c_args : gst_plugins_bad_args + vulkan_defines + ['-DBUILDING_GST_VULKAN'], + objc_args : gst_plugins_bad_args + vulkan_defines + vulkan_objc_args + ['-DBUILDING_GST_VULKAN'], + include_directories : [configinc, libsinc], + version : libversion, + soversion : soversion, + darwin_versions : osxversion, + install : true, + dependencies : [gstbase_dep, gstvideo_dep, vulkan_dep] + optional_deps) - vulkan_gir = gnome.generate_gir(gstvulkan, - sources : vulkan_sources + vulkan_headers + [vulkan_enumtypes_h, vulkan_enumtypes_c], - namespace : 'GstVulkan', - nsversion : api_version, - identifier_prefix : 'Gst', - symbol_prefix : 'gst', - export_packages : 'gstreamer-vulkan-1.0', - includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'] + extra_gir_includes, - install : true, - extra_args : gir_init_section + ['--c-include=gst/vulkan/vulkan.h'], - dependencies : [gstvideo_dep, gst_dep, gstbase_dep] + optional_deps - ) - gen_sources += vulkan_gir +if build_gir + extra_gir_includes = [] + gobject_introspection_dep = dependency('gobject-introspection-1.0') + if gobject_introspection_dep.version().version_compare('>=1.61.1') + # This is the first version that contains Vulkan-1.0.gir + extra_gir_includes += ['Vulkan-1.0'] endif - gstvulkan_dep = declare_dependency(link_with : gstvulkan, - include_directories : [libsinc], - sources: gen_sources, - dependencies : [gstvideo_dep, gstbase_dep, vulkan_dep] + optional_deps) -elif get_option('vulkan').enabled() - error('GStreamer Vulkan integration required via options, but needed dependencies not found.') -else - gstvulkan_dep = dependency('', required : false) + vulkan_gir = gnome.generate_gir(gstvulkan, + sources : vulkan_sources + vulkan_headers + [vulkan_enumtypes_h, vulkan_enumtypes_c], + namespace : 'GstVulkan', + nsversion : api_version, + identifier_prefix : 'Gst', + symbol_prefix : 'gst', + export_packages : 'gstreamer-vulkan-1.0', + includes : ['Gst-1.0', 'GstBase-1.0', 'GstVideo-1.0'] + extra_gir_includes, + install : true, + extra_args : gir_init_section + ['--c-include=gst/vulkan/vulkan.h'], + dependencies : [gstvideo_dep, gst_dep, gstbase_dep] + optional_deps + ) + gen_sources += vulkan_gir endif + +gstvulkan_dep = declare_dependency(link_with : gstvulkan, + include_directories : [libsinc], + sources: gen_sources, + dependencies : [gstvideo_dep, gstbase_dep, vulkan_dep] + optional_deps) diff --git a/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h b/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h index 5d385685b7..2132186336 100644 --- a/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h +++ b/gst-libs/gst/vulkan/wayland/gstvkdisplay_wayland.h @@ -26,6 +26,7 @@ #include #include +#include G_BEGIN_DECLS diff --git a/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h b/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h index ee9d4e4471..405d8c76f9 100644 --- a/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h +++ b/gst-libs/gst/vulkan/wayland/gstvkwindow_wayland.h @@ -26,6 +26,8 @@ #include +#include + G_BEGIN_DECLS #define GST_TYPE_VULKAN_WINDOW_WAYLAND (gst_vulkan_window_wayland_get_type()) diff --git a/gst-libs/gst/vulkan/win32/gstvkwindow_win32.h b/gst-libs/gst/vulkan/win32/gstvkwindow_win32.h index eabedeca60..9f219a91b6 100644 --- a/gst-libs/gst/vulkan/win32/gstvkwindow_win32.h +++ b/gst-libs/gst/vulkan/win32/gstvkwindow_win32.h @@ -27,6 +27,7 @@ #define UNICODE #include +#include G_BEGIN_DECLS diff --git a/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h b/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h index 4a6cb9cbb6..1aae05d5a3 100644 --- a/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h +++ b/gst-libs/gst/vulkan/xcb/gstvkdisplay_xcb.h @@ -24,12 +24,7 @@ #include #include - -#ifndef VK_USE_PLATFORM_XCB_KHR -#error "VK_USE_PLATFORM_XCB_KHR not defined before including this header" -#error "Either include vkapi.h or define VK_USE_PLATFORM_XCB_KHR before including this header" -#endif -#include +#include #include diff --git a/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h index 255898b565..0f0fdce7bd 100644 --- a/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h +++ b/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.h @@ -25,6 +25,8 @@ #include +#include + G_BEGIN_DECLS #define GST_TYPE_VULKAN_WINDOW_XCB (gst_vulkan_window_xcb_get_type())