[grilo/wip/hadess/grlnet-disable-fix: 1/2] build: Fix build when grlnet support is disabled
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo/wip/hadess/grlnet-disable-fix: 1/2] build: Fix build when grlnet support is disabled
- Date: Mon, 4 Oct 2021 10:27:07 +0000 (UTC)
commit 0ee7c3ab43d72877f7634302239eb535f9bcafae
Author: Bastien Nocera <hadess hadess net>
Date: Mon Oct 4 12:23:05 2021 +0200
build: Fix build when grlnet support is disabled
Closes: #147
bindings/vala/meson.build | 7 ++++++-
meson.build | 1 +
tests/autoptr.c | 5 +++++
tests/meson.build | 14 +++++++++++---
4 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build
index 9c2d9c0a..ae250415 100644
--- a/bindings/vala/meson.build
+++ b/bindings/vala/meson.build
@@ -5,11 +5,16 @@
#
# Copyright (C) 2016 Igalia S.L. All rights reserved.
+
+
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 f76d790a..263ed81b 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 faef432a..51080f7b 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 <glib.h>
#include <grilo.h>
+#ifdef HAVE_GRLNET
#include <net/grl-net.h>
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 560a7251..471fa733 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]