2019-04-08 11:35:22 +00:00
|
|
|
if get_option('vulkan').disabled()
|
|
|
|
gstvulkan_dep = dependency('', required: false)
|
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
|
|
|
vulkan_sources = [
|
|
|
|
'gstvkbuffermemory.c',
|
|
|
|
'gstvkbufferpool.c',
|
2019-09-17 12:24:04 +00:00
|
|
|
'gstvkcommandbuffer.c',
|
2019-04-10 04:27:26 +00:00
|
|
|
'gstvkcommandpool.c',
|
2019-11-06 11:19:42 +00:00
|
|
|
'gstvkdescriptorcache.c',
|
|
|
|
'gstvkdescriptorset.c',
|
|
|
|
'gstvkdescriptorpool.c',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkdevice.c',
|
2019-09-11 09:24:50 +00:00
|
|
|
'gstvkdebug.c',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkdisplay.c',
|
|
|
|
'gstvkerror.c',
|
|
|
|
'gstvkfence.c',
|
2019-06-13 07:57:51 +00:00
|
|
|
'gstvkformat.c',
|
2019-11-29 02:45:42 +00:00
|
|
|
'gstvkfullscreenquad.c',
|
2019-11-05 22:29:51 +00:00
|
|
|
'gstvkhandle.c',
|
2019-11-26 13:25:16 +00:00
|
|
|
'gstvkhandlepool.c',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkimagememory.c',
|
2019-05-08 04:50:29 +00:00
|
|
|
'gstvkimagebufferpool.c',
|
2019-09-24 07:24:38 +00:00
|
|
|
'gstvkimageview.c',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkinstance.c',
|
|
|
|
'gstvkmemory.c',
|
2019-09-16 02:59:08 +00:00
|
|
|
'gstvkphysicaldevice.c',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkqueue.c',
|
2019-07-04 04:16:17 +00:00
|
|
|
'gstvkswapper.c',
|
2019-07-04 04:03:51 +00:00
|
|
|
'gstvktrash.c',
|
2019-11-26 07:11:25 +00:00
|
|
|
'gstvkvideofilter.c',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkutils.c',
|
|
|
|
'gstvkwindow.c',
|
|
|
|
]
|
|
|
|
|
|
|
|
vulkan_headers = [
|
2019-08-05 01:31:48 +00:00
|
|
|
'gstvkapi.h',
|
2019-05-20 03:46:56 +00:00
|
|
|
'gstvkbarrier.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkbuffermemory.h',
|
|
|
|
'gstvkbufferpool.h',
|
2019-09-17 12:24:04 +00:00
|
|
|
'gstvkcommandbuffer.h',
|
2019-04-10 04:27:26 +00:00
|
|
|
'gstvkcommandpool.h',
|
2019-11-06 11:19:42 +00:00
|
|
|
'gstvkdescriptorcache.h',
|
|
|
|
'gstvkdescriptorset.h',
|
|
|
|
'gstvkdescriptorpool.h',
|
2019-09-12 05:29:05 +00:00
|
|
|
'gstvkdebug.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkdevice.h',
|
|
|
|
'gstvkdisplay.h',
|
|
|
|
'gstvkerror.h',
|
|
|
|
'gstvkfence.h',
|
2019-06-13 07:57:51 +00:00
|
|
|
'gstvkformat.h',
|
2019-11-29 02:45:42 +00:00
|
|
|
'gstvkfullscreenquad.h',
|
2019-11-05 22:29:51 +00:00
|
|
|
'gstvkhandle.h',
|
2019-11-26 13:25:16 +00:00
|
|
|
'gstvkhandlepool.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkimagememory.h',
|
2019-05-08 04:50:29 +00:00
|
|
|
'gstvkimagebufferpool.h',
|
2019-09-24 07:24:38 +00:00
|
|
|
'gstvkimageview.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkinstance.h',
|
|
|
|
'gstvkmemory.h',
|
2019-09-16 02:59:08 +00:00
|
|
|
'gstvkphysicaldevice.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkqueue.h',
|
2019-07-04 04:16:17 +00:00
|
|
|
'gstvkswapper.h',
|
2019-07-04 04:03:51 +00:00
|
|
|
'gstvktrash.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkutils.h',
|
2019-11-26 07:11:25 +00:00
|
|
|
'gstvkvideofilter.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'gstvkwindow.h',
|
|
|
|
'vulkan-prelude.h',
|
2019-08-05 01:31:48 +00:00
|
|
|
'vulkan_fwd.h',
|
2019-04-08 11:35:22 +00:00
|
|
|
'vulkan.h',
|
|
|
|
]
|
|
|
|
|
|
|
|
vulkan_xcb_headers = []
|
|
|
|
vulkan_wayland_headers = []
|
|
|
|
|
|
|
|
vulkan_windowing = false
|
|
|
|
vulkan_objc_args = []
|
|
|
|
vulkan_defines = []
|
|
|
|
optional_deps = []
|
2019-06-08 13:57:21 +00:00
|
|
|
has_vulkan_header = false
|
|
|
|
vulkan_dep = dependency('', required: false)
|
2019-09-25 12:36:58 +00:00
|
|
|
vulkan_inc_dir = ''
|
2019-04-08 11:35:22 +00:00
|
|
|
|
|
|
|
vulkan_conf = configuration_data()
|
|
|
|
vulkan_conf_options = [
|
|
|
|
'GST_VULKAN_HAVE_WINDOW_XCB',
|
|
|
|
'GST_VULKAN_HAVE_WINDOW_WAYLAND',
|
|
|
|
'GST_VULKAN_HAVE_WINDOW_COCOA',
|
|
|
|
'GST_VULKAN_HAVE_WINDOW_IOS',
|
2019-06-08 13:57:21 +00:00
|
|
|
'GST_VULKAN_HAVE_WINDOW_WIN32',
|
2019-10-16 06:17:51 +00:00
|
|
|
'GST_VULKAN_HAVE_WINDOW_ANDROID',
|
2019-04-08 11:35:22 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
foreach option : vulkan_conf_options
|
|
|
|
vulkan_conf.set10(option, false)
|
|
|
|
endforeach
|
|
|
|
|
2019-09-02 14:30:31 +00:00
|
|
|
if ['ios', 'darwin'].contains(host_system)
|
|
|
|
# - ios does not support the loader/validation layers
|
|
|
|
# - We need to link directly to MoltenVK to be able to use
|
|
|
|
# MoltenVK-specific functions that use dispatchable handles (like
|
|
|
|
# retrieving the metal device from the VkDevice) which is currently waiting
|
|
|
|
# on implementing a proper Metal extension for Vulkan
|
|
|
|
# https://github.com/KhronosGroup/MoltenVK/issues/492
|
2019-04-08 11:35:22 +00:00
|
|
|
vulkan_dep = cc.find_library('MoltenVK', required : get_option('vulkan'))
|
2019-06-08 13:57:21 +00:00
|
|
|
elif host_system == 'windows'
|
|
|
|
vulkan_root = run_command(python3, '-c', 'import os; print(os.environ.get("VK_SDK_PATH"))').stdout().strip()
|
|
|
|
if vulkan_root != '' and vulkan_root != 'None'
|
|
|
|
vulkan_lib_dir = ''
|
|
|
|
if build_machine.cpu_family() == 'x86_64'
|
|
|
|
vulkan_lib_dir = join_paths(vulkan_root, 'Lib')
|
|
|
|
else
|
|
|
|
vulkan_lib_dir = join_paths(vulkan_root, 'Lib32')
|
|
|
|
endif
|
|
|
|
|
|
|
|
vulkan_lib = cc.find_library('vulkan-1', dirs: vulkan_lib_dir,
|
|
|
|
required : get_option('vulkan'))
|
|
|
|
|
|
|
|
vulkan_inc_dir = join_paths(vulkan_root, 'Include')
|
2019-09-18 13:49:08 +00:00
|
|
|
has_vulkan_header = cc.has_header('vulkan/vulkan_core.h',
|
2019-06-08 13:57:21 +00:00
|
|
|
args: '-I' + vulkan_inc_dir)
|
|
|
|
|
|
|
|
if vulkan_lib.found() and has_vulkan_header
|
|
|
|
vulkan_dep = declare_dependency(include_directories: include_directories(vulkan_inc_dir),
|
|
|
|
dependencies: vulkan_lib)
|
|
|
|
endif
|
|
|
|
endif
|
2019-04-08 11:35:22 +00:00
|
|
|
else
|
2019-09-18 13:49:08 +00:00
|
|
|
vulkan_dep = dependency('vulkan', method: 'pkg-config', required : false)
|
|
|
|
if not vulkan_dep.found()
|
|
|
|
vulkan_dep = cc.find_library('vulkan', required : false)
|
|
|
|
endif
|
2019-04-08 11:35:22 +00:00
|
|
|
endif
|
2019-06-08 13:57:21 +00:00
|
|
|
|
|
|
|
if host_system != 'windows'
|
2019-09-18 13:49:08 +00:00
|
|
|
has_vulkan_header = cc.has_header('vulkan/vulkan_core.h')
|
2019-06-08 13:57:21 +00:00
|
|
|
endif
|
|
|
|
|
2019-04-08 11:35:22 +00:00
|
|
|
if not has_vulkan_header and get_option('vulkan').enabled()
|
|
|
|
error('vulkan plugin enabled, but vulkan.h not found')
|
|
|
|
endif
|
2019-09-18 13:49:08 +00:00
|
|
|
if not vulkan_dep.found() and get_option('vulkan').enabled()
|
|
|
|
error('vulkan plugin enabled, but could not find vulkan library')
|
|
|
|
endif
|
2019-04-08 11:35:22 +00:00
|
|
|
|
|
|
|
xcb_dep = dependency('xcb', version : '>=1.10', required : get_option('x11'))
|
2020-02-18 03:02:14 +00:00
|
|
|
xkbcommon_dep = dependency('xkbcommon', required : get_option('x11'))
|
|
|
|
xkbcommon_x11_dep = dependency('xkbcommon-x11', required : get_option('x11'))
|
|
|
|
|
|
|
|
if xcb_dep.found() and xkbcommon_dep.found() and xkbcommon_x11_dep.found() and cc.has_header('vulkan/vulkan_xcb.h', dependencies : vulkan_dep)
|
2019-04-08 11:35:22 +00:00
|
|
|
vulkan_sources += [
|
|
|
|
'xcb/gstvkdisplay_xcb.c',
|
|
|
|
'xcb/gstvkwindow_xcb.c',
|
|
|
|
'xcb/xcb_event_source.c',
|
|
|
|
]
|
|
|
|
vulkan_xcb_headers += [
|
|
|
|
'xcb/gstvkdisplay_xcb.h'
|
|
|
|
]
|
|
|
|
|
2020-02-18 03:02:14 +00:00
|
|
|
optional_deps += [xcb_dep, xkbcommon_dep, xkbcommon_x11_dep]
|
2019-04-08 11:35:22 +00:00
|
|
|
vulkan_windowing = true
|
|
|
|
vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_XCB', 1)
|
2020-02-18 03:02:14 +00:00
|
|
|
endif
|
2019-04-08 11:35:22 +00:00
|
|
|
|
|
|
|
wayland_client_dep = dependency('wayland-client', version : '>=1.4', required : get_option('wayland'))
|
2019-09-18 13:49:08 +00:00
|
|
|
if wayland_client_dep.found() and cc.has_header('vulkan/vulkan_wayland.h', dependencies : vulkan_dep)
|
2019-04-08 11:35:22 +00:00
|
|
|
vulkan_sources += [
|
|
|
|
'wayland/gstvkdisplay_wayland.c',
|
|
|
|
'wayland/gstvkwindow_wayland.c',
|
|
|
|
'wayland/wayland_event_source.c',
|
|
|
|
]
|
|
|
|
vulkan_wayland_headers += [
|
|
|
|
'wayland/gstvkdisplay_wayland.h'
|
|
|
|
]
|
|
|
|
|
|
|
|
optional_deps += wayland_client_dep
|
|
|
|
vulkan_windowing = true
|
|
|
|
vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_WAYLAND', 1)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if ['darwin', 'ios'].contains(host_system)
|
|
|
|
objc = meson.get_compiler('objc')
|
|
|
|
if not objc.has_argument('-fobjc-arc')
|
|
|
|
error('ARC is required for building')
|
|
|
|
endif
|
|
|
|
|
|
|
|
vulkan_objc_args += ['-fobjc-arc']
|
|
|
|
|
|
|
|
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'))
|
|
|
|
|
2019-09-18 13:49:08 +00:00
|
|
|
if cocoa_dep.found() and cc.has_header('vulkan/vulkan_macos.h', dependencies : vulkan_dep)
|
2019-04-08 11:35:22 +00:00
|
|
|
vulkan_sources += [
|
|
|
|
'cocoa/gstvkdisplay_cocoa.m',
|
|
|
|
'cocoa/gstvkwindow_cocoa.m',
|
|
|
|
]
|
|
|
|
optional_deps += [cocoa_dep]
|
|
|
|
vulkan_windowing = true
|
|
|
|
vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_COCOA', 1)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if host_system == 'ios'
|
|
|
|
uikit_dep = dependency('appleframeworks', modules : ['UIKit'], required : get_option('vulkan'))
|
|
|
|
|
2019-09-18 13:49:08 +00:00
|
|
|
if uikit_dep.found() and cc.has_header('vulkan/vulkan_ios.h', dependencies : vulkan_dep)
|
2019-04-08 11:35:22 +00:00
|
|
|
vulkan_sources += [
|
|
|
|
'ios/gstvkdisplay_ios.m',
|
|
|
|
'ios/gstvkwindow_ios.m',
|
|
|
|
]
|
|
|
|
optional_deps += [uikit_dep]
|
|
|
|
vulkan_windowing = true
|
|
|
|
vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_IOS', 1)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-06-08 13:57:21 +00:00
|
|
|
if host_system == 'windows'
|
|
|
|
gdi_dep = cc.find_library('gdi32', required : get_option('vulkan'))
|
|
|
|
|
2019-09-25 12:36:58 +00:00
|
|
|
# Cannot use internal dependency object with cc.has_header()
|
|
|
|
if gdi_dep.found() and cc.has_header('vulkan/vulkan_win32.h', args: '-I' + vulkan_inc_dir)
|
2019-06-08 13:57:21 +00:00
|
|
|
vulkan_sources += ['win32/gstvkwindow_win32.c']
|
|
|
|
optional_deps += [gdi_dep]
|
|
|
|
vulkan_windowing = true
|
|
|
|
vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_WIN32', 1)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-10-16 06:17:51 +00:00
|
|
|
if host_system == 'android'
|
|
|
|
if cc.has_header('vulkan/vulkan_android.h', dependencies : vulkan_dep)
|
|
|
|
vulkan_sources += [
|
|
|
|
'android/gstvkdisplay_android.c',
|
|
|
|
'android/gstvkwindow_android.c',
|
|
|
|
]
|
|
|
|
vulkan_windowing = true
|
|
|
|
vulkan_conf.set10('GST_VULKAN_HAVE_WINDOW_ANDROID', 1)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-04-08 11:35:22 +00:00
|
|
|
if not vulkan_windowing
|
|
|
|
warning('No Windowing system found. vulkansink will not work')
|
|
|
|
endif
|
|
|
|
|
2019-09-18 13:49:08 +00:00
|
|
|
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
|
2019-08-23 07:04:42 +00:00
|
|
|
|
2019-09-18 13:49:08 +00:00
|
|
|
gen_sources = []
|
|
|
|
|
|
|
|
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')
|
|
|
|
|
|
|
|
configure_file(input : 'gstvkconfig.h.meson',
|
|
|
|
output : 'gstvkconfig.h',
|
|
|
|
install_dir : join_paths(get_option('includedir'), 'gstreamer-1.0/gst/vulkan'),
|
|
|
|
configuration : vulkan_conf)
|
|
|
|
|
|
|
|
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 <gst/vulkan/vulkan-prelude.h>',
|
|
|
|
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]
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
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']
|
2019-04-08 11:35:22 +00:00
|
|
|
endif
|
|
|
|
|
2019-09-18 13:49:08 +00:00
|
|
|
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
|
2019-04-08 11:35:22 +00:00
|
|
|
endif
|
2019-09-18 13:49:08 +00:00
|
|
|
|
|
|
|
gstvulkan_dep = declare_dependency(link_with : gstvulkan,
|
|
|
|
include_directories : [libsinc],
|
|
|
|
sources: gen_sources,
|
|
|
|
dependencies : [gstvideo_dep, gstbase_dep, vulkan_dep] + optional_deps)
|