meson: bump the minimum wayland version requirement to 1.11.0
[platform/upstream/gstreamer.git] / meson.build
1 project('gstreamer-vaapi', 'c',
2   version : '1.15.1',
3   meson_version : '>= 0.47.0',
4   default_options : [ 'warning_level=1',
5                       'buildtype=debugoptimized' ])
6
7 gst_version = meson.project_version()
8 version_arr = gst_version.split('.')
9 gst_version_major = version_arr[0].to_int()
10 gst_version_minor = version_arr[1].to_int()
11 gst_version_micro = version_arr[2].to_int()
12  if version_arr.length() == 4
13   gst_version_nano = version_arr[3].to_int()
14 else
15   gst_version_nano = 0
16 endif
17
18 libva_req = ['>= 0.39.0', '!= 0.99.0']
19 glib_req = '>= 2.40.0'
20 libwayland_req = '>= 1.11.0'
21 gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)
22
23 cc = meson.get_compiler('c')
24
25 if cc.has_link_argument('-Wl,-Bsymbolic-functions')
26   add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
27 endif
28
29 # Symbol visibility
30 if cc.has_argument('-fvisibility=hidden')
31   add_project_arguments('-fvisibility=hidden', language: 'c')
32 endif
33
34 # Disable strict aliasing
35 if cc.has_argument('-fno-strict-aliasing')
36   add_project_arguments('-fno-strict-aliasing', language: 'c')
37 endif
38
39 # Mandatory GST deps
40 libm = cc.find_library('m', required : false)
41 gst_dep = dependency('gstreamer-1.0', version : gst_req,
42   fallback : ['gstreamer', 'gst_dep'])
43 gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
44   fallback : ['gstreamer', 'gst_base_dep'])
45 gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
46     fallback : ['gst-plugins-base', 'pbutils_dep'])
47 gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
48     fallback : ['gst-plugins-base', 'allocators_dep'])
49 gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
50     fallback : ['gst-plugins-base', 'video_dep'])
51 gstcodecparsers_dep = dependency('gstreamer-codecparsers-1.0', version : gst_req,
52     fallback : ['gst-plugins-bad', 'gstcodecparsers_dep'])
53 gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req,
54     fallback : ['gst-plugins-base', 'gstgl_dep'], required: false)
55 gmodule_dep = dependency('gmodule-2.0', required: false)
56 libva_dep = dependency('libva', version: libva_req)
57
58 libva_drm_dep = dependency('libva-drm', version: libva_req, required: false)
59 libva_wayland_dep = dependency('libva-wayland', version: libva_req, required: false)
60 libva_x11_dep = dependency('libva-x11', version: libva_req, required: false)
61 libdrm_dep = dependency('libdrm', required: false)
62 libudev_dep = dependency('libudev', required: false)
63 egl_dep = dependency('egl', required: false)
64 gl_dep = dependency('gl', required: false)
65 glesv2_dep = dependency('glesv2', required: false)
66 libdl_dep = cc.find_library('dl', required: false)
67 wayland_client_dep = dependency('wayland-client', version: libwayland_req, required: false)
68 x11_dep = dependency('x11', required: false)
69 xrandr_dep = dependency('xrandr', required: false)
70 xrender_dep = dependency('xrender', required: false)
71
72 # some of the examples can use GTK+-3
73 gtk_dep = dependency('gtk+-3.0', version : '>= 3.10', required : get_option('examples'))
74
75 GLES_VERSION_MASK = gl_dep.found() ? 1 : 0
76 if glesv2_dep.found()
77   if (cc.has_header('GLES2/gl2.h', dependencies: glesv2_dep) and
78       cc.has_header('GLES2/gl2ext.h', dependencies: glesv2_dep))
79     GLES_VERSION_MASK += 4
80   endif
81   if (cc.has_header('GLES3/gl3.h', dependencies: glesv2_dep) and
82       cc.has_header('GLES3/gl3ext.h', dependencies: glesv2_dep) and
83       cc.has_header('GLES2/gl2ext.h', dependencies: glesv2_dep))
84     GLES_VERSION_MASK += 8
85   endif
86 endif
87
88 USE_ENCODERS = get_option('with_encoders') != 'no'
89 USE_VP9_ENCODER = USE_ENCODERS and cc.has_header('va/va_enc_vp9.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
90 USE_H264_FEI_ENCODER = USE_ENCODERS and cc.has_header('va/va_fei_h264.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
91
92 USE_DRM = libva_drm_dep.found() and libdrm_dep.found() and libudev_dep.found() and get_option('with_drm') != 'no'
93 USE_EGL = gmodule_dep.found() and egl_dep.found() and GLES_VERSION_MASK != 0 and get_option('with_egl') != 'no'
94 USE_GLX = libva_x11_dep.found() and x11_dep.found() and gl_dep.found() and libdl_dep.found() and get_option('with_glx') != 'no'
95 USE_WAYLAND = libva_wayland_dep.found() and wayland_client_dep.found() and get_option('with_wayland') != 'no'
96 USE_X11 = libva_x11_dep.found() and x11_dep.found() and get_option('with_x11') != 'no'
97
98 driverdir = libva_dep.get_pkgconfig_variable('driverdir')
99 if driverdir == ''
100   driverdir = '@0@/@1@/@2@'.format(get_option('prefix'), get_option('libdir'), 'dri')
101 endif
102
103 cdata = configuration_data()
104 cdata.set('GST_API_VERSION_S', '"@0@.@1@"'.format(gst_version_major, gst_version_minor))
105 cdata.set('PACKAGE', '"gstreamer-vaapi"')
106 cdata.set('VERSION', '"@0@"'.format(gst_version))
107 cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
108 cdata.set('PACKAGE_NAME', '"GStreamer VA-API Plug-ins"')
109 cdata.set('PACKAGE_STRING', '"GStreamer VA-API Plug-ins @0@"'.format(gst_version))
110 cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
111 cdata.set('VA_DRIVERS_PATH', '"@0@"'.format(driverdir))
112 cdata.set10('USE_DRM', USE_DRM)
113 cdata.set10('USE_EGL', USE_EGL)
114 cdata.set10('USE_ENCODERS', USE_ENCODERS)
115 cdata.set10('USE_GLX', USE_GLX)
116 cdata.set10('USE_VP9_ENCODER', USE_VP9_ENCODER)
117 cdata.set10('USE_H264_FEI_ENCODER', USE_H264_FEI_ENCODER)
118 cdata.set10('USE_WAYLAND', USE_WAYLAND)
119 cdata.set10('USE_X11', USE_X11)
120 cdata.set10('HAVE_XKBLIB', cc.has_header('X11/XKBlib.h', dependencies: x11_dep))
121 cdata.set10('HAVE_XRANDR', xrandr_dep.found())
122 cdata.set10('HAVE_XRENDER', xrender_dep.found())
123 cdata.set10('USE_GST_GL_HELPERS', gstgl_dep.found())
124 cdata.set('USE_GLES_VERSION_MASK', GLES_VERSION_MASK)
125
126 api_version = '1.0'
127 soversion = 0
128 # maintaining compatibility with the previous libtool versioning
129 # current = minor * 100 + micro
130 curversion = gst_version_minor * 100 + gst_version_micro
131 libversion = '@0@.@1@.0'.format(soversion, curversion)
132 osxversion = curversion + 1
133
134 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
135
136 configure_file(configuration: cdata, output: 'config.h')
137 gstreamer_vaapi_args = ['-DHAVE_CONFIG_H']
138 configinc = include_directories('.')
139 libsinc = include_directories('gst-libs')
140
141 subdir('gst-libs')
142 subdir('gst')
143 if not get_option('examples').disabled()
144   subdir('tests')
145 endif
146
147 python3 = import('python3').find_python()
148 run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')