-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
meson.build
409 lines (355 loc) · 10.2 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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
###############################################################################
project('DISTRHO-Ports',
['c', 'cpp'],
license : 'GPLv3',
meson_version: '>=0.55.0',
version: '1',
)
###############################################################################
# set target OS
os_darwin = false
os_linux = false
os_windows = false
if host_machine.system() == 'darwin'
os_darwin = true
elif host_machine.system() == 'windows'
os_windows = true
elif host_machine.system() == 'linux'
os_linux = true
else
error('unsupported system')
endif
###############################################################################
# get options
buildtype = get_option('buildtype')
prefix = get_option('prefix')
bindir = get_option('bindir')
libdir = get_option('libdir')
if libdir.contains('/')
libdir = 'lib'
endif
linux_headless = get_option('linux-headless')
build_lv2 = get_option('build-lv2')
build_vst2 = get_option('build-vst2') and not linux_headless
build_vst3 = get_option('build-vst3') and not linux_headless
build_juce5_only = get_option('build-juce5-only')
build_juce60_only = get_option('build-juce60-only')
build_juce61_only = get_option('build-juce61-only')
build_juce7_only = get_option('build-juce7-only')
build_universal = get_option('build-universal')
optimizations = get_option('optimizations') and buildtype != 'debug'
lto_optimizations = get_option('lto-optimizations') and buildtype != 'debug' and not os_windows
neon_optimizations = get_option('neon-optimizations') and buildtype != 'debug' and (
host_machine.cpu_family() == 'arm'
)
sse_optimizations = get_option('sse-optimizations') and buildtype != 'debug' and (
host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
)
###############################################################################
# set paths
lv2dir = prefix / libdir / 'lv2'
vst2dir = prefix / libdir / 'vst'
vst3dir = prefix / libdir / 'vst3'
###############################################################################
# set OS-specific details
if os_darwin
bin_suffix = ''
lib_suffix = '.dylib'
bintype_prefix = 'macOS-'
elif os_windows
bin_suffix = '.exe'
lib_suffix = '.dll'
bintype_prefix = 'Windows-'
else
bin_suffix = ''
lib_suffix = '.so'
bintype_prefix = 'Linux-'
endif
###############################################################################
# base compiler details
cc = meson.get_compiler('c')
cpp = meson.get_compiler('cpp')
###############################################################################
# dependencies
if os_linux
dependencies = [
cc.find_library('dl'),
cc.find_library('rt'),
dependency('fftw3f').partial_dependency(link_args: false, links: false),
]
dependencies_devices = [
dependency('alsa'),
]
if not linux_headless
dependencies += [
dependency('freetype2'),
dependency('x11').partial_dependency(link_args: false, links: false),
dependency('xext').partial_dependency(link_args: false, links: false),
]
endif
elif os_windows
dependencies = [
cc.find_library('comdlg32'),
cc.find_library('gdi32'),
cc.find_library('imm32'),
cc.find_library('ole32'),
cc.find_library('oleaut32'),
cc.find_library('shlwapi'),
cc.find_library('uuid'),
cc.find_library('version'),
cc.find_library('wininet'),
cc.find_library('winmm'),
cc.find_library('ws2_32'),
]
dependencies_devices = [
]
else
dependencies = [
]
dependencies_devices = [
]
endif
###############################################################################
# build flags
build_flags = [
'-DJUCE_APP_CONFIG_HEADER="AppConfig.h"',
'-fno-common',
'-pthread',
'-Wall',
'-Wno-multichar',
'-Wno-strict-overflow',
'-Wno-unused-function',
]
build_flags_cpp = [
'-std=gnu++11',
]
if not os_darwin
build_flags += [
'-Wno-unused-but-set-variable',
]
build_flags_cpp += [
'-Wno-class-memaccess',
]
endif
if cc.get_id() == 'gcc'
build_flags += [
'-fno-gnu-unique'
]
endif
###############################################################################
# build flags (debug)
build_flags_debug = [
'-O0',
'-ggdb',
'-DDEBUG=1',
'-D_DEBUG=1',
]
build_flags_debug_cpp = [
]
###############################################################################
# build flags (release)
build_flags_release = [
'-O3',
'-fvisibility=hidden',
'-DNDEBUG=1',
'-fdata-sections',
'-ffunction-sections',
]
build_flags_release_cpp = [
'-fvisibility-inlines-hidden',
]
if optimizations or neon_optimizations or sse_optimizations
build_flags_release += [
'-ffast-math',
]
endif
if optimizations
build_flags_release += [
'-fomit-frame-pointer', '-ftree-vectorize', '-funroll-loops',
]
if not os_darwin
build_flags_release += [
'-fprefetch-loop-arrays',
]
endif
endif
if lto_optimizations
build_flags_release += [
'-fno-strict-aliasing', '-flto',
]
endif
if sse_optimizations or build_universal
build_flags_release += [
'-mtune=generic', '-msse', '-msse2',
]
if not build_universal
build_flags_release += [
'-mfpmath=sse',
]
endif
endif
if neon_optimizations
build_flags_release += [
'-mfpu=neon-vfpv4', '-mfloat-abi=hard',
]
endif
###############################################################################
# build flags (per-OS macros and setup)
if os_darwin
build_flags += [
'-DMAC=1',
'-DGL_SILENCE_DEPRECATION=1',
'-DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_15',
'-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_15',
'-mmacosx-version-min=10.15',
]
build_flags_cpp += [
'-ObjC++',
]
if build_universal
build_flags += [
'-arch', 'x86_64',
'-arch', 'arm64',
]
endif
elif os_windows
build_flags += [
'-DWINDOWS=1',
'-mstackrealign',
]
build_flags_cpp += [
'-fpermissive',
]
else
build_flags += [
'-DLINUX=1',
]
if linux_headless
build_flags_cpp += [
'-DJUCE_AUDIOPROCESSOR_NO_GUI=1',
]
endif
endif
###############################################################################
# link flags
link_flags = [
'-pthread',
]
link_flags_debug = [
]
link_flags_release = [
'-fdata-sections',
'-ffunction-sections',
]
if lto_optimizations
link_flags_release += [
'-Werror=odr',
'-Werror=lto-type-mismatch',
]
endif
if os_darwin
link_flags += [
'-mmacosx-version-min=10.15',
]
link_flags_release += [
'-Wl,-dead_strip,-dead_strip_dylibs,-x',
]
if build_universal
link_flags += [
'-arch', 'x86_64',
'-arch', 'arm64',
]
endif
elif os_windows
link_flags += [
'-static',
'-Wl,--as-needed,--no-undefined',
]
link_flags_release += [
'-Wl,-O1,--gc-sections,--strip-all',
]
else
link_flags += [
'-Wl,--as-needed,--no-undefined',
]
link_flags_release += [
'-Wl,-O1,--gc-sections,--strip-all',
]
endif
###############################################################################
# combine flags depending on build type
if buildtype == 'debug'
build_flags += build_flags_debug
build_flags_cpp += build_flags_debug_cpp + build_flags
link_flags += link_flags_debug
else
build_flags += build_flags_release
build_flags_cpp += build_flags_release_cpp + build_flags
link_flags += link_flags_release
endif
###############################################################################
# set vst3 architecture bundle name
if os_darwin
vst3_bundle_name = 'MacOS'
elif os_windows
vst3_bundle_name = host_machine.cpu_family() + '-win'
else
vst3_bundle_name = host_machine.cpu_family() + '-' + host_machine.system()
endif
###############################################################################
# go into subdir to build libraries and plugins
subdir('libs')
if not (build_juce60_only or build_juce61_only or build_juce7_only)
subdir('ports-juce5')
endif
if not (build_juce5_only or build_juce61_only or build_juce7_only)
subdir('ports-juce6.0')
endif
if not (build_juce5_only or build_juce60_only or build_juce7_only)
subdir('ports-juce6.1')
endif
# NOTICE no plugins imported that use juce7 yet
if not (build_juce5_only or build_juce60_only or build_juce61_only)
subdir('ports-juce7')
endif
###############################################################################
# extra files to install
if 'tal-noisemaker' in get_option('plugins')
extra_lv2_preset_files = [
'TAL-NoiseMaker-Noise4U.lv2/manifest.ttl',
'TAL-NoiseMaker-Noise4U.lv2/presets.ttl',
]
foreach preset_file : extra_lv2_preset_files
install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
install_dir: lv2dir / 'TAL-NoiseMaker-Noise4U.lv2',
)
endforeach
endif
if 'vitalium' in get_option('plugins')
extra_lv2_preset_files = [
'Vitalium-unfa.lv2/manifest.ttl',
'Vitalium-unfa.lv2/Analog_Brass.ttl',
'Vitalium-unfa.lv2/Combat.ttl',
'Vitalium-unfa.lv2/Dark_Ambient.ttl',
'Vitalium-unfa.lv2/Dark_Bouncy_Groove.ttl',
'Vitalium-unfa.lv2/Hardcore_Kick.ttl',
'Vitalium-unfa.lv2/Kickbass.ttl',
'Vitalium-unfa.lv2/Koto.ttl',
'Vitalium-unfa.lv2/Nasty_Growl.ttl',
'Vitalium-unfa.lv2/Pianium.ttl',
'Vitalium-unfa.lv2/Power_Lead.ttl',
'Vitalium-unfa.lv2/Retro_Ambient_Pluck.ttl',
'Vitalium-unfa.lv2/Sci_Fi_Computer.ttl',
'Vitalium-unfa.lv2/Sci_Fi_Piano.ttl',
'Vitalium-unfa.lv2/Sparkly_Dreamy_Pad.ttl',
'Vitalium-unfa.lv2/Supersaw.ttl',
'Vitalium-unfa.lv2/Trance_Pluck.ttl',
'Vitalium-unfa.lv2/Vitalium_Groove.ttl',
]
foreach preset_file : extra_lv2_preset_files
install_data([ 'static-lv2-ttl/@0@'.format(preset_file) ],
install_dir: lv2dir / 'Vitalium-unfa.lv2',
)
endforeach
endif
###############################################################################