summaryrefslogtreecommitdiffstats
path: root/spa/plugins/bluez5/meson.build
blob: f1895701a762a8ee4419eea91a98cf261310be83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
gnome = import('gnome')

bluez5_deps = [ mathlib, dbus_dep, glib2_dep, sbc_dep, bluez_dep, gio_dep, gio_unix_dep ]
foreach dep: bluez5_deps
  if not dep.found()
    subdir_done()
  endif
endforeach

cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE',
          get_option('bluez5-backend-hsp-native').allowed() or
          get_option('bluez5-backend-hfp-native').allowed())
cdata.set('HAVE_BLUEZ_5_BACKEND_HSP_NATIVE', get_option('bluez5-backend-hsp-native').allowed())
cdata.set('HAVE_BLUEZ_5_BACKEND_HFP_NATIVE', get_option('bluez5-backend-hfp-native').allowed())
cdata.set('HAVE_BLUEZ_5_BACKEND_NATIVE_MM', get_option('bluez5-backend-native-mm').allowed())
cdata.set('HAVE_BLUEZ_5_BACKEND_OFONO', get_option('bluez5-backend-ofono').allowed())
cdata.set('HAVE_BLUEZ_5_BACKEND_HSPHFPD', get_option('bluez5-backend-hsphfpd').allowed())
cdata.set('HAVE_BLUEZ_5_HCI', dependency('bluez', version: '< 6', required: false).found())

bluez5_sources = [
  'plugin.c',
  'codec-loader.c',
  'media-codecs.c',
  'media-sink.c',
  'media-source.c',
  'sco-sink.c',
  'sco-source.c',
  'sco-io.c',
  'quirks.c',
  'player.c',
  'bluez5-device.c',
  'bluez5-dbus.c',
  'hci.c',
  'dbus-monitor.c',
  'midi-enum.c',
  'midi-parser.c',
  'midi-node.c',
  'midi-server.c',
]

bluez5_interface_src = gnome.gdbus_codegen('bluez5-interface-gen',
  sources: 'org.bluez.xml',
  interface_prefix : 'org.bluez.',
  object_manager: true,
  namespace : 'Bluez5',
  annotations : [
    ['org.bluez.GattCharacteristic1.AcquireNotify()', 'org.gtk.GDBus.C.UnixFD', 'true'],
    ['org.bluez.GattCharacteristic1.AcquireWrite()', 'org.gtk.GDBus.C.UnixFD', 'true'],
  ]
)
bluez5_sources += [ bluez5_interface_src ]

bluez5_data = ['bluez-hardware.conf']

install_data(bluez5_data, install_dir : spa_datadir / 'bluez5')

if get_option('bluez5-backend-hsp-native').allowed() or get_option('bluez5-backend-hfp-native').allowed()
  if libusb_dep.found()
    bluez5_deps += libusb_dep
  endif
  if mm_dep.found()
    bluez5_deps += mm_dep
    bluez5_sources += ['modemmanager.c']
  endif
  bluez5_sources += ['backend-native.c', 'upower.c']
endif

if get_option('bluez5-backend-ofono').allowed()
  bluez5_sources += ['backend-ofono.c']
endif

if get_option('bluez5-backend-hsphfpd').allowed()
  bluez5_sources += ['backend-hsphfpd.c']
endif

# The library uses GObject, and cannot be unloaded
bluez5_link_args = [ '-Wl,-z', '-Wl,nodelete' ]

bluez5lib = shared_library('spa-bluez5',
  bluez5_sources,
  include_directories : [ configinc ],
  dependencies : [ spa_dep, bluez5_deps ],
  link_args : bluez5_link_args,
  install : true,
  install_dir : spa_plugindir / 'bluez5')

codec_args = [ '-DCODEC_PLUGIN' ]

bluez_codec_sbc = shared_library('spa-codec-bluez5-sbc',
  [ 'a2dp-codec-sbc.c', 'media-codecs.c' ],
  include_directories : [ configinc ],
  c_args : codec_args,
  dependencies : [ spa_dep, sbc_dep ],
  install : true,
  install_dir : spa_plugindir / 'bluez5')

