-
Notifications
You must be signed in to change notification settings - Fork 39
/
meson.build
executable file
·121 lines (102 loc) · 3.58 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
project('nrepellent.lv2','c',version: '0.2.3',default_options: ['default_library=shared','c_std=c99'])
# Install folder
lv2_directory = join_paths(get_option('libdir'), 'lv2')
install_folder = join_paths(lv2_directory, meson.project_name())
# Sources to compile
common_src = ['src/signal_crossfade.c']
noise_repellent_src = ['plugins/nrepellent.c', 'src/noise_profile_state.c']
noise_repellent_adaptive_src = 'plugins/nrepellent-adaptive.c'
# Dependencies for noise repellent
lv2_dep = dependency('lv2', required: true)
libspecbleach_dep = dependency('libspecbleach', fallback : ['libspecbleach', 'libspecbleach_dep'], default_options: ['default_library=static'], required: true)
m_dep = meson.get_compiler('c').find_library('m', required: true)
all_dep = [lv2_dep,libspecbleach_dep,m_dep]
# Get the host operating system and cpu architecture
current_os = host_machine.system()
current_arch = build_machine.cpu_family()
# Shared c_args for libraries
lib_c_args = ['-fvisibility=hidden']
# Add default x86 and x86_64 optimizations
if current_arch == 'x86' or current_arch == 'x86_64' and current_os != 'darwin'
lib_c_args += ['-msse','-msse2','-mfpmath=sse','-ffast-math','-fomit-frame-pointer','-fno-finite-math-only']
endif
# Configure extension for shared object
if current_os == 'darwin' #mac
extension = '.dylib'
else #unix like (linux, bsd)
extension = '.so'
endif
if current_os == 'windows' #windows
extension = '.dll'
endif
# Build of the shared object
library('nrepellent',
common_src,
noise_repellent_src,
c_args: lib_c_args,
name_prefix: '',
dependencies: all_dep,
install: true,
install_dir: install_folder
)
library('nrepellent-adaptive',
common_src,
noise_repellent_adaptive_src,
c_args: lib_c_args,
name_prefix: '',
dependencies: all_dep,
install: true,
install_dir: install_folder
)
# Getting version from project configuration or from git tags
version_array = meson.project_version().split('.')
git = find_program('git', native: true, required: false)
if version_array.length() == 0 and git.found()
version_array = run_command('git', 'describe').stdout().strip().split('-')[0].split('.')
endif
# Configure manifest.ttl
manifest_conf = configuration_data()
manifest_conf.set('LIB_EXT', extension)
manifest_ttl = configure_file(
input: 'lv2ttl/manifest.ttl.in',
output: 'manifest.ttl',
configuration: manifest_conf,
install: true,
install_dir: install_folder
)
data_conf = configuration_data()
data_conf.set('MAJOR_VERSION', version_array[0])
data_conf.set('MINOR_VERSION', version_array[1])
data_conf.set('MICRO_VERSION', version_array[2])
# Configure nrepellent.ttl
nrepel_ttl = configure_file(
input: join_paths('lv2ttl', 'nrepellent.ttl.in'),
output: 'nrepellent.ttl',
configuration: data_conf,
install: true,
install_dir: install_folder
)
# Configure nrepellent.ttl
nrepel_ttl = configure_file(
input: join_paths('lv2ttl', 'nrepellent#stereo.ttl.in'),
output: 'nrepellent#stereo.ttl',
configuration: data_conf,
install: true,
install_dir: install_folder
)
# Configure nrepellent-adaptive.ttl
nrepel_ttl_adaptive = configure_file(
input: join_paths('lv2ttl', 'nrepellent-adaptive.ttl.in'),
output: 'nrepellent-adaptive.ttl',
configuration: data_conf,
install: true,
install_dir: install_folder
)
# Configure nrepellent-adaptive#stereo.ttl
nrepel_ttl_adaptive_stereo = configure_file(
input: join_paths('lv2ttl', 'nrepellent-adaptive#stereo.ttl.in'),
output: 'nrepellent-adaptive#stereo.ttl',
configuration: data_conf,
install: true,
install_dir: install_folder
)