Skip to content

Commit 2f6ca07

Browse files
committed
use features instead of booleans for optional dependencies
1 parent fc0efd4 commit 2f6ca07

10 files changed

Lines changed: 169 additions & 148 deletions

File tree

.builds/archlinux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ secrets:
3535
tasks:
3636
- setup: |
3737
cd zrythm
38-
../meson/meson.py build -Denable_tests=true -Dmanpage=true -Denable_ffmpeg=true -Db_coverage=true
38+
../meson/meson.py build -Denable_tests=true -Dmanpage=true -Dffmpeg=enabled -Db_coverage=true
3939
- build: |
4040
cd zrythm
4141
ninja -C build

.builds/debian.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ sources:
3232
tasks:
3333
- setup: |
3434
cd zrythm
35-
../meson/meson.py build -Denable_tests=true -Dmanpage=true -Denable_ffmpeg=true
35+
../meson/meson.py build -Denable_tests=true -Dmanpage=true -Dffmpeg=enabled
3636
- build: |
3737
cd zrythm
3838
ninja -C build

.builds/ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ sources:
3232
tasks:
3333
- setup: |
3434
cd zrythm
35-
../meson/meson.py build -Denable_tests=true -Dmanpage=true -Denable_ffmpeg=true
35+
../meson/meson.py build -Denable_tests=true -Dmanpage=true -Dffmpeg=enabled
3636
- build: |
3737
cd zrythm
3838
ninja -C build

.travis.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ script:
6464
set -e
6565
case $TRAVIS_OS_NAME in
6666
osx)
67-
meson build -Denable_sdl=true -Denable_rtaudio=true -Denable_rtmidi=true -Denable_tests=true -Denable_jack=false
67+
meson build -Dsdl=enabled -Drtaudio=auto -Drtmidi=auto -Denable_tests=true
6868
ninja -C build
6969
ninja -C build test
7070
sudo ninja -C build install
@@ -73,11 +73,7 @@ script:
7373
# hack to enable tests
7474
$mingw64 sed -i -e '27s/false/true/' meson_options.txt
7575
# hack to enable sdl
76-
$mingw64 sed -i -e '63s/false/true/' meson_options.txt
77-
# hack to disable jack
78-
$mingw64 sed -i -e '75s/true/false/' meson_options.txt
79-
# hack to disable guile
80-
$mingw64 sed -i -e '87s/true/false/' meson_options.txt
76+
$mingw64 sed -i -e '63s/disabled/enabled/' meson_options.txt
8177
$mingw64 meson build
8278
$mingw64 ninja -C build
8379
$mingw64 ninja -C build test

data/meson.build

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
1+
# Copyright (C) 2019-2020 Alexandros Theodotou <alex at zrythm dot org>
22
#
33
# This file is part of Zrythm
44
#
@@ -97,12 +97,10 @@ if not os_windows
9797
endif
9898

9999
# GtkSourceView styles
100-
if get_option ('enable_guile')
101-
install_data (
102-
'gtksourceview-monokai-extended.xml',
103-
install_dir: sourceviewstylesdir,
104-
rename: 'monokai-extended-zrythm.xml')
105-
endif
100+
install_data (
101+
'gtksourceview-monokai-extended.xml',
102+
install_dir: sourceviewstylesdir,
103+
rename: 'monokai-extended-zrythm.xml')
106104

107105
# theme
108106
install_data (

doc/user/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ endif
5858

5959
# generate guile docs
6060
guile_docs = []
61-
if get_option ('enable_guile') and get_option ('guile_snarf_docs_path') != ''
61+
if guile_dep.found () and get_option ('guile_snarf_docs_path') != ''
6262
foreach snarfable_src : guile_snarfable_srcs
6363
split_by_dot = snarfable_src.split('.')
6464
without_ext = ''

meson.build

Lines changed: 128 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,11 @@ check_functions = [
210210
jack_dep = dependency (
211211
'jack', required: false, version: '<1.0')
212212
if not jack_dep.found ()
213-
jack_dep = dependency ('jack', required: false)
213+
jack_dep = dependency (
214+
'jack',
215+
required: get_option ('jack'))
214216
endif
215-
if (not get_option ('enable_jack').disabled ()) and jack_dep.found ()
217+
if jack_dep.found ()
216218
cdata.set('HAVE_JACK', 1)
217219
check_functions += [
218220
['jack_set_property',[jack_dep]],
@@ -436,59 +438,59 @@ else
436438
cdata.set('HAVE_GTK_SOURCE_VIEW_3', 1)
437439
endif
438440

439-
# TODO add Cantarell font as dependency
440-
441-
zrythm_deps = [
442-
jack_dep,
443-
gtk_dep,
444-
sndfile_dep,
445-
libgtop_dep,
446-
alsa_dep,
447-
cyaml_dep,
448-
audec_dep,
449-
dependency('threads'),
450-
lilv_dep,
451-
dependency(
452-
'sratom-0',
453-
fallback: ['lilv', 'sratom_dep']),
454-
dependency(
455-
'serd-0',
456-
fallback: ['lilv', 'serd_dep']),
457-
dependency(
458-
'sord-0',
459-
fallback: ['lilv', 'sord_dep']),
460-
dependency('samplerate', version: '>=0.1.8'),
461-
dependency('rubberband'),
462-
dependency ('libpcre'),
463-
cc.find_library('dl'),
464-
lv2_dep,
465-
chromaprint_dep,
466-
fftw3_dep,
467-
gtksource_dep,
441+
libcgraph_dep = dependency (
442+
'libcgraph',
443+
required: get_option ('graphviz'))
444+
libgvc_dep = dependency (
445+
'libgvc',
446+
required: get_option ('graphviz'))
447+
if libcgraph_dep.found () and libgvc_dep.found ()
448+
cdata.set('HAVE_CGRAPH', 1)
449+
endif
468450

469-
# these are needed for gentoo
470-
dependency('fftw3_threads', required: false),
471-
dependency('fftw3f_threads', required: false),
451+
guile_dep = dependency (
452+
'guile-3.0', required: false)
453+
if not guile_dep.found ()
454+
guile_dep = dependency (
455+
'guile-2.2',
456+
required: get_option ('guile'))
457+
endif
458+
if (guile_dep.found ())
459+
cdata.set('HAVE_GUILE', 1)
460+
endif
472461

473-
libm,
474-
]
462+
libavcodec_dep = dependency (
463+
'libavcodec',
464+
required: get_option ('ffmpeg'))
465+
libavformat_dep = dependency (
466+
'libavformat',
467+
required: get_option ('ffmpeg'))
468+
libavutil_dep = dependency (
469+
'libavformat',
470+
required: get_option ('ffmpeg'))
471+
if libavcodec_dep.found () and libavformat_dep.found () and libavutil_dep.found ()
472+
cdata.set('HAVE_FFMPEG', 1)
473+
endif
475474

476-
if (get_option('enable_carla'))
477-
cdata.set('HAVE_CARLA', 1)
478-
carla_native_plugin_dep = dependency (
479-
'carla-native-plugin', version: '>=2.1.0')
480-
carla_standalone_dep = dependency (
481-
'carla-standalone', version: '>=2.1.0')
482-
carla_utils_dep = dependency (
483-
'carla-utils', version: '>=2.1.0')
475+
carla_native_plugin_dep = dependency (
476+
'carla-native-plugin', version: '>=2.1.0',
477+
required: get_option ('carla'))
478+
carla_standalone_dep = dependency (
479+
'carla-standalone', version: '>=2.1.0',
480+
required: get_option ('carla'))
481+
carla_utils_dep = dependency (
482+
'carla-utils', version: '>=2.1.0',
483+
required: get_option ('carla'))
484+
if (carla_native_plugin_dep.found () and carla_standalone_dep.found () and carla_utils_dep.found ())
484485
carla_libdir = carla_native_plugin_dep.get_pkgconfig_variable('libdir')
485486
install_data (
486487
find_program (
487488
carla_libdir / 'carla-discovery-native.exe',
488489
carla_libdir /
489490
'carla-discovery-native').path(),
490491
install_dir: bindir)
491-
# discovery & bridge for 32-bit vst's
492+
cdata.set('HAVE_CARLA', 1)
493+
# discovery & bridge for 32-bit vst's
492494
if os_windows
493495
install_data (
494496
find_program (
@@ -501,68 +503,93 @@ if (get_option('enable_carla'))
501503
'carla-bridge-win32.exe').path(),
502504
install_dir: bindir)
503505
endif
504-
zrythm_deps += [
505-
carla_native_plugin_dep,
506-
carla_standalone_dep,
507-
carla_utils_dep, ]
508-
endif
509-
510-
if (get_option('enable_ffmpeg'))
511-
zrythm_deps += dependency('libavcodec')
512-
zrythm_deps += dependency('libavformat')
513-
zrythm_deps += dependency('libavutil')
514-
cdata.set('HAVE_FFMPEG', 1)
515506
endif
516507

517-
if (get_option ('enable_graphviz'))
518-
zrythm_deps += dependency ('libcgraph')
519-
zrythm_deps += dependency ('libgvc')
520-
cdata.set('HAVE_CGRAPH', 1)
521-
endif
522-
523-
if (get_option('enable_portaudio'))
524-
zrythm_deps += dependency ('portaudio-2.0')
508+
portaudio_dep = dependency (
525509
# disable until it works
526-
#cdata.set('HAVE_PORT_AUDIO', 1)
510+
'portaudio-2.0-dont-use-yet',
511+
required: get_option ('portaudio'))
512+
if portaudio_dep.found ()
513+
cdata.set('HAVE_PORT_AUDIO', 1)
527514
endif
528515

529-
if (get_option('enable_rtmidi'))
530-
rtmidi_dep = dependency ('rtmidi', required: false)
531-
if not rtmidi_dep.found()
532-
rtmidi_proj = subproject('rtmidi')
533-
rtmidi_dep = rtmidi_proj.get_variable(
534-
'zrythm_rtmidi_dep')
535-
endif
536-
zrythm_deps += rtmidi_dep
516+
rtmidi_dep = dependency (
517+
'rtmidi', required: get_option ('rtmidi'))
518+
if not rtmidi_dep.found () and not get_option ('rtmidi').disabled ()
519+
rtmidi_proj = subproject('rtmidi')
520+
rtmidi_dep = rtmidi_proj.get_variable(
521+
'zrythm_rtmidi_dep')
522+
endif
523+
if rtmidi_dep.found ()
537524
cdata.set('HAVE_RTMIDI', 1)
538525
endif
539526

540-
if (get_option('enable_rtaudio'))
541-
rtaudio_dep = dependency (
542-
'rtaudio', required: false)
543-
if not rtaudio_dep.found()
544-
rtaudio_proj = subproject('rtaudio')
545-
rtaudio_dep = rtaudio_proj.get_variable(
546-
'zrythm_rtaudio_dep')
547-
endif
548-
zrythm_deps += rtaudio_dep
527+
rtaudio_dep = dependency (
528+
'rtaudio', required: get_option ('rtaudio'))
529+
if not rtaudio_dep.found() and not get_option ('rtaudio').disabled ()
530+
rtaudio_proj = subproject('rtaudio')
531+
rtaudio_dep = rtaudio_proj.get_variable(
532+
'zrythm_rtaudio_dep')
533+
endif
534+
if rtaudio_dep.found ()
549535
cdata.set('HAVE_RTAUDIO', 1)
550536
endif
551537

552-
if (get_option('enable_sdl'))
553-
zrythm_deps += dependency ('sdl2')
538+
sdl_dep = dependency (
539+
'sdl2', required: get_option ('sdl'))
540+
if sdl_dep.found ()
554541
cdata.set('HAVE_SDL', 1)
555542
endif
556543

557-
if get_option('enable_guile')
558-
guile_dep = dependency (
559-
'guile-3.0', required: false)
560-
if not guile_dep.found ()
561-
guile_dep = dependency ('guile-2.2')
562-
endif
563-
zrythm_deps += guile_dep
564-
cdata.set('HAVE_GUILE', 1)
565-
endif
544+
# TODO add Cantarell font as dependency
545+
546+
zrythm_deps = [
547+
jack_dep,
548+
gtk_dep,
549+
sndfile_dep,
550+
libgtop_dep,
551+
alsa_dep,
552+
cyaml_dep,
553+
audec_dep,
554+
libcgraph_dep,
555+
libgvc_dep,
556+
guile_dep,
557+
libavcodec_dep,
558+
libavformat_dep,
559+
libavutil_dep,
560+
carla_native_plugin_dep,
561+
carla_standalone_dep,
562+
carla_utils_dep,
563+
portaudio_dep,
564+
rtaudio_dep,
565+
rtmidi_dep,
566+
sdl_dep,
567+
dependency('threads'),
568+
lilv_dep,
569+
dependency(
570+
'sratom-0',
571+
fallback: ['lilv', 'sratom_dep']),
572+
dependency(
573+
'serd-0',
574+
fallback: ['lilv', 'serd_dep']),
575+
dependency(
576+
'sord-0',
577+
fallback: ['lilv', 'sord_dep']),
578+
dependency('samplerate', version: '>=0.1.8'),
579+
dependency('rubberband'),
580+
dependency ('libpcre'),
581+
cc.find_library('dl'),
582+
lv2_dep,
583+
chromaprint_dep,
584+
fftw3_dep,
585+
gtksource_dep,
586+
587+
# these are needed for gentoo
588+
dependency('fftw3_threads', required: false),
589+
dependency('fftw3f_threads', required: false),
590+
591+
libm,
592+
]
566593

567594
if os_windows
568595
zrythm_deps += cc.find_library('dbghelp')
@@ -660,15 +687,15 @@ summary({
660687
}, section: 'General')
661688

662689
summary({
663-
'FFmpeg': get_option('enable_ffmpeg'),
664-
'Jack': not get_option('enable_jack').disabled(),
665-
'PortAudio': get_option('enable_portaudio'),
666-
'RtMidi': get_option('enable_rtmidi'),
667-
'RtAudio': get_option('enable_rtaudio'),
668-
'SDL': get_option('enable_sdl'),
669-
'Carla': get_option('enable_carla'),
690+
'FFmpeg': libavcodec_dep.found () and libavformat_dep.found () and libavutil_dep.found (),
691+
'Jack': jack_dep.found (),
692+
'PortAudio': portaudio_dep.found (),
693+
'RtMidi': rtmidi_dep.found (),
694+
'RtAudio': rtaudio_dep.found (),
695+
'SDL': sdl_dep.found (),
696+
'Carla': carla_native_plugin_dep.found () and carla_standalone_dep.found () and carla_utils_dep.found (),
670697
'Gtop': libgtop_dep.found(),
671-
'Guile': get_option('enable_guile'),
698+
'Guile': guile_dep. found(),
672699
}, section: 'Optional libraries')
673700

674701
summary({

0 commit comments

Comments
 (0)