meson.build 7.22 KB
Newer Older
1
project('gstreamer-vaapi', 'c',
2
  version : '1.17.0.1',
Thibault Saunier's avatar
Thibault Saunier committed
3
  meson_version : '>= 0.48.0',
4 5 6 7 8
  default_options : [ 'warning_level=1',
                      'buildtype=debugoptimized' ])

gst_version = meson.project_version()
version_arr = gst_version.split('.')
9 10 11 12 13
gst_version_major = version_arr[0].to_int()
gst_version_minor = version_arr[1].to_int()
gst_version_micro = version_arr[2].to_int()
 if version_arr.length() == 4
  gst_version_nano = version_arr[3].to_int()
14 15 16 17
else
  gst_version_nano = 0
endif

18
libva_req = ['>= 0.39.0', '!= 0.99.0']
19
glib_req = '>= 2.44.0'
20
libwayland_req = '>= 1.11.0'
21 22 23 24
gst_req = '>= @0@.@1@.0'.format(gst_version_major, gst_version_minor)

cc = meson.get_compiler('c')

25 26 27 28
if cc.has_link_argument('-Wl,-Bsymbolic-functions')
  add_project_link_arguments('-Wl,-Bsymbolic-functions', language : 'c')
endif

29 30 31 32 33
# Symbol visibility
if cc.has_argument('-fvisibility=hidden')
  add_project_arguments('-fvisibility=hidden', language: 'c')
endif

34 35 36 37 38
# Disable strict aliasing
if cc.has_argument('-fno-strict-aliasing')
  add_project_arguments('-fno-strict-aliasing', language: 'c')
endif

39
# Mandatory GST deps
40 41 42 43 44 45 46 47 48 49 50 51
libm = cc.find_library('m', required : false)
gst_dep = dependency('gstreamer-1.0', version : gst_req,
  fallback : ['gstreamer', 'gst_dep'])
gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
  fallback : ['gstreamer', 'gst_base_dep'])
gstpbutils_dep = dependency('gstreamer-pbutils-1.0', version : gst_req,
    fallback : ['gst-plugins-base', 'pbutils_dep'])
gstallocators_dep = dependency('gstreamer-allocators-1.0', version : gst_req,
    fallback : ['gst-plugins-base', 'allocators_dep'])
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
    fallback : ['gst-plugins-base', 'video_dep'])
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72

# Disable compiler warnings for unused variables and args if gst debug system is disabled
if gst_dep.type_name() == 'internal'
  gst_debug_disabled = not subproject('gstreamer').get_variable('gst_debug')
else
  # We can't check that in the case of subprojects as we won't
  # be able to build against an internal dependency (which is not built yet)
  gst_debug_disabled = cc.has_header_symbol('gst/gstconfig.h', 'GST_DISABLE_GST_DEBUG', dependencies: gst_dep)
endif

if gst_debug_disabled
  message('GStreamer debug system is disabled')
  add_project_arguments(cc.get_supported_arguments(['-Wno-unused']), language: 'c')
else
  message('GStreamer debug system is enabled')
endif

# Other deps
73
gmodule_dep = dependency('gmodule-2.0', required: false)
74
libva_dep = dependency('libva', version: libva_req)
75

76 77 78
libva_drm_dep = dependency('libva-drm', version: libva_req, required: false)
libva_wayland_dep = dependency('libva-wayland', version: libva_req, required: false)
libva_x11_dep = dependency('libva-x11', version: libva_req, required: false)
79 80 81 82 83
libdrm_dep = dependency('libdrm', required: false)
libudev_dep = dependency('libudev', required: false)
egl_dep = dependency('egl', required: false)
gl_dep = dependency('gl', required: false)
glesv2_dep = dependency('glesv2', required: false)
84
libdl_dep = cc.find_library('dl', required: false)
85
wayland_client_dep = dependency('wayland-client', version: libwayland_req, required: false)
86 87
wayland_protocols_dep = dependency('wayland-protocols', version: '>= 1.15', required: false)
wayland_scanner_bin = find_program('wayland-scanner', required: false)
88 89 90 91
x11_dep = dependency('x11', required: false)
xrandr_dep = dependency('xrandr', required: false)
xrender_dep = dependency('xrender', required: false)

92 93 94
# some of the examples can use GTK+-3
gtk_dep = dependency('gtk+-3.0', version : '>= 3.10', required : get_option('examples'))

95 96 97 98 99 100 101 102 103 104 105 106
GLES_VERSION_MASK = gl_dep.found() ? 1 : 0
if glesv2_dep.found()
  if (cc.has_header('GLES2/gl2.h', dependencies: glesv2_dep) and
      cc.has_header('GLES2/gl2ext.h', dependencies: glesv2_dep))
    GLES_VERSION_MASK += 4
  endif
  if (cc.has_header('GLES3/gl3.h', dependencies: glesv2_dep) and
      cc.has_header('GLES3/gl3ext.h', dependencies: glesv2_dep) and
      cc.has_header('GLES2/gl2ext.h', dependencies: glesv2_dep))
    GLES_VERSION_MASK += 8
  endif
endif
107

108
USE_ENCODERS = get_option('with_encoders') != 'no'
109
USE_VP9_ENCODER = USE_ENCODERS and cc.has_header('va/va_enc_vp9.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
110
USE_H264_FEI_ENCODER = USE_ENCODERS and cc.has_header('va/va_fei_h264.h', dependencies: libva_dep, prefix: '#include <va/va.h>')
111 112 113 114

USE_DRM = libva_drm_dep.found() and libdrm_dep.found() and libudev_dep.found() and get_option('with_drm') != 'no'
USE_EGL = gmodule_dep.found() and egl_dep.found() and GLES_VERSION_MASK != 0 and get_option('with_egl') != 'no'
USE_GLX = libva_x11_dep.found() and x11_dep.found() and gl_dep.found() and libdl_dep.found() and get_option('with_glx') != 'no'
115
USE_WAYLAND = libva_wayland_dep.found() and wayland_client_dep.found() and wayland_protocols_dep.found() and wayland_scanner_bin.found() and get_option('with_wayland') != 'no'
116 117
USE_X11 = libva_x11_dep.found() and x11_dep.found() and get_option('with_x11') != 'no'

118
driverdir = libva_dep.get_pkgconfig_variable('driverdir')
119 120 121 122
if driverdir == ''
  driverdir = '@0@/@1@/@2@'.format(get_option('prefix'), get_option('libdir'), 'dri')
endif

123 124 125 126 127 128 129 130
cdata = configuration_data()
cdata.set('GST_API_VERSION_S', '"@0@.@1@"'.format(gst_version_major, gst_version_minor))
cdata.set('PACKAGE', '"gstreamer-vaapi"')
cdata.set('VERSION', '"@0@"'.format(gst_version))
cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
cdata.set('PACKAGE_NAME', '"GStreamer VA-API Plug-ins"')
cdata.set('PACKAGE_STRING', '"GStreamer VA-API Plug-ins @0@"'.format(gst_version))
cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
131
cdata.set('VA_DRIVERS_PATH', '"@0@"'.format(driverdir))
132 133 134 135 136
cdata.set10('USE_DRM', USE_DRM)
cdata.set10('USE_EGL', USE_EGL)
cdata.set10('USE_ENCODERS', USE_ENCODERS)
cdata.set10('USE_GLX', USE_GLX)
cdata.set10('USE_VP9_ENCODER', USE_VP9_ENCODER)
137
cdata.set10('USE_H264_FEI_ENCODER', USE_H264_FEI_ENCODER)
138 139 140 141 142 143
cdata.set10('USE_WAYLAND', USE_WAYLAND)
cdata.set10('USE_X11', USE_X11)
cdata.set10('HAVE_XKBLIB', cc.has_header('X11/XKBlib.h', dependencies: x11_dep))
cdata.set10('HAVE_XRANDR', xrandr_dep.found())
cdata.set10('HAVE_XRENDER', xrender_dep.found())
cdata.set10('USE_GST_GL_HELPERS', gstgl_dep.found())
144
cdata.set('USE_GLES_VERSION_MASK', GLES_VERSION_MASK)
145 146 147 148 149

api_version = '1.0'
soversion = 0
# maintaining compatibility with the previous libtool versioning
# current = minor * 100 + micro
150 151 152
curversion = gst_version_minor * 100 + gst_version_micro
libversion = '@0@.@1@.0'.format(soversion, curversion)
osxversion = curversion + 1
153 154 155 156 157 158 159 160 161 162

plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))

configure_file(configuration: cdata, output: 'config.h')
gstreamer_vaapi_args = ['-DHAVE_CONFIG_H']
configinc = include_directories('.')
libsinc = include_directories('gst-libs')

subdir('gst-libs')
subdir('gst')
163 164 165
if not get_option('examples').disabled()
  subdir('tests')
endif
Thibault Saunier's avatar
Thibault Saunier committed
166
subdir('docs')
167

168
python3 = import('python').find_installation()
169
run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')