forked from thestk/rtaudio
-
Notifications
You must be signed in to change notification settings - Fork 1
/
meson.build
148 lines (121 loc) · 4.22 KB
/
meson.build
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
project('RtAudio', 'cpp',
version: '6.0.1',
default_options: ['warning_level=3',
'c_std=c99',
'cpp_std=c++11',
'default_library=both'])
fs = import('fs')
pkg = import('pkgconfig')
rt_h = fs.read('RtAudio.h').strip().split('\n')
foreach line : rt_h
if line.startswith('#define RTAUDIO_VERSION_MAJOR')
rt_version_major = line.split()[2]
elif line.startswith('#define RTAUDIO_VERSION_MINOR')
rt_version_minor = line.split()[2]
elif line.startswith('#define RTAUDIO_VERSION_PATCH')
rt_version_patch = line.split()[2]
elif line.startswith('#define RTAUDIO_VERSION_BETA')
rt_version_beta = line.split()[2]
endif
endforeach
if rt_version_beta.to_int() > 0
rt_version = rt_version_major + '.' + rt_version_minor + '.' + rt_version_patch + 'beta' + rt_version_beta
else
rt_version = rt_version_major + '.' + rt_version_minor + '.' + rt_version_patch
endif
assert(meson.project_version() == rt_version, 'Meson\'s RtAudio version does not match the version in header file.')
ac_file = fs.read('configure.ac').strip().split('\n')
foreach line : ac_file
if line.startswith('m4_define([lt_current],')
lt_current = line.substring(-2,-1).to_int()
elif line.startswith('m4_define([lt_revision],')
lt_revision = line.substring(-2,-1).to_int()
elif line.startswith('m4_define([lt_age],')
lt_age = line.substring(-2,-1).to_int()
endif
endforeach
so_version = '@0@.@1@.@2@'.format(lt_current - lt_age, lt_age, lt_revision)
src = ['RtAudio.cpp', 'rtaudio_c.cpp']
incdir = include_directories('include')
install_headers('RtAudio.h', 'rtaudio_c.h', subdir: 'rtaudio')
compiler = meson.get_compiler('cpp')
deps = []
defines = ['-DRTAUDIO_EXPORT']
if compiler.has_function('gettimeofday', prefix: '#include <sys/time.h>')
defines += '-DHAVE_GETTIMEOFDAY'
endif
if get_option('debug') == true
defines += '-D__RTAUDIO_DEBUG__'
endif
deps += dependency('threads')
alsa_dep = dependency('alsa', required: get_option('alsa'))
if alsa_dep.found()
defines += '-D__LINUX_ALSA__'
deps += alsa_dep
endif
jack_dep = dependency('jack', required: get_option('jack'))
if jack_dep.found()
defines += '-D__UNIX_JACK__'
deps += jack_dep
endif
if get_option('oss') == true
defines += '-D__LINUX_OSS__'
endif
pulsesimple_dep = dependency('libpulse-simple', required: get_option('pulse'))
if pulsesimple_dep.found()
defines += '-D__LINUX_PULSE__'
deps += pulsesimple_dep
endif
core_dep = dependency('appleframeworks', modules: ['CoreAudio', 'CoreFoundation'], required: get_option('core'))
if core_dep.found()
defines += '-D__MACOSX_CORE__'
deps += core_dep
endif
dsound_dep = compiler.find_library('dsound', required: get_option('dsound'))
if dsound_dep.found()
defines += '-D__WINDOWS_DS__'
deps += dsound_dep
endif
wasapi_found = compiler.check_header('audioclient.h', required: get_option('wasapi'))
if wasapi_found
deps += compiler.find_library('mfplat', required: true)
deps += compiler.find_library('mfuuid', required: true)
deps += compiler.find_library('ksuser', required: true)
deps += compiler.find_library('wmcodecdspuuid', required: true)
defines += '-D__WINDOWS_WASAPI__'
endif
asio_found = compiler.check_header('windows.h', required: get_option('asio'))
if asio_found
src += ['include/asio.cpp',
'include/asiolist.cpp',
'include/asiodrivers.cpp',
'include/iasiothiscallresolver.cpp']
defines += '-D__WINDOWS_ASIO__'
endif
if host_machine.system() == 'windows'
deps += compiler.find_library('ole32', required: true)
deps += compiler.find_library('winmm', required: true)
endif
rtaudio = library('rtaudio', src,
version: so_version,
include_directories: incdir,
cpp_args: defines,
dependencies: deps,
gnu_symbol_visibility: 'hidden',
install: true)
rtaudio_dep = declare_dependency(include_directories : '.',
link_with : rtaudio)
meson.override_dependency('rtaudio', rtaudio_dep)
subdir('tests')
subdir('doc')
pkg.generate(rtaudio,
description: 'RtAudio - a set of C++ classes that provide a common API for realtime audio input/output',
subdirs: 'rtaudio')
summary({'ALSA': alsa_dep.found(),
'OSS': get_option('oss'),
'JACK': jack_dep.found(),
'PulseAudio': pulsesimple_dep.found(),
'CoreAudio': core_dep.found(),
'DirectAudio': dsound_dep.found(),
'WASAPI': wasapi_found,
'ASIO': asio_found}, bool_yn: true, section: 'Audio Backends')