forked from zrythm/zrythm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeson.build
More file actions
1290 lines (1197 loc) · 32.4 KB
/
Copy pathmeson.build
File metadata and controls
1290 lines (1197 loc) · 32.4 KB
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (C) 2019-2021 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of Zrythm
#
# Zrythm is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Zrythm is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Zrythm. If not, see <https://www.gnu.org/licenses/>.
project (
'zrythm', ['c', 'cpp'],
version: files ('VERSION'),
license: 'AGPL-3-or-later',
meson_version: '>= 0.57.0',
default_options: [
'warning_level=2',
'buildtype=debugoptimized',
'c_std=gnu11',
],
)
meson_src_root = meson.current_source_dir ()
meson_build_root = meson.current_build_dir ()
prog_name = get_option ('program_name')
prog_name_lowercase = prog_name.to_lower()
gnome = import ('gnome')
fs = import ('fs')
cmake = import ('cmake')
cmake_opts = cmake.subproject_options ()
cmake_opts.add_cmake_defines ({'CMAKE_POSITION_INDEPENDENT_CODE': 'ON'})
prefix = get_option ('prefix')
bindir = prefix / get_option ('bindir')
libdir = prefix / get_option ('libdir')
libexecdir = prefix / get_option ('libexecdir')
includedir = prefix / get_option ('includedir')
datadir = prefix / get_option ('datadir')
sysconfdir = prefix / get_option ('sysconfdir')
mandir = datadir / 'man' / 'man1'
schemasdir = datadir / 'glib-2.0/schemas'
fontsdir = datadir / 'fonts' / prog_name_lowercase
zrythm_libdir = prefix / 'lib/zrythm'
zrythmdatadir = datadir / prog_name_lowercase
themesdir = zrythmdatadir / 'themes'
samplesdir = zrythmdatadir / 'samples'
scriptsdir = zrythmdatadir / 'scripts'
docdir = datadir / 'doc' / prog_name_lowercase
sourceviewstylesdir = zrythmdatadir / 'sourceview-styles'
# Used for building manpages, manual, etc., using
# foreach
language_mappings = {
'af_ZA': 'Afrikaans',
'ar': 'اَلْعَرَبِيَّةُ',
'cs': 'Czech',
'da': 'Dansk',
'de': 'Deutsch',
'en': 'English',
'en_GB': 'English UK',
'el': 'Ελληνικά',
'es': 'Español',
'et': 'Eeti',
'fa': 'فارسی',
'fi': 'Suomi',
'fr': 'Français',
'gd': 'Gaelic',
'gl': 'Galego',
'hi': 'हिन्दी',
'it': 'Italiano',
'ja': '日本語',
'ko': '한국어',
'nb_NO': 'Bokmål',
'nl': 'Nederlands',
'pl': 'Polski',
'pt': 'Português',
'pt_BR': 'Português BR',
'ru': 'русский',
'sv': 'Svenska',
'zh_CN': '简体中文',
'zh_TW': '繁體中文',
}
locales_str = run_command ('cat', 'po/LINGUAS').stdout ().strip ()
locales = {}
foreach locale : locales_str.split (' ')
locales += { locale: language_mappings[locale] }
if locale == 'de'
locales += { 'en': language_mappings['en'], }
endif
endforeach
locales_str = ' '.join (locales.keys())
os_darwin = false
os_gnu = false
os_freebsd = false
os_windows = false
bin_suffix = ''
lib_suffix = '.so'
if host_machine.system() == 'darwin'
os_darwin = true
lib_suffix = '.dylib'
elif host_machine.system() == 'linux'
os_gnu = true
elif host_machine.system() == 'freebsd'
os_freebsd = true
elif host_machine.system() == 'windows'
os_windows = true
bin_suffix = '.exe'
lib_suffix = '.dll'
else
error ('unknown host system ' + host_machine.system ())
endif
have_custom_name = prog_name != 'Zrythm'
have_custom_logo_and_splash = get_option ('custom_logo_and_splash')
cdata = configuration_data ()
cdata.set_quoted ('PROGRAM_NAME', prog_name)
cdata.set_quoted (
'PROGRAM_NAME_LOWERCASE', prog_name_lowercase)
if have_custom_name
cdata.set ('HAVE_CUSTOM_NAME', 1)
endif
if have_custom_logo_and_splash
cdata.set ('HAVE_CUSTOM_LOGO_AND_SPLASH', 1)
endif
cdata.set_quoted (
'HOST_MACHINE_SYSTEM', host_machine.system ())
cdata.set_quoted (
'PACKAGE_VERSION', '@VCS_TAG@')
cdata.set_quoted (
'COMPILER',
meson.get_compiler('c').get_id())
cdata.set_quoted ('PREFIX', prefix)
cdata.set_quoted (
'COMPILER_VERSION',
meson.get_compiler('c').version())
cdata.set_quoted ('CONFIGURE_DATADIR', datadir)
cdata.set_quoted (
'CONFIGURE_SOURCEVIEW_STYLES_DIR',
sourceviewstylesdir)
cdata.set_quoted (
'CONFIGURE_THEMES_DIR', themesdir)
cdata.set_quoted (
'LIBDIR_NAME', get_option ('libdir'))
cdata.set_quoted ('CONFIGURE_LIBDIR', libdir)
cdata.set_quoted ('CONFIGURE_BINDIR', bindir)
cdata.set_quoted ('LIB_SUFFIX', lib_suffix)
cdata.set_quoted ('BIN_SUFFIX', bin_suffix)
cdata.set_quoted ('GSCHEMAS_DIR', schemasdir)
cdata.set_quoted (
'BUILD_TYPE', get_option ('buildtype'))
cdata.set_quoted (
'INSTALLER_VERSION_STR',
get_option ('buildtype'))
if get_option ('trial_ver')
cdata.set ('TRIAL_VER', 1)
cdata.set ('TRIAL_LIMIT_MINS', 60)
endif
if get_option ('installer_ver')
cdata.set ('INSTALLER_VER', 1)
endif
cdata.set (
'MESON_SOURCE_ROOT', meson_src_root)
cdata.set (
'MESON_BUILD_ROOT', meson_build_root)
cdata.set_quoted (
'ISSUE_TRACKER_URL',
'https://sr.ht/~alextee/zrythm/trackers')
cdata.set_quoted (
'NEW_ISSUE_URL',
'https://todo.sr.ht/~alextee/zrythm-bug')
cdata.set_quoted (
'NEW_ISSUE_EMAIL',
'~alextee/zrythm-bug@todo.sr.ht')
if (get_option ('user_manual'))
cdata.set_quoted ('MANUAL_PATH', docdir)
endif
if os_darwin
add_languages(['objc', 'objcpp'])
elif os_windows
cdata.set ('USE_MMCSS_THREAD_PRIORITIES', 1)
endif
root_inc = include_directories ('.')
inc_inc = include_directories ('inc')
ext_inc = include_directories ('ext')
midilib_inc = include_directories ('ext/midilib')
whereami_inc = include_directories ('ext/whereami')
zix_inc = include_directories ('ext/zix')
weakjack_inc = include_directories ('ext/weakjack')
suil_inc = include_directories ('inc/plugins/lv2')
all_inc = [
root_inc,
inc_inc,
ext_inc,
midilib_inc,
whereami_inc,
zix_inc,
weakjack_inc,
suil_inc,
]
resources_dir = meson_src_root / 'resources'
data_dir = meson_src_root / 'data'
cc = meson.get_compiler ('c')
# --- Check for programs ---
find_program ('sed')
find_program ('gettext')
msgattrib = find_program ('msgattrib')
msguniq = find_program ('msguniq')
bash = find_program ('bash')
grep = find_program ('grep')
msgfmt = find_program ('msgfmt', required: false)
dot_bin = find_program ('dot', required: false)
rubberband = find_program (
'rubberband', required: false)
cppcheck = find_program (
'cppcheck', required: false)
clang_tidy = find_program (
'clang-tidy', required: false)
jq = find_program ('jq', required: false)
ulimit = find_program (
'tools/check_have_unlimited_memlock.sh')
if os_gnu
have_unlimited_mem = run_command (
ulimit, check: true).stdout ().strip () == 'unlimited'
if have_unlimited_mem
cdata.set ('HAVE_UNLIMITED_MEM', 1)
endif
endif
# if latest version in changelog is the project's
# version, add the changelog to the config
chlog = fs.read ('CHANGELOG.md').split('\n## [')[1].strip ()
if chlog.contains (meson.project_version () + '] -')
chlog_date = chlog.split (' - ')[1].split ('\n')[0]
chlog = chlog.split (chlog_date + '\n')[1]
cdata.set ('HAVE_CHANGELOG', 1)
cdata.set_quoted ('CHANGELOG_DATE', chlog_date)
cdata.set_quoted ('CHANGELOG_TXT', '\\n'.join (chlog.split ('\n')))
endif
# find plugins for testing
ext_lv2_plugins = {
'ams_lfo': [
'AMS LFO',
'http://github.com/blablack/ams-lv2/lfo'],
'calf_monosynth': [
'Calf Monosynth',
'http://calf.sourceforge.net/plugins/Monosynth'],
'helm': [
'Helm', 'http://tytel.org/helm'],
'sherlock_atom_inspector': [
'Sherlock Atom Inspector',
'http://open-music-kontrollers.ch/lv2/sherlock#atom_inspector'],
'lsp_compressor': [
'LSP Compressor',
'http://lsp-plug.in/plugins/lv2/compressor_stereo'],
'lsp_sidechain_compressor': [
'LSP Sidechain Compressor',
'http://lsp-plug.in/plugins/lv2/sc_compressor_stereo'],
'lsp_multisampler_24_do': [
'LSP MultiSampler x24 Direct Out',
'http://lsp-plug.in/plugins/lv2/multisampler_x24_do'],
'carla_rack': [
'Carla Rack',
'http://kxstudio.sf.net/carla/plugins/carlarack'],
'no_delay_line': [
'No Delay Line',
'http://gareus.org/oss/lv2/nodelay'],
'mda_ambience': [
'mda Ambience',
'http://drobilla.net/plugins/mda/Ambience'],
'midi_cc_map': [
'MIDI CC Map',
'http://gareus.org/oss/lv2/midifilter#mapcc'],
'noize_maker': [
'NoizeMak3r',
'http://kunz.corrupt.ch/products/tal-noisemaker'],
'tal_filter': [
'TAL Filter',
'urn:juce:TalFilter'],
'geonkick': [
'Geonkick',
'http://geontime.com/geonkick/single'],
'chipwave': [
'ChipWave',
'https://github.com/linuxmao-org/shiru-plugins/chipwave'],
'calf_compressor': [
'Calf Compressor',
'http://calf.sourceforge.net/plugins/Compressor'],
}
have_ext_lv2_plugins = {}
ext_lv2_plugin_bundles = {}
ext_vst_plugins = {
'noizemaker': 'TAL-NoiseMaker.so',
}
have_ext_vst_plugins = {}
ext_vst_plugin_paths = {}
if get_option ('tests')
lv2ls_bin = find_program ('lv2ls', required: false)
lv2info_bin = find_program (
'lv2info', required: false)
get_lv2_bundle_uri_bin = find_program (
'tools/get_lv2_bundle_uri.sh')
get_vst_path_bin = find_program (
'tools/get_vst_path.sh')
# get lv2 bundle paths
if lv2ls_bin.found () and lv2info_bin.found ()
lv2ls_res = run_command (
lv2ls_bin, check: true).stdout ()
foreach name, info : ext_lv2_plugins
uri = info[1]
have_ext_lv2 = lv2ls_res.contains (uri)
have_ext_lv2_plugins += {
name: have_ext_lv2
}
if have_ext_lv2
ext_lv2_plugin_bundles += {
name: run_command (
get_lv2_bundle_uri_bin, lv2info_bin,
uri, check: true).stdout ().strip ()
}
endif
endforeach
endif
# get vst plugin paths
if get_vst_path_bin.found ()
foreach name, filename : ext_vst_plugins
have_ext_vst = run_command (
get_vst_path_bin,
filename).returncode () == 0
have_ext_vst_plugins += {
name: have_ext_vst
}
if have_ext_vst
ext_vst_plugin_paths += {
name: run_command (
get_vst_path_bin, filename,
check: true).stdout ().strip ()
}
endif
endforeach
endif
endif
# find command to open a directory
if os_gnu or os_freebsd
open_dir_cmd = find_program ('xdg-open').full_path ()
elif os_darwin
open_dir_cmd = 'open'
find_program (open_dir_cmd)
elif os_windows
open_dir_cmd = 'explorer.exe'
endif
cdata.set_quoted('OPEN_DIR_CMD', open_dir_cmd)
illegal_chars = [
' ', # U+202F
]
illegal_char_test_args = [
'-c', '! "$1" -rn "$2" "$3"', '_ignored',
grep.full_path (),
]
sphinx_build = find_program (
['sphinx-build', 'sphinx-build-3'],
required: get_option ('user_manual'))
sphinx_intl = find_program (
'sphinx-intl',
required: get_option ('user_manual'))
sass = find_program (
'sass', required: get_option ('user_manual'))
help2man = find_program (
['help2man'],
required: get_option ('manpage'))
stoat = find_program (
['stoat'], required: false)
python3 = find_program (
['python3', 'python'])
guile = find_program (
['guile2.2', 'guile'])
guild = find_program (
['guild2.2', 'guild'], required: false)
guile_snarf = find_program (
['guile-snarf2.2', 'guile-snarf'], required: false)
pandoc = find_program (
['pandoc'], required: false)
texi2html = find_program (
['texi2html'], required: false)
check_headers = [
'unistd.h',
'sys/time.h',
]
foreach h : check_headers
if cc.has_header(h)
cdata.set('HAVE_' + h.underscorify().to_upper(), 1)
endif
endforeach
# --- Check for dependencies/libraries ---
all_static = get_option ('static_deps')
# Maths functions might be implemented in libm
libm = cc.find_library (
'm', required: false, static: all_static)
check_functions = [
['mlock', libm],
]
# prefer jack1
jack_dep = dependency (
'jack', required: false, version: '<1.0',
static: all_static)
if not jack_dep.found ()
jack_dep = dependency (
'jack',
required: get_option ('jack'),
static: all_static)
endif
have_jack = jack_dep.found () and not get_option ('jack').disabled ()
if have_jack
cdata.set('HAVE_JACK', 1)
if jack_dep.version().version_compare('>=1.0')
cdata.set('HAVE_JACK2', 1)
endif
check_functions += [
['jack_set_property',[jack_dep]],
# do not add support for this - it causes
# problems with jack1/jack2 mixups
#['jack_client_stop_thread', [jack_dep]],
]
endif
glib_dep = dependency (
'glib-2.0', required: false,
static: all_static)
if glib_dep.found()
check_functions += [
# use a fallback if this does not exist (glib < 2.58)
['g_canonicalize_filename',[glib_dep]],
['g_get_console_charset',[glib_dep]],
]
else
cdata.set ('GLIB_SUBPROJECT', 1)
glib_proj = subproject ('glib')
glib_dep = glib_proj.get_variable ('libglib_dep')
endif
foreach func : check_functions
if cc.has_function(func[0], dependencies: func[1])
cdata.set('HAVE_' + func[0].underscorify().to_upper(), 1)
endif
endforeach
# check standard C functions
check_c_functions = [
'localtime_r',
]
foreach func : check_c_functions
if not cc.has_function (func)
cdata.set('HAVE_' + func.underscorify().to_upper(), 1)
endif
endforeach
# Compiler flags
test_cflags = [
'-Wformat=2',
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
'-Wno-sequence-point',
'-Wignored-qualifiers',
'-Wno-cast-function-type',
'-Walloca',
'-fno-common',
# dummy macro for extracting translatable strings
# when we can't use gettext()
'-D__(x)=x',
# use structured log
'-DG_LOG_USE_STRUCTURED=1',
'-DG_LOG_DOMAIN="' + prog_name_lowercase + '"',
]
# Stricter flags to be used where needed
test_strict_cflags = []
# add attribute macros
attributes = [
'const', 'cold', 'hot', 'pure', 'nonnull',
'returns_nonnull', 'stack_protect',
'no_stack_protector', 'deprecated',
]
foreach a : attributes
test_cflags += '-D' + a.to_upper() + '=__attribute__((' + a + '))'
endforeach
test_cflags += '-DDEPRECATED_MSG(x)=__attribute__((deprecated(x)))'
if cc.get_id() == 'clang'
test_cflags += [
'-DREALTIME=__attribute__((annotate("realtime")))',
]
else
test_cflags += [
'-DREALTIME=',
]
endif
if os_windows
test_cflags += [
'-DPATH_SPLIT=";"',
'-DUSE_WEAK_JACK=1',
]
else
test_cflags += [
'-DPATH_SPLIT=":"',
]
endif
if get_option ('profiling')
test_cflags += [ '-pg', 'no-pie' ]
if get_option ('extra_optimizations')
error ('extra_optimizations and profiling are incompatible')
endif
endif
if get_option ('extra_optimizations')
if host_machine.cpu() == 'x86_64'
test_cflags += [
'-ffast-math',
'-fstrength-reduce',
'-DPIC',
'-fdata-sections',
'-ffunction-sections',
'-freciprocal-math',
'-fsingle-precision-constant',
'-mtune=generic',
'-msse',
'-msse2',
'-mfpmath=sse',
#'-fvisibility=hidden',
]
endif
if get_option ('extra_debug_info') or get_option ('debug') or get_option ('buildtype').contains ('debug')
test_cflags += [
'-fno-omit-frame-pointer',
]
else
# note: this may break the backtrace
test_cflags += [
'-fomit-frame-pointer',
]
endif
endif
if get_option ('extra_extra_optimizations')
test_cflags += [
'-fallow-store-data-races',
'-ffinite-math-only',
'-fno-signed-zeros',
'-fno-trapping-math',
'-ffp-contract=fast',
'-fmodulo-sched',
]
endif
if get_option ('extra_debug_info')
test_cflags += '-g3 -ggdb'
endif
common_cflags = cc.get_supported_arguments (
test_cflags)
if os_freebsd
common_cflags += [
'-I' + includedir,
]
elif os_windows
common_cflags += [
'-mms-bitfields',
'-mwindows',
#'-mstackrealign',
'-Wl,-Bdynamic',
'-Wl,-as-needed',
'-D_WOE32=1',
]
endif
test_strict_cflags += [
#'-Werror=cast-qual',
'-Werror=clobbered',
#'-Werror=conversion',
'-Werror=disabled-optimization',
'-Werror=float-equal',
'-Werror=logical-op',
'-Werror=pointer-arith',
'-Werror=sign-conversion',
'-Werror=overlength-strings',
'-Werror=stringop-truncation',
'-Werror=missing-declarations',
'-Werror=int-to-pointer-cast',
#'-Werror=double-promotion',
#'-Werror=redundant-decls',
'-Werror=shadow',
'-Werror=undef',
'-Werror=unused',
# TODO enable following 2 lines to catch VLAs
#'-Wvla',
#'-Werror=vla',
'-fstrict-aliasing',
'-Wstrict-aliasing=2',
'-Werror=strict-aliasing',
#'-Werror=strict-overflow',
'-Wstrict-overflow=2',
'-fstrict-overflow',
'-Werror=duplicated-branches',
'-Werror=duplicated-cond',
#'-Werror=null-dereference',
'-Werror=init-self',
'-Werror=jump-misses-init',
'-Werror=missing-prototypes',
'-Werror=nested-externs',
'-Werror=write-strings',
'-Werror=implicit-fallthrough',
'-Werror=sign-compare',
'-Werror=discarded-qualifiers',
'-Werror=float-conversion',
'-Werror=implicit-function-declaration',
'-Werror=uninitialized',
'-Werror=maybe-uninitialized',
'-Werror=return-type',
'-Werror=int-conversion',
'-Werror=format-security',
'-Werror=incompatible-pointer-types',
'-Werror=implicit-int',
'-Werror=multistatement-macros',
'-Werror=switch',
'-Werror=overflow',
'-Werror=array-bounds',
'-Werror=enum-compare',
'-Werror=misleading-indentation',
'-Werror=int-in-bool-context',
'-Werror=type-limits',
'-Werror=deprecated-declarations',
'-Werror=format-extra-args',
'-Werror=format',
'-Werror=endif-labels',
'-Werror=logical-not-parentheses',
'-Werror=parentheses',
'-Werror=comment',
'-Werror=sizeof-pointer-div',
'-Werror=shift-count-overflow',
'-Werror=free-nonheap-object',
'-fanalyzer',
'-Werror=analyzer-possible-null-dereference',
'-Werror=analyzer-malloc-leak',
# gives false positives
#'-Werror=analyzer-null-dereference',
#'-Werror=analyzer-null-argument',
'-Werror=analyzer-use-after-free',
'-Werror=analyzer-possible-null-argument',
'-Werror=analyzer-double-free',
'-Werror=analyzer-file-leak',
'-Werror=nonnull',
'-Werror=nonnull-compare',
'-Werror=pointer-size',
'-Werror=override-init',
]
if cc.get_id() == 'gcc'
test_strict_cflags += [
'-Wextra',
'-Weverything',
]
endif
strict_cflags = []
if get_option ('strict_flags')
strict_cflags = cc.get_supported_arguments (
test_strict_cflags)
endif
# add -Wformat -Werror=format-security
if cc.get_id() == 'gcc'
common_cflags += [
'-Wformat',
'-Werror=format-security']
endif
test_ldflags = []
if get_option ('profiling')
test_ldflags += [ '-pg', 'no-pie' ]
endif
common_ldflags = cc.get_supported_link_arguments (
test_ldflags)
if os_freebsd
common_ldflags += [
'-L' + libdir,
'-lexecinfo',
]
endif
if os_windows
common_ldflags += [
'-fno-stack-protector',
'-lws2_32',
'-static-libgcc',
'-static-libstdc++',
]
endif
# set config defines
if not os_darwin
x11_dep = dependency (
'x11', required: false, static: all_static)
if (x11_dep.found ())
cdata.set('HAVE_X11', 1)
endif
endif
alsa_dep = dependency (
'alsa', required: false, static: all_static)
have_alsa = alsa_dep.found ()
if (have_alsa)
cdata.set('HAVE_ALSA', 1)
endif
pulseaudio_dep = dependency (
'libpulse', required: false, static: all_static)
have_pulseaudio = pulseaudio_dep.found ()
if (have_pulseaudio)
cdata.set('HAVE_PULSEAUDIO', 1)
endif
libsoundio_dep = cc.find_library (
'soundio', required: false, static: all_static)
have_libsoundio = libsoundio_dep.found ()
if (have_libsoundio)
cdata.set('HAVE_LIBSOUNDIO', 1)
endif
# force patched version of libcyaml from subproject
# see https://github.com/tlsa/libcyaml/issues/150
cyaml_dep = dependency(
'libcyaml', required: false, version: '>=99.1.0',
static: all_static)
if not cyaml_dep.found()
cyaml_proj = subproject('libcyaml')
cyaml_dep = cyaml_proj.get_variable(
'zrythm_cyaml_dep')
endif
audec_dep = dependency(
'audec', version: '>=0.3.2',
fallback: ['libaudec', 'libaudec_dep'],
required: true, static: all_static)
gtk_dep = dependency (
'gtk+-3.0', version: '>=3.22',
fallback: ['gtk3', 'libgtk_dep'],
static: all_static)
min_version = '>=1.0.25'
if get_option ('opus')
cdata.set('HAVE_OPUS', 1)
min_version = '>=1.0.29'
endif
sndfile_dep = dependency (
'sndfile', version: min_version, required: false)
if not sndfile_dep.found ()
sndfile_subproject = cmake.subproject (
'sndfile', options: cmake_opts)
sndfile_dep = sndfile_subproject.dependency (
'sndfile')
endif
samplerate_dep = dependency (
'samplerate', version: '>=0.1.8', required: false)
if not samplerate_dep.found ()
samplerate_subproject = cmake.subproject (
'samplerate', options: cmake_opts)
samplerate_dep = samplerate_subproject.dependency (
'samplerate')
endif
lv2_dep = dependency (
'lv2', version: '>=1.16.0',
fallback: ['lv2', 'lv2_dep'],
static: all_static)
if lv2_dep.version().version_compare('>=1.18.0')
cdata.set('HAVE_LV2_1_18', 1)
endif
serd_dep = dependency (
'serd-0', version: '>=0.30.0',
fallback: ['serd', 'serd_dep'],
static: all_static)
sord_dep = dependency (
'sord-0', version: '>=0.14.0',
fallback: ['sord', 'sord_dep'],
static: all_static)
sratom_dep = dependency (
'sratom-0', version: '>=0.4.0',
fallback: ['sratom', 'sratom_dep'],
static: all_static)
lilv_dep = dependency (
'lilv-0', version: '>=0.24.6',
fallback: ['lilv', 'lilv_dep'],
static: all_static)
# fftw
fftw3_deps = [
dependency (
'fftw3', version: '>=3.3.5', static: all_static),
dependency (
'fftw3_threads', required: false,
static: all_static),
dependency (
'fftw3f_threads', required: false,
static: all_static),
]
if os_darwin or os_freebsd
fftw3_deps += [
cc.find_library (
'fftw3_threads', required: true,
static: all_static,
dirs: [ '/usr/lib', '/usr/local/lib' ]),
cc.find_library (
'fftw3f_threads', required: true,
static: all_static,
dirs: [ '/usr/lib', '/usr/local/lib' ])
]
else
fftw3_deps += [
cc.find_library (
'fftw3_threads', required: false,
static: all_static),
cc.find_library (
'fftw3f_threads', required: false,
static: all_static)
]
endif
if os_windows
# msys2 provides a separate fftw3f entry in
# pkg-config
fftw3_deps += dependency (
'fftw3f', static: all_static)
endif
fftw3_funcs = [
'fftw_make_planner_thread_safe',
'fftwf_make_planner_thread_safe',
]
foreach func : fftw3_funcs
if not cc.has_function (func, dependencies: fftw3_deps)
warning (
func + ' missing. ' +
'If linking fails, on some systems you ' +
'may have to point zrythm to the ' +
'library that provides it directly, eg., ' +
'LDFLAGS="$LDFLAGS ' +
'/usr/lib/libfftw3_threads.so ' +
'/usr/lib/libfftw3f_threads.so')
endif
endforeach
chromaprint_dep = dependency (
'libchromaprint', required: false,
static: all_static)
if (chromaprint_dep.found ())
cdata.set('HAVE_CHROMAPRINT', 1)
endif
gtksource_dep = dependency (
'gtksourceview-4', required: false)
if gtksource_dep.found()
cdata.set('HAVE_GTK_SOURCE_VIEW_4', 1)
else
gtksource_dep = dependency (
'gtksourceview-3.0')
cdata.set('HAVE_GTK_SOURCE_VIEW_3', 1)
endif
libcgraph_dep = dependency (
'libcgraph',
required: get_option ('graphviz'),
static: all_static)
libgvc_dep = dependency (
'libgvc',
required: get_option ('graphviz'),
static: all_static)
have_graphviz = libcgraph_dep.found () and libgvc_dep.found ()
if have_graphviz
cdata.set('HAVE_CGRAPH', 1)
endif
guile_dep = dependency (
'guile-3.0', required: false,
static: all_static)
if not guile_dep.found ()
guile_dep = dependency (
'guile-2.2',
required: get_option ('guile'),
static: all_static)
endif
have_guile = guile_dep.found () and not get_option ('guile').disabled ()
if have_guile
cdata.set('HAVE_GUILE', 1)
endif
carla_host_plugin_dep = dependency (
'carla-host-plugin', version: '>=2.2.91',
required: get_option ('carla'),
static: all_static)
have_carla = carla_host_plugin_dep.found ()
if have_carla
carla_bins_dir = get_option ('carla_binaries_dir')
if carla_bins_dir == ''
carla_bins_dir = carla_host_plugin_dep.get_variable (pkgconfig: 'libdir')
endif
install_data (
find_program (
carla_bins_dir / 'carla-discovery-native.exe',
carla_bins_dir /
'carla-discovery-native').full_path(),
install_dir: zrythm_libdir / 'carla')
cdata.set('HAVE_CARLA', 1)
# install discovery & bridge for 32-bit vst's on
# windows
if os_windows
install_data (
find_program (
carla_bins_dir /
'carla-discovery-win32.exe').full_path(),
install_dir: zrythm_libdir / 'carla')
install_data (
find_program (
carla_bins_dir /
'carla-bridge-win32.exe').full_path(),
install_dir: zrythm_libdir / 'carla')
endif
# install gnu/linux bridges
bridge_types = [
'native', 'lv2-gtk2', 'lv2-gtk3', 'lv2-qt4',
'lv2-qt5', 'lv2-x11' ]
foreach bridge_type : bridge_types
carla_bridge = find_program (
carla_bins_dir / 'carla-bridge-' + bridge_type,
required: false)
if carla_bridge.found() and (os_gnu or os_freebsd)
cdata.set('HAVE_CARLA_BRIDGE_' + bridge_type.underscorify().to_upper(), 1)
install_data (
carla_bridge.full_path(),
install_dir: zrythm_libdir / 'carla')
endif
endforeach
endif
portaudio_dep = dependency (
# disable until it works
'portaudio-2.0-dont-use-yet',
required: get_option ('portaudio'),
static: all_static)
if portaudio_dep.found ()
cdata.set('HAVE_PORT_AUDIO', 1)
endif
rtmidi_dep = dependency (
'rtmidi', version: '>= 4.0.0',
required: get_option ('rtmidi'),
static: all_static)
if not rtmidi_dep.found () and not get_option ('rtmidi').disabled ()
rtmidi_proj = subproject('rtmidi')
rtmidi_dep = rtmidi_proj.get_variable(
'zrythm_rtmidi_dep')
endif
if rtmidi_dep.found ()
cdata.set('HAVE_RTMIDI', 1)
endif
rtaudio_dep = dependency (
'rtaudio', required: get_option ('rtaudio'),
version: '>=5.1.0',
static: all_static)
if not rtaudio_dep.found() and not get_option ('rtaudio').disabled ()
rtaudio_proj = subproject('rtaudio')