From fec1b0f367603249c1daa710f546332e8296b270 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Sep 2018 01:01:54 +0200 Subject: Make Suil dependency optional --- NEWS | 3 ++- src/jalv.c | 12 ++++++++++++ src/jalv_internal.h | 4 ++++ wscript | 13 +++++++++---- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 237e932..8737cd9 100644 --- a/NEWS +++ b/NEWS @@ -2,13 +2,14 @@ jalv (1.6.1) unstable; * Fix compilation with recent Gtkmm versions that require C++11 * Add jalv -i option to ignore stdin for background use + * Make Suil dependency optional * Fix Jack deactivation * Fix potential crash when closed with worker (thanks JP Cimalando) * Fix potential hang after Ctrl-c in console interface (thanks Laxmi Devi) * Add support for underscore in port names on command line (thanks Jośe Fernando Moyano) - -- David Robillard Thu, 20 Sep 2018 09:27:15 +0200 + -- David Robillard Fri, 21 Sep 2018 01:02:23 +0200 jalv (1.6.0) stable; diff --git a/src/jalv.c b/src/jalv.c index 38baa5f..8d267fb 100644 --- a/src/jalv.c +++ b/src/jalv.c @@ -59,7 +59,9 @@ #include "lilv/lilv.h" +#ifdef HAVE_SUIL #include "suil/suil.h" +#endif #include "lv2_evbuf.h" #include "worker.h" @@ -445,6 +447,7 @@ jalv_set_control(const ControlID* control, void jalv_ui_instantiate(Jalv* jalv, const char* native_ui_type, void* parent) { +#ifdef HAVE_SUIL jalv->ui_host = suil_host_new(jalv_ui_write, jalv_ui_port_index, NULL, NULL); const LV2_Feature parent_feature = { @@ -488,6 +491,7 @@ jalv_ui_instantiate(Jalv* jalv, const char* native_ui_type, void* parent) lilv_free(binary_path); lilv_free(bundle_path); +#endif } bool @@ -772,7 +776,9 @@ main(int argc, char** argv) jalv.bpm = 120.0f; jalv.control_in = (uint32_t)-1; +#ifdef HAVE_SUIL suil_init(&argc, &argv, SUIL_ARG_NONE); +#endif if (jalv_init(&argc, &argv, &jalv.opts)) { return EXIT_FAILURE; } @@ -1014,6 +1020,7 @@ main(int argc, char** argv) const char* native_ui_type_uri = jalv_native_ui_type(&jalv); jalv.uis = lilv_plugin_get_uis(jalv.plugin); if (!jalv.opts.generic_ui && native_ui_type_uri) { +#ifdef HAVE_SUIL const LilvNode* native_ui_type = lilv_new_uri(jalv.world, native_ui_type_uri); LILV_FOREACH(uis, u, jalv.uis) { const LilvUI* this_ui = lilv_uis_get(jalv.uis, u); @@ -1026,6 +1033,7 @@ main(int argc, char** argv) break; } } +#endif } else if (!jalv.opts.generic_ui && jalv.opts.show_ui) { jalv.ui = lilv_uis_get(jalv.uis, lilv_uis_begin(jalv.uis)); } @@ -1188,7 +1196,9 @@ main(int argc, char** argv) jalv_worker_destroy(&jalv.worker); /* Deactivate plugin */ +#ifdef HAVE_SUIL suil_instance_free(jalv.ui_instance); +#endif lilv_instance_deactivate(jalv.instance); lilv_instance_free(jalv.instance); @@ -1201,7 +1211,9 @@ main(int argc, char** argv) } symap_free(jalv.symap); zix_sem_destroy(&jalv.symap_lock); +#ifdef HAVE_SUIL suil_host_free(jalv.ui_host); +#endif sratom_free(jalv.sratom); sratom_free(jalv.ui_sratom); lilv_uis_free(jalv.uis); diff --git a/src/jalv_internal.h b/src/jalv_internal.h index 9108b47..bdf5e79 100644 --- a/src/jalv_internal.h +++ b/src/jalv_internal.h @@ -26,7 +26,9 @@ #include "lilv/lilv.h" #include "serd/serd.h" +#ifdef HAVE_SUIL #include "suil/suil.h" +#endif #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "lv2/lv2plug.in/ns/ext/atom/forge.h" @@ -295,8 +297,10 @@ struct Jalv { const LilvUI* ui; ///< Plugin UI (RDF data) const LilvNode* ui_type; ///< Plugin UI type (unwrapped) LilvInstance* instance; ///< Plugin instance (shared library) +#ifdef HAVE_SUIL SuilHost* ui_host; ///< Plugin UI host support SuilInstance* ui_instance; ///< Plugin UI instance (shared library) +#endif void* window; ///< Window (if applicable) struct Port* ports; ///< Port array of size num_ports Controls controls; ///< Available plugin controls diff --git a/wscript b/wscript index c84f891..1518339 100644 --- a/wscript +++ b/wscript @@ -26,6 +26,7 @@ def options(ctx): opt, {'portaudio': 'use PortAudio backend, not JACK', 'no-jack-session': 'do not build JACK session support', + 'no-gui': 'do not build any GUIs', 'no-gtk': 'do not build Gtk GUI', 'no-gtkmm': 'do not build Gtkmm GUI', 'no-gtk2': 'do not build Gtk2 GUI', @@ -49,8 +50,6 @@ def configure(conf): atleast_version='0.14.0', mandatory=True) autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD', atleast_version='0.12.0', mandatory=True) - autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL', - atleast_version='0.8.7', mandatory=True) autowaf.check_pkg(conf, 'sratom-0', uselib_store='SRATOM', atleast_version='0.6.0', mandatory=True) if Options.options.portaudio: @@ -60,7 +59,7 @@ def configure(conf): autowaf.check_pkg(conf, 'jack', uselib_store='JACK', atleast_version='0.120.0', mandatory=True) - if not Options.options.no_gtk: + if not Options.options.no_gui and not Options.options.no_gtk: if not Options.options.no_gtk2: autowaf.check_pkg(conf, 'gtk+-2.0', uselib_store='GTK2', atleast_version='2.18.0', mandatory=False) @@ -71,7 +70,7 @@ def configure(conf): autowaf.check_pkg(conf, 'gtk+-3.0', uselib_store='GTK3', atleast_version='3.0.0', mandatory=False) - if not Options.options.no_qt: + if not Options.options.no_gui and not Options.options.no_qt: if not Options.options.no_qt4: autowaf.check_pkg(conf, 'QtGui', uselib_store='QT4', atleast_version='4.0.0', mandatory=False) @@ -86,6 +85,12 @@ def configure(conf): if not conf.find_program('moc-qt5', var='MOC5', mandatory=False): conf.find_program('moc', var='MOC5') + have_gui = (conf.env.HAVE_GTK2 or conf.env.HAVE_GTKMM2 or conf.env.HAVE_GTK3 or + conf.env.HAVE_QT4 or conf.env.HAVE_QT5) + if have_gui: + autowaf.check_pkg(conf, 'suil-0', uselib_store='SUIL', + atleast_version='0.8.7') + if conf.env.HAVE_JACK: autowaf.check_function( conf, 'c', 'jack_port_type_get_buffer_size', -- cgit v1.2.1