summaryrefslogtreecommitdiff
path: root/subprojects/gst-plugins-good/ext/qt6/meson.build
blob: 88a74d354d8d41a28aa0d03e98327b7854c126ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
sources = [
  'gstplugin.cc',
  'gstqt6element.cc',
  'gstqsg6glnode.cc',
  'gstqt6glutility.cc',
  'gstqml6glsink.cc',
  'gstqml6glsrc.cc',
  'gstqml6gloverlay.cc',
  'qt6glitem.cc',
  'qt6glwindow.cc',
  'qt6glrenderer.cc',
]

moc_headers = [
  'qt6glitem.h',
  'gstqsg6glnode.h',
  'qt6glwindow.h',
  'qt6glrenderer.h',
]

qt6qml_dep = dependency('', required: false)
qt6_option = get_option('qt6')
qt6_method = get_option('qt-method')

if qt6_option.disabled()
  subdir_done()
endif

if not have_gstgl
  if qt6_option.enabled()
    error('qt6 qmlglsink plugin is enabled, but gstreamer-gl-1.0 was not found')
  endif
  subdir_done()
endif

if not add_languages('cpp', native: false, required: qt6_option)
  subdir_done()
endif

qt6_mod = import('qt6')
if not qt6_mod.has_tools()
  if qt6_option.enabled()
    error('qt6 qmlglsink plugin is enabled, but qt specific tools were not found')
  endif
  subdir_done()
endif

qt6qml_dep = dependency('qt6', modules : ['Core', 'Gui', 'Qml', 'Quick'],
                        method: qt6_method, required: qt6_option, static: host_system == 'ios')
if not qt6qml_dep.found()
  subdir_done()
endif

optional_deps = []
qt_defines = []
have_qpa_include = false
have_qt_windowing = false

# Look for the QPA platform native interface header
qpa_header_path = join_paths(qt6qml_dep.version(), 'QtGui')
qpa_header = join_paths(qpa_header_path, 'qpa/qplatformnativeinterface.h')
if cxx.has_header(qpa_header, dependencies : qt6qml_dep)
  qt_defines += '-DHAVE_QT_QPA_HEADER'
  qt_defines += '-DQT_QPA_HEADER=' + '<@0@>'.format(qpa_header)
  have_qpa_include = true
  message('Found QtGui QPA header in ' + qpa_header_path)
endif

# Try to come up with all the platform/winsys combinations that will work

if gst_gl_have_window_x11 and gst_gl_have_platform_glx
  # FIXME: automagic
  qt_defines += ['-DHAVE_QT_X11']
  have_qt_windowing = true
endif

if gst_gl_have_platform_egl
  # Embedded linux (e.g. i.MX6) with or without windowing support
  qt_defines += ['-DHAVE_QT_EGLFS']
  optional_deps += gstglegl_dep
  have_qt_windowing = true
  if have_qpa_include
    # Wayland windowing
    if gst_gl_have_window_wayland
      # FIXME: automagic
      qt6waylandextras = dependency('qt6', modules : ['WaylandClient'], method: qt6_method, required : false)
      if qt6waylandextras.found()
        optional_deps += [qt6waylandextras, gstglwayland_dep]
        qt_defines += ['-DHAVE_QT_WAYLAND']
        have_qt_windowing = true
      endif
    endif
    # Android windowing
#    if gst_gl_have_window_android
      # FIXME: automagic
#      qt5androidextras = dependency('qt5', modules : ['AndroidExtras'], method: qt6_method, required : false)
      # for gl functions in QtGui/qopenglfunctions.h
      # FIXME: automagic
#      glesv2_dep = cc.find_library('GLESv2', required : false)
#      if glesv2_dep.found() and qt5androidextras.found()
#        optional_deps += [qt5androidextras, glesv2_dep]
#        qt_defines += ['-DHAVE_QT_ANDROID']
#        have_qt_windowing = true
        # Needed for C++11 support in Cerbero. People building with Android
        # in some other way need to add the necessary bits themselves.
#        optional_deps += dependency('gnustl', required : false)
#      endif
#    endif
  endif
endif

#if gst_gl_have_platform_wgl and gst_gl_have_window_win32
  # for wglMakeCurrent()
  # FIXME: automagic
#  opengl32_dep = cc.find_library('opengl32', required : false)
#  if opengl32_dep.found()
#    qt_defines += ['-DHAVE_QT_WIN32']
#    optional_deps += opengl32_dep
#    have_qt_windowing = true
#  endif
#endif

if gst_gl_have_window_cocoa and gst_gl_have_platform_cgl
  # FIXME: automagic
  if host_machine.system() == 'darwin'
    qt_defines += ['-DHAVE_QT_MAC']
    have_qt_windowing = true
  endif
endif

if gst_gl_have_window_eagl and gst_gl_have_platform_eagl
  if host_machine.system() == 'ios'
    qt_defines += ['-DHAVE_QT_IOS']
    have_qt_windowing = true
  endif
endif

if have_qt_windowing
  # Build it!
  moc_files = qt6_mod.preprocess(moc_headers : moc_headers)
  gstqml6gl = library('gstqml6', sources, moc_files,
    cpp_args : gst_plugins_good_args + qt_defines,
    link_args : noseh_link_args,
    include_directories: [configinc, libsinc],
    dependencies : [gst_dep, gstvideo_dep, gstgl_dep, gstglproto_dep, qt6qml_dep, optional_deps],
    override_options : ['cpp_std=c++17'],
    install: true,
    install_dir : plugins_install_dir)
  pkgconfig.generate(gstqml6gl, install_dir : plugins_pkgconfig_install_dir)
  plugins += [gstqml6gl]
endif