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')
25 qt5_method = get_option('qt-method')
27 if qt5_option.disabled()
32 if qt5_option.enabled()
33 error('qt5 qmlglsink plugin is enabled, but gstreamer-gl-1.0 was not found')
38 if not add_languages('cpp', native: false, required: qt5_option)
42 qt5_mod = import('qt5')
43 qt5qml_dep = dependency('qt5', modules : ['Core', 'Gui', 'Qml', 'Quick'],
44 method: qt5_method, required: qt5_option, static: host_system == 'ios')
46 # On Linux, distros often have the Qt5 pkg-config files and moc in separate
47 # packages, so the user may not have both installed. Check for moc and ensure
48 # that it's installed.
49 # We don't do this check on other OSes because they need to be able to simply
50 # point the `QMAKE` env var to `qmake` to build against a particular Qt5.
51 if host_system == 'linux' and not meson.is_cross_build()
52 moc = find_program('moc-qt5', 'moc', required : qt5_option)
54 # We only check if `moc` was found, and then discard it, so we can fake it.
55 # This is also a good unit test of the fact that we *don't* use it.
56 moc = declare_dependency()
59 if not qt5qml_dep.found() or not moc.found()
65 have_qpa_include = false
66 have_qt_windowing = false
68 # Look for the QPA platform native interface header
69 qpa_header_path = join_paths(qt5qml_dep.version(), 'QtGui')
70 qpa_header = join_paths(qpa_header_path, 'qpa/qplatformnativeinterface.h')
71 if cxx.has_header(qpa_header, dependencies : qt5qml_dep)
72 qt_defines += '-DHAVE_QT_QPA_HEADER'
73 qt_defines += '-DQT_QPA_HEADER=' + '<@0@>'.format(qpa_header)
74 have_qpa_include = true
75 message('Found QtGui QPA header in ' + qpa_header_path)
78 # Try to come up with all the platform/winsys combinations that will work
80 if gst_gl_have_window_x11 and gst_gl_have_platform_glx
82 qt5x11extras = dependency('qt5', modules : ['X11Extras'], method: qt5_method, required : false)
83 if qt5x11extras.found()
84 optional_deps += [qt5x11extras, gstglx11_dep]
85 qt_defines += ['-DHAVE_QT_X11']
86 have_qt_windowing = true
90 if gst_gl_have_platform_egl
91 # Embedded linux (e.g. i.MX6) with or without windowing support
92 qt_defines += ['-DHAVE_QT_EGLFS']
93 optional_deps += gstglegl_dep
94 have_qt_windowing = true
97 if gst_gl_have_window_wayland
99 qt5waylandextras = dependency('qt5', modules : ['WaylandClient'], method: qt5_method, required : false)
100 if qt5waylandextras.found()
101 optional_deps += [qt5waylandextras, gstglwayland_dep]
102 qt_defines += ['-DHAVE_QT_WAYLAND']
103 have_qt_windowing = true
107 if gst_gl_have_window_android
109 qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], method: qt5_method, required : false)
110 # for gl functions in QtGui/qopenglfunctions.h
112 glesv2_dep = cc.find_library('GLESv2', required : false)
113 if glesv2_dep.found() and qt5androidextras.found()
114 optional_deps += [qt5androidextras, glesv2_dep]
115 qt_defines += ['-DHAVE_QT_ANDROID']
116 have_qt_windowing = true
117 # Needed for C++11 support in Cerbero. People building with Android
118 # in some other way need to add the necessary bits themselves.
119 optional_deps += dependency('gnustl', required : false)
125 if gst_gl_have_platform_wgl and gst_gl_have_window_win32
126 # for wglMakeCurrent()
128 opengl32_dep = cc.find_library('opengl32', required : false)
129 if opengl32_dep.found()
130 qt_defines += ['-DHAVE_QT_WIN32']
131 optional_deps += opengl32_dep
132 have_qt_windowing = true
136 if gst_gl_have_window_cocoa and gst_gl_have_platform_cgl
138 qt5macextras = dependency('qt5', modules : ['MacExtras'], method: qt5_method, required : false)
139 if qt5macextras.found()
140 qt_defines += ['-DHAVE_QT_MAC']
141 optional_deps += qt5macextras
142 have_qt_windowing = true
146 if gst_gl_have_window_eagl and gst_gl_have_platform_eagl
147 if host_machine.system() == 'ios'
148 qt_defines += ['-DHAVE_QT_IOS']
149 have_qt_windowing = true
154 # rpath is needed to be able to load the plugin on macOS inside the devenv
156 if host_system == 'darwin'
158 qt_bindir = fs.parent(find_program('qmake').full_path())
159 qt_libdir = fs.parent(qt_bindir) / 'lib'
160 qmlgl_kwargs += {'build_rpath': qt_libdir}
164 moc_files = qt5_mod.preprocess(moc_headers : moc_headers)
165 gstqmlgl = library('gstqmlgl', sources, moc_files,
166 cpp_args : gst_plugins_good_args + qt_defines,
167 link_args : noseh_link_args,
168 include_directories: [configinc, libsinc],
169 dependencies : [gst_dep, gstvideo_dep, gstgl_dep, gstglproto_dep, qt5qml_dep, optional_deps],
170 override_options : ['cpp_std=c++11'],
171 kwargs: qmlgl_kwargs,
173 install_dir : plugins_install_dir)
174 plugins += [gstqmlgl]