bluez_codec_faststream = shared_library('spa-codec-bluez5-faststream',
  [ 'a2dp-codec-faststream.c', 'media-codecs.c' ],
  include_directories : [ configinc ],
  c_args : codec_args,
  dependencies : [ spa_dep, sbc_dep ],
  install : true,
  install_dir : spa_plugindir / 'bluez5')

if fdk_aac_dep.found()
  bluez_codec_aac = shared_library('spa-codec-bluez5-aac',
    [ 'a2dp-codec-aac.c', 'media-codecs.c' ],
    include_directories : [ configinc ],
    c_args : codec_args,
    dependencies : [ spa_dep, fdk_aac_dep ],
    install : true,
    install_dir : spa_plugindir / 'bluez5')
endif

if aptx_dep.found()
  bluez_codec_aptx = shared_library('spa-codec-bluez5-aptx',
    [ 'a2dp-codec-aptx.c', 'media-codecs.c' ],
    include_directories : [ configinc ],
    c_args : codec_args,
    dependencies : [ spa_dep, aptx_dep, sbc_dep ],
    install : true,
    install_dir : spa_plugindir / 'bluez5')
endif

if ldac_dep.found()
  ldac_args = codec_args
  ldac_dep = [ ldac_dep ]
  if ldac_abr_dep.found()
    ldac_args += [ '-DENABLE_LDAC_ABR' ]
    ldac_dep += ldac_abr_dep
  endif
  bluez_codec_ldac = shared_library('spa-codec-bluez5-ldac',
    [ 'a2dp-codec-ldac.c', 'media-codecs.c' ],
    include_directories : [ configinc ],
    c_args : ldac_args,
    dependencies : [ spa_dep, ldac_dep ],
    install : true,
    install_dir : spa_plugindir / 'bluez5')
endif

if get_option('bluez5-codec-lc3plus').allowed() and lc3plus_dep.found()
  bluez_codec_lc3plus = shared_library('spa-codec-bluez5-lc3plus',
    [ 'a2dp-codec-lc3plus.c', 'media-codecs.c' ],
    include_directories : [ configinc ],
    c_args : codec_args,
    dependencies : [ spa_dep, lc3plus_dep, mathlib ],
    install : true,
    install_dir : spa_plugindir / 'bluez5')
endif

if get_option('bluez5-codec-opus').allowed() and opus_dep.found()
  opus_args = codec_args
  opus_dep = [ opus_dep ]
  bluez_codec_opus = shared_library('spa-codec-bluez5-opus',
    [ 'a2dp-codec-opus.c', 'media-codecs.c' ],
    include_directories : [ configinc ],
    c_args : opus_args,
    dependencies : [ spa_dep, opus_dep, mathlib ],
    install : true,
    install_dir : spa_plugindir / 'bluez5')
endif

if get_option('bluez5-codec-lc3').allowed() and lc3_dep.found()
  bluez_codec_lc3 = shared_library('spa-codec-bluez5-lc3',
    [ 'bap-codec-lc3.c', 'media-codecs.c' ],
    include_directories : [ configinc ],
    c_args : codec_args,
    dependencies : [ spa_dep, lc3_dep, mathlib ],
    install : true,
    install_dir : spa_plugindir / 'bluez5')
endif

test_apps = [
  'test-midi',
]
bluez5_test_lib = static_library('bluez5_test_lib',
  [ 'midi-parser.c' ],
  include_directories : [ configinc ],
  dependencies : [ spa_dep, bluez5_deps ],
  install : false
)

foreach a : test_apps
  test(a,
    executable(a, a + '.c',
      dependencies : [ spa_dep, dl_lib, pthread_lib, mathlib, bluez5_deps ],
      include_directories : [ configinc ],
      link_with : [ bluez5_test_lib ],
      install_rpath : spa_plugindir / 'bluez5',
      install : installed_tests_enabled,
      install_dir : installed_tests_execdir / 'bluez5'),
      env : [
        'SPA_PLUGIN_DIR=@0@'.format(spa_dep.get_variable('plugindir')),
        ])

    if installed_tests_enabled
      test_conf = configuration_data()
      test_conf.set('exec', installed_tests_execdir / 'bluez5' / a)
      configure_file(
        input: installed_tests_template,
        output: a + '.test',
        install_dir: installed_tests_metadir / 'bluez5',
        configuration: test_conf
        )
  endif
endforeach