21 # Define a not-found dependency so this variable is always defined when we're
22 # deciding whether to build the qt5 examples
23 qt5qml_dep = dependency('', required: false)
24 qt5_option = get_option('qt5')
26 if qt5_option.disabled()
31 if qt5_option.enabled()
32 error('qt5 qmlglsink plugin is enabled, but gstreamer-gl-1.0 was not found')
37 if not add_languages('cpp', native: false, required: qt5_option)
41 qt5_mod = import('qt5')
42 qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
43 required: qt5_option, static: host_machine.system() == 'ios')
45 # On Linux, distros often have the Qt5 pkg-config files and moc in separate
46 # packages, so the user may not have both installed. Check for moc and ensure
47 # that it's installed.
48 # We don't do this check on other OSes because they need to be able to simply
49 # point the `QMAKE` env var to `qmake` to build against a particular Qt5.
50 if host_system == 'linux' and not meson.is_cross_build()
51 moc = find_program('moc-qt5', 'moc', required : qt5_option)
53 # We only check if `moc` was found, and then discard it, so we can fake it.
54 # This is also a good unit test of the fact that we *don't* use it.
55 moc = declare_dependency()
58 if not qt5qml_dep.found() or not moc.found()
64 have_qpa_include = false
65 have_qt_windowing = false
67 # Look for the QPA platform native interface header
68 qpa_header_path = join_paths(qt5qml_dep.version(), 'QtGui')
69 qpa_header = join_paths(qpa_header_path, 'qpa/qplatformnativeinterface.h')
70 if cxx.has_header(qpa_header, dependencies : qt5qml_dep)
71 qt_defines += '-DHAVE_QT_QPA_HEADER'
72 qt_defines += '-DQT_QPA_HEADER=' + '<@0@>'.format(qpa_header)
73 have_qpa_include = true
74 message('Found QtGui QPA header in ' + qpa_header_path)
77 # Try to come up with all the platform/winsys combinations that will work
79 if gst_gl_have_window_x11 and gst_gl_have_platform_glx
81 qt5x11extras = dependency('qt5', modules : ['X11Extras'], required : false)
82 if qt5x11extras.found()
83 optional_deps += [qt5x11extras, gstglx11_dep]
84 qt_defines += ['-DHAVE_QT_X11']
85 have_qt_windowing = true
89 if gst_gl_have_platform_egl
90 # Embedded linux (e.g. i.MX6) with or without windowing support
91 qt_defines += ['-DHAVE_QT_EGLFS']
92 optional_deps += gstglegl_dep
93 have_qt_windowing = true
96 if gst_gl_have_window_wayland
98 qt5waylandextras = dependency('qt5', modules : ['WaylandClient'], required : false)
99 if qt5waylandextras.found()
100 optional_deps += [qt5waylandextras, gstglwayland_dep]
101 qt_defines += ['-DHAVE_QT_WAYLAND']
102 have_qt_windowing = true
106 if gst_gl_have_window_android
108 qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], required : false)
109 # for gl functions in QtGui/qopenglfunctions.h
111 glesv2_dep = cc.find_library('GLESv2', required : false)
112 if glesv2_dep.found() and qt5androidextras.found()
113 optional_deps += [qt5androidextras, glesv2_dep]
114 qt_defines += ['-DHAVE_QT_ANDROID']
115 have_qt_windowing = true
116 # Needed for C++11 support in Cerbero. People building with Android
117 # in some other way need to add the necessary bits themselves.
118 optional_deps += dependency('gnustl', required : false)
124 if gst_gl_have_platform_wgl and gst_gl_have_window_win32
125 # for wglMakeCurrent()
127 opengl32_dep = cc.find_library('opengl32', required : false)
128 if opengl32_dep.found()
129 qt_defines += ['-DHAVE_QT_WIN32']
130 optional_deps += opengl32_dep
131 have_qt_windowing = true
135 if gst_gl_have_window_cocoa and gst_gl_have_platform_cgl
137 qt5macextras = dependency('qt5', modules : ['MacExtras'], required : false)
138 if qt5macextras.found()
139 qt_defines += ['-DHAVE_QT_MAC']
140 optional_deps += qt5macextras
141 have_qt_windowing = true
145 if gst_gl_have_window_eagl and gst_gl_have_platform_eagl
146 if host_machine.system() == 'ios'
147 qt_defines += ['-DHAVE_QT_IOS']
148 have_qt_windowing = true
154 moc_files = qt5_mod.preprocess(moc_headers : moc_headers)
155 gstqmlgl = library('gstqmlgl', sources, moc_files,
156 cpp_args : gst_plugins_good_args + qt_defines,
157 link_args : noseh_link_args,
158 include_directories: [configinc, libsinc],
159 dependencies : [glib_deps, gst_dep, gstvideo_dep, gstgl_dep, gstglproto_dep, qt5qml_dep, optional_deps],
160 override_options : ['cpp_std=c++11'],
162 install_dir : plugins_install_dir)
163 pkgconfig.generate(gstqmlgl, install_dir : plugins_pkgconfig_install_dir)
164 plugins += [gstqmlgl]