1# SPDX-License-Identifier: MIT
2# Copyright © 2022 Intel Corporation
3
4project(
5  'libXvMC',
6  'c',
7  version : '1.0.14',
8  meson_version : '>= 0.58',
9  default_options : ['default_library=both'],
10)
11
12cc = meson.get_compiler('c')
13
14dep_dl = dependency('dl', required : false)
15if not dep_dl.found()
16  dep_dl = cc.find_library('dl', required : false)
17endif
18
19deps = [
20  dependency('x11', version : '>= 1.6'),
21  dependency('xext'),
22  dependency('xv'),
23  dependency('xextproto'),
24  dependency('videoproto'),
25  dep_dl,
26]
27
28conf = configuration_data()
29
30if cc.has_function('shmat')
31  conf.set('HAVE_SHMAT', true)
32endif
33
34configure_file(
35  configuration : conf,
36  output : 'config.h',
37)
38
39install_headers(
40  'include/X11/extensions/vldXvMC.h',
41  'include/X11/extensions/XvMClib.h',
42  subdir : 'X11/extensions',
43)
44
45install_data(
46  'XvMC_API.txt',
47  install_dir : get_option('datadir') / 'doc' / 'libXvMC',
48)
49
50pkg = import('pkgconfig')
51
52inc = include_directories('include')
53
54libXvMC = library(
55  'XvMC',
56  'src/XvMC.c',
57  c_args : ['-DHAVE_CONFIG_H'],
58  include_directories : inc,
59  dependencies : deps,
60  version : '1.0.0',
61  darwin_versions  : [ '2.0.0', '2.0.0' ],
62  install : true,
63)
64
65pkg.generate(
66  libXvMC,
67  filebase : 'xvmc',
68  description : 'The XvMC Library',
69  version : meson.project_version(),
70)
71
72ext_libXvMC = declare_dependency(
73  link_with : libXvMC,
74  include_directories : inc,
75)
76
77meson.override_dependency('xvmc', ext_libXvMC)
78
79libXvMCW = library(
80  'XvMCW',
81  'wrapper/XvMCWrapper.c',
82  include_directories : inc,
83  c_args : [
84    '-DXVMC_CONFIGDIR=@0@/X11'.format(get_option('sysconfdir')),
85    '-DXVMC_SOVERSION=".1.0"',
86    '-DXV_SOVERSION=".1.0"',
87  ],
88  dependencies : deps,
89  version : '1.0.0',
90  darwin_versions  : [ '2.0.0', '2.0.0' ],
91  install : true,
92)
93
94ext_libXvMCW = declare_dependency(
95  link_with : libXvMCW,
96  include_directories : inc,
97)
98
99pkg.generate(
100  libXvMCW,
101  name : 'XvMCWrapper',
102  filebase : 'xvmc-wrapper',
103  description : 'XvMC wrapper library',
104  version : meson.project_version(),
105)
106
107meson.override_dependency('xvmc-wrapper', ext_libXvMCW)
108
109