This repository has been archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
meson.build
209 lines (175 loc) · 5.67 KB
/
meson.build
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# This project use C source code
project('GstMfx', 'c',
version: '1.4.0.11',
meson_version: '>= 0.35.0',
default_options: ['warning_level=1',
'buildtype=debugoptimized'])
mfx_version = meson.project_version()
version_arr = mfx_version.split('.')
mfx_version_major = version_arr[0]
mfx_version_minor = version_arr[1]
mfx_version_micro = version_arr[2]
soversion = 0
libversion = '@0@.@[email protected]'.format(soversion, mfx_version_minor.to_int() * 100 + mfx_version_micro.to_int())
cdata = configuration_data()
cdata.set ('GstMfx_PACKAGE', 'gstmfx')
cdata.set ('GstMfx_PACKAGE_NAME', 'GStreamer Media SDK')
cdata.set ('GstMfx_VERSION', '@0@'.format(mfx_version))
cdata.set ('GstMfx_PACKAGE_TARNAME', 'gstreamer-msdk')
configure_file (input: 'version.h.in',
output: 'version.h',
configuration: cdata)
mfx_sources = []
mfx_c_args = []
mfx_deps = []
mfx_c_args += ['-std=gnu99', '-fPIE', '-fPIC']
# Check the Media SDK
mfx_home = get_option ('MFX_HOME')
mfx_inc = include_directories(['.', 'gst/mfx', 'gst-libs/mfx', 'parsers', '@0@/include'.format(mfx_home)])
compiler = meson.get_compiler('c')
libmfx = compiler.find_library('mfx', dirs: '@0@/lib/lin_x64/'.format(mfx_home))
mfx_deps += [libmfx]
libstdcc = compiler.find_library('stdc++')
mfx_deps += [libstdcc]
libdl = compiler.find_library('dl')
mfx_deps += [libdl]
# Check base dependencies
glib_deps = [dependency('glib-2.0'), dependency('gobject-2.0'), dependency('gio-2.0'), dependency('gmodule-2.0')]
mfx_deps += glib_deps
gst_req = '>= 1.6.0'
gst_dep = dependency('gstreamer-1.0', version: gst_req,
fallback: ['gstreamer', 'gst_dep'])
gstvideo_dep = dependency('gstreamer-video-1.0', version: gst_req,
fallback: ['gst-plugins-base', 'video_dep'])
gstallocators_dep = dependency('gstreamer-allocators-1.0', version: gst_req,
fallback: ['gst-plugins-base', 'allocators_dep'])
gstcodecparsers_dep = dependency('gstreamer-codecparsers-1.0', version: gst_req,
fallback: ['gst-plugins-bad', 'gstcodecparsers_dep'], required: false)
gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version: gst_req,
fallback: ['gst-plugins-base', 'pbutils_dep'], required: false)
mfx_deps += [gst_dep, gstvideo_dep, gstallocators_dep]
with_codecparsers = false
if gstcodecparsers_dep.found()
mfx_deps += [gstcodecparsers_dep]
with_codecparsers = true
endif
with_pbutils = false
if gstpbutils_dep.found()
mfx_deps += [gstpbutils_dep]
with_pbutils = true
endif
driver_deps = [dependency ('libva'), dependency ('libdrm'), dependency ('libdrm_intel'),
dependency ('libva-drm'), dependency('libudev')]
mfx_deps += driver_deps
# Parse common user options
with_mss = get_option('WITH_MSS_2016')
if with_mss
mfx_c_args += ['-DWITH_MSS_2016']
endif
mfx_decoder = get_option('MFX_DECODER')
if mfx_decoder
mfx_c_args += ['-DMFX_DECODER']
endif
mfx_sink = get_option('MFX_SINK')
with_wayland = false
with_x11 = false
if mfx_sink
mfx_c_args += ['-DMFX_SINK']
if get_option ('WITH_WAYLAND') != 'no'
need_wayland = get_option ('WITH_WAYLAND') == 'yes'
wayland_client_dep = dependency('wayland-client',
required: need_wayland)
if wayland_client_dep.found()
with_wayland = true
mfx_deps += wayland_client_dep
if dependency('weston', version: '>=3.0.0', required: false).found()
mfx_c_args += ['-DUSE_WESTON_4_0']
endif
endif
wayland_cursor_dep = dependency('wayland-cursor',
required: false)
if wayland_cursor_dep.found()
mfx_deps += wayland_cursor_dep
endif
endif
if get_option ('WITH_X11') != 'no'
need_x11 = get_option ('WITH_X11') == 'yes'
x11_dep = dependency('x11', required: need_x11)
if x11_dep.found()
with_x11 = true
mfx_deps += [x11_dep]
endif
x11_optional_deps = [
['xcb-dri3', '-DHAVE_XCBDRI3'],
['xcb-present', '-DHAVE_XCBPRESENT'],
['xkb-common', '-DHAVE_XKBLIB'],
['xrandr', '-DHAVE_XRANDR'],
['xrender', '-DHAVE_XRENDER'],
['x11-xcb', '-DHAVE_X11XCB'],
]
foreach d: x11_optional_deps
dep = dependency(d.get(0), required: false)
if dep.found()
mfx_deps += [dep]
mfx_c_args += [d.get(1)]
endif
endforeach
endif
else
foreach opt: ['WITH_WAYLAND', 'WITH_X11', 'USE_EGL_RENDERER']
if get_option (opt) == 'yes'
error('@0@ required but MFX_SINK is false'.format(opt))
endif
endforeach
endif
use_egl_renderer = false
if with_wayland
mfx_c_args += ['-DWITH_WAYLAND']
if get_option ('USE_WAYLAND_RENDERER') != 'no'
mfx_c_args += ['-DUSE_WAYLAND']
endif
if get_option ('USE_EGL_RENDERER') != 'no'
need_egl = get_option ('USE_EGL_RENDERER') == 'yes'
egl_dep = dependency('egl', required: need_egl)
egl_wayland_dep = dependency('wayland-egl', required: need_egl)
if egl_dep.found() and egl_wayland_dep.found()
use_egl_renderer = true
mfx_deps += [egl_dep, egl_wayland_dep]
mfx_c_args += ['-DUSE_EGL']
endif
endif
elif get_option ('USE_WAYLAND_RENDERER') == 'yes'
error('USE_WAYLAND_RENDERER required but WITH_WAYLAND is false')
endif
if with_x11
mfx_c_args += ['-DWITH_X11']
if get_option ('USE_DRI3_RENDERER') != 'no'
mfx_c_args += ['-DUSE_DRI3']
endif
if use_egl_renderer == false
need_egl = get_option ('USE_EGL_RENDERER') == 'yes'
egl_dep = dependency('egl', required: need_egl)
if egl_dep.found()
use_egl_renderer = true
egl_deps = [egl_dep]
mfx_deps += egl_deps
mfx_c_args += ['-DUSE_EGL']
endif
endif
elif get_option ('USE_DRI3_RENDERER') == 'yes'
error('USE_DRI3_RENDERER required but WITH_WAYLAND is false')
endif
mfx_encoder = get_option('MFX_ENCODER')
subdir('gst-libs')
subdir('gst')
subdir('parsers')
gstvideo = shared_library('gstmfx',
mfx_sources,
c_args: mfx_c_args,
include_directories: mfx_inc,
version: libversion,
soversion: soversion,
install: true,
install_dir: 'lib/gstreamer-1.0',
dependencies: mfx_deps,
)