xref: /aosp_15_r20/external/libva/meson.build (revision 54e60f844a168e9a219354de272cd517ee8cd4b7)
1# libva package version number, (as distinct from shared library version)
2# XXX: we want the package version to remain at 1.0.x for VA-API 0.32.y
3#
4# - major version is automatically generated from VA-API major version
5# - minor version is automatically generated from VA-API minor version
6# - increment micro for any library release
7# - reset micro version to zero when VA-API major or minor version is changed
8project(
9  'libva', 'c',
10  version : '2.22.0',
11  meson_version : '>= 0.53.0',
12  default_options : [ 'warning_level=1',
13                      'buildtype=debugoptimized' ])
14
15# VA-API version
16# - increment major for any ABI change
17# - increment minor for any interface change (e.g. new/modified function)
18# - increment micro for any other change (new flag, new codec definition, etc.)
19# - reset micro version to zero when minor version is incremented
20# - reset minor version to zero when major version is incremented
21va_api_major_version = 1
22va_api_minor_version = 22
23va_api_micro_version = 0
24
25va_api_version = '@0@.@1@.@2@'.format(va_api_major_version,
26				      va_api_minor_version,
27				      va_api_micro_version)
28
29version_arr = meson.project_version().split('.')
30libva_major_version = version_arr[0]
31libva_minor_version = version_arr[1]
32libva_micro_version = version_arr[2]
33libva_version = '@0@.@1@.@2@'.format(libva_major_version,
34				     libva_minor_version,
35				     libva_micro_version)
36if version_arr.length() == 4
37  libva_version = '@[email protected]@1@'.format(libva_version, version_arr[3])
38endif
39
40
41# libva library version number (generated, do not change)
42# XXX: we want the SONAME to remain at libva.so.1 for VA-API major == 0
43#
44# The library name is generated libva.<x>.<y>.0 where
45# <x> = VA-API major version + 1
46# <y> = 100 * VA-API minor version + VA-API micro version
47#
48# For example:
49# VA-API 0.32.0 generates libva.so.1.3200.0
50# VA-API 0.34.1 generates libva.so.1.3401.0
51# VA-API 1.2.13 generates libva.so.2.213.0
52libva_interface_bias = va_api_major_version + 1
53libva_interface_age = 0
54libva_binary_age = 100 * va_api_minor_version + va_api_micro_version - libva_interface_age
55
56libva_lt_current = 100 * va_api_minor_version + va_api_micro_version + libva_interface_bias
57libva_lt_revision = libva_interface_age
58libva_lt_age = libva_binary_age - libva_interface_age
59
60libva_lt_current = libva_lt_current - libva_lt_age
61
62libva_lt_version = '@0@.@1@.@2@'.format(libva_lt_current,
63					libva_lt_age,
64					libva_lt_revision)
65
66sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
67
68driverdir = get_option('driverdir')
69if driverdir == ''
70  # "libdir" on Windows is essentially only for static and import libraries,
71  # while "bindir" is the actual runtime directory - containing both
72  # executable and dynamic libraries. During install meson uses correct install
73  # location depending on the type of library, requiring zero user intervention
74  # in the common case.
75  if host_machine.system() == 'windows'
76    driverdir = join_paths(get_option('prefix'), get_option('bindir'))
77  else
78    driverdir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
79  endif
80endif
81
82configinc = include_directories('.')
83
84cc = meson.get_compiler('c')
85dl_dep = cc.find_library('dl', required : false)
86
87WITH_DRM = not get_option('disable_drm') and (host_machine.system() != 'windows')
88libdrm_dep = dependency('libdrm', version : '>= 2.4.75', required : (host_machine.system() != 'windows'))
89
90WITH_X11 = false
91if get_option('with_x11') != 'no'
92  x11_dep = dependency('x11', required : get_option('with_x11') == 'yes')
93  xext_dep = dependency('xext', required : get_option('with_x11') == 'yes')
94  xfixes_dep = dependency('xfixes', required : get_option('with_x11') == 'yes')
95
96  WITH_X11 = (x11_dep.found() and xext_dep.found() and xfixes_dep.found())
97
98  x11_xcb_dep = dependency('x11-xcb', required : get_option('with_x11') == 'yes')
99  xcb_dep = dependency('xcb', required : get_option('with_x11') == 'yes')
100  xcb_dri3_dep = dependency('xcb-dri3', required : get_option('with_x11') == 'yes')
101  WITH_X11 = (WITH_X11 and x11_xcb_dep.found() and xcb_dep.found() and xcb_dri3_dep.found())
102endif
103
104if not WITH_X11 and get_option('with_glx') == 'yes'
105  error('VA/GLX explicitly enabled, but VA/X11 isn\'t built')
106endif
107
108WITH_GLX = false
109if WITH_X11 and get_option('with_glx') != 'no'
110  gl_dep = dependency('gl', required : get_option('with_glx') == 'yes')
111  WITH_GLX = gl_dep.found()
112endif
113
114WITH_WAYLAND = false
115if get_option('with_wayland') != 'no'
116  wayland_dep = dependency('wayland-client', version : '>= 1.11.0',
117			   required : get_option('with_wayland') == 'yes')
118  wayland_scanner_dep = dependency('wayland-scanner', version : '>= 1.15',
119                                   required : get_option('with_wayland') == 'yes',
120                                   native : true)
121  if wayland_scanner_dep.found()
122    wl_scanner = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))
123  endif
124  WITH_WAYLAND = wayland_dep.found() and wayland_scanner_dep.found()
125endif
126
127WITH_WIN32 = false
128libwin32_dep = []
129if get_option('with_win32') != 'no'
130    WITH_WIN32 = (host_machine.system() == 'windows')
131endif
132
133if (not WITH_DRM and not WITH_X11 and not WITH_WAYLAND and not WITH_WIN32)
134  error('Please install at least one backend dev files (DRM, X11, Wayland, WIN32)')
135endif
136
137c_args = []
138if get_option('with_legacy').contains('emgd')
139  c_args += ['-DHAVE_EMGD']
140elif get_option('with_legacy').contains('nvctrl')
141  c_args += ['-DHAVE_NVCTRL']
142elif get_option('with_legacy').contains('fglrx')
143  c_args += ['-DHAVE_FGLRX']
144endif
145
146if cc.has_function('secure_getenv')
147  c_args += ['-DHAVE_SECURE_GETENV']
148endif
149
150add_project_arguments(c_args, language: ['c'])
151
152subdir('va')
153subdir('pkgconfig')
154
155doxygen = find_program('doxygen', required: false)
156
157if get_option('enable_docs') and doxygen.found()
158  subdir('doc')
159endif
160
161