From 9995169ab01c6a274a471b6f6d5f560683b0ae99 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 4 Oct 2021 12:23:05 +0200 Subject: build: Fix build when grlnet support is disabled Closes: #147 --- bindings/vala/meson.build | 5 ++++- meson.build | 1 + tests/autoptr.c | 5 +++++ tests/meson.build | 14 +++++++++++--- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build index 9c2d9c0..493634c 100644 --- a/bindings/vala/meson.build +++ b/bindings/vala/meson.build @@ -7,9 +7,12 @@ vala_sources = [ # LIBRARY, GIR, DEPS ['grilo-@0@'.format(grl_majorminor), grl_gir[0], ['gmodule-2.0', 'gio-2.0']], - ['grilo-net-@0@'.format(grl_majorminor), grlnet_gir[0], ['gio-2.0']], ] +if enable_grlnet + vala_sources += [['grilo-net-@0@'.format(grl_majorminor), grlnet_gir[0], ['gio-2.0']]] +endif + foreach s: vala_sources custom_vala = '@0@-custom.vala'.format(s[0]) lib = s[0] diff --git a/meson.build b/meson.build index f76d790..263ed81 100644 --- a/meson.build +++ b/meson.build @@ -105,6 +105,7 @@ endif cdata = configuration_data() cdata.set_quoted('VERSION', grilo_version) cdata.set('GRLNET_VERSION', grlnet_version) +cdata.set('HAVE_GRLNET', enable_grlnet) cdata.set('GRLPLS_VERSION', grlpls_version) cdata.set_quoted('GRL_MAJORMINOR', grl_majorminor) cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name()) diff --git a/tests/autoptr.c b/tests/autoptr.c index faef432..51080f7 100644 --- a/tests/autoptr.c +++ b/tests/autoptr.c @@ -22,9 +22,11 @@ * This code is based on glib/tests/autoptr.c */ +#include "config.h" #include #include +#ifdef HAVE_GRLNET #include static void @@ -33,6 +35,7 @@ test_grl_net_wc (void) g_autoptr (GrlNetWc) val = grl_net_wc_new (); g_assert_nonnull (val); } +#endif /* HAVE_GRLNET */ static void test_grl_data (void) @@ -87,7 +90,9 @@ main (int argc, grl_init (&argc, &argv); +#ifdef HAVE_GRLNET g_test_add_func ("/autoptr/grl_net_wc", test_grl_net_wc); +#endif g_test_add_func ("/autoptr/grl_data", test_grl_data); g_test_add_func ("/autoptr/grl_media", test_grl_media); diff --git a/tests/meson.build b/tests/meson.build index 560a725..471fa73 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -6,18 +6,26 @@ tests = [ 'autoptr', - 'lib-net', 'media', 'registry', 'operations', ] +test_link_with = [libgrl] +test_deps = [libgrl_dep] + +if enable_grlnet + tests += ['lib-net'] + test_link_with += libgrlnet + test_deps += libgrlnet_dep +endif + foreach t: tests source = t + '.c' exe = executable(t, source, install: false, - link_with: [libgrl, libgrlnet], - dependencies: [libgrl_dep, libgrlnet_dep]) + link_with: test_link_with, + dependencies: test_deps) test(t, exe, timeout:10) endforeach -- cgit v1.2.1