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