[retro-gtk] build: Allow to disable pulseaudio
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] build: Allow to disable pulseaudio
- Date: Sun, 16 Feb 2020 17:05:02 +0000 (UTC)
commit 7757828d8249f108e6e5d77824ca837916b77fe1
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun Feb 16 21:34:22 2020 +0500
build: Allow to disable pulseaudio
Pulseaudio isn't necessarily available in the testing environment in CI.
This will allow to disable it there.
meson.build | 4 ++--
meson_options.txt | 4 ++++
retro-gtk/meson.build | 1 -
retro-runner/ipc-runner-impl.c | 8 ++++++++
retro-runner/meson.build | 6 +++++-
retro-runner/retro-pa-player.c | 4 ++++
6 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8d11fe4..58db859 100644
--- a/meson.build
+++ b/meson.build
@@ -31,9 +31,9 @@ glib = dependency ('glib-2.0', version: glib_version)
gmodule = dependency ('gmodule-2.0', version: glib_version)
gobject = dependency ('gobject-2.0', version: glib_version)
gtk = dependency ('gtk+-3.0', version: gtk_version)
-libpulse_simple = dependency ('libpulse-simple')
+libpulse_simple = dependency ('libpulse-simple', required : get_option('pulseaudio'))
m = cc.find_library('m', required : false)
-samplerate = dependency ('samplerate')
+samplerate = dependency ('samplerate', required : get_option('pulseaudio'))
config_h = configuration_data()
config_h.set_quoted ('RETRO_PLUGIN_PATH', ':'.join ([libretrodir, libdir]))
diff --git a/meson_options.txt b/meson_options.txt
index a2cf858..de6899b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,7 @@
+# Dependencies
+option('pulseaudio', type: 'feature', value: 'enabled',
+ description : 'Enable audio playback via PulseAudio')
+
# Documentation and introspection
option('introspection', type: 'boolean', value: 'true',
description : 'Build introspection data (requires gobject-introspection)')
diff --git a/retro-gtk/meson.build b/retro-gtk/meson.build
index 8da3a2b..25a83b7 100644
--- a/retro-gtk/meson.build
+++ b/retro-gtk/meson.build
@@ -138,7 +138,6 @@ if get_option('introspection')
'gmodule-2.0',
'gobject-2.0',
'gtk+-3.0',
- # 'libpulse-simple',
]
gnome.generate_vapi(
diff --git a/retro-runner/ipc-runner-impl.c b/retro-runner/ipc-runner-impl.c
index 25de6ac..005f81b 100644
--- a/retro-runner/ipc-runner-impl.c
+++ b/retro-runner/ipc-runner-impl.c
@@ -7,14 +7,18 @@
#include <gio/gunixfdlist.h>
#include "retro-core-private.h"
#include "retro-keyboard-key-private.h"
+#ifdef PULSEAUDIO_ENABLED
#include "retro-pa-player-private.h"
+#endif
struct _IpcRunnerImpl
{
IpcRunnerSkeleton parent_instance;
RetroCore *core;
+#ifdef PULSEAUDIO_ENABLED
RetroPaPlayer *audio_player;
+#endif
GVariant *variables;
gboolean block_video_signal;
@@ -567,8 +571,10 @@ ipc_runner_impl_constructed (GObject *object)
{
IpcRunnerImpl *self = (IpcRunnerImpl *)object;
+#ifdef PULSEAUDIO_ENABLED
self->audio_player = retro_pa_player_new ();
retro_pa_player_set_core (self->audio_player, self->core);
+#endif
g_object_bind_property (self->core, "api-version",
self, "api-version",
@@ -620,7 +626,9 @@ ipc_runner_impl_finalize (GObject *object)
g_signal_handlers_disconnect_by_data (self->core, self);
g_object_unref (self->core);
+#ifdef PULSEAUDIO_ENABLED
g_object_unref (self->audio_player);
+#endif
G_OBJECT_CLASS (ipc_runner_impl_parent_class)->finalize (object);
}
diff --git a/retro-runner/meson.build b/retro-runner/meson.build
index 41238db..3285986 100644
--- a/retro-runner/meson.build
+++ b/retro-runner/meson.build
@@ -19,7 +19,6 @@ retro_runner_deps = [
gio,
gio_unix,
gmodule,
- libpulse_simple,
m,
samplerate,
]
@@ -30,6 +29,11 @@ retro_runner_c_args = [
'-DRETRO_RUNNER_COMPILATION',
]
+if libpulse_simple.found()
+ retro_runner_c_args += '-DPULSEAUDIO_ENABLED'
+ retro_runner_deps += libpulse_simple
+endif
+
executable(
'retro-runner',
retro_runner_sources,
diff --git a/retro-runner/retro-pa-player.c b/retro-runner/retro-pa-player.c
index 488e874..9dcde9b 100644
--- a/retro-runner/retro-pa-player.c
+++ b/retro-runner/retro-pa-player.c
@@ -1,5 +1,7 @@
// This file is part of retro-gtk. License: GPL-3.0+.
+#ifdef PULSEAUDIO_ENABLED
+
#include "retro-pa-player-private.h"
#include "retro-core-private.h"
@@ -253,3 +255,5 @@ retro_pa_player_new (void)
{
return g_object_new (RETRO_TYPE_PA_PLAYER, NULL);
}
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]