From 2ee397091946edb80558885c1554818f443446b8 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Tue, 30 May 2023 02:49:21 +0000 Subject: [PATCH 1/2] mpris: also accept -DUSE_BASU=1 or -DUSE_BASU=ON --- src/plugins/mpris/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/mpris/CMakeLists.txt b/src/plugins/mpris/CMakeLists.txt index 1180d1cc8..e9c6a3742 100644 --- a/src/plugins/mpris/CMakeLists.txt +++ b/src/plugins/mpris/CMakeLists.txt @@ -2,9 +2,9 @@ set (mpris_SOURCES mpris.cpp dbus.cpp) -if (USE_ELOGIND MATCHES "true") +if (USE_ELOGIND) set(SDBUS "libelogind >= 239.3") -elseif (USE_BASU MATCHES "true") +elseif (USE_BASU) set(SDBUS "basu") else() set(SDBUS "libsystemd") From a9b08fab3be3ca5e4123508eab8f4fbc6ff39d7e Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Tue, 30 May 2023 02:52:54 +0000 Subject: [PATCH 2/2] mpris: respect USE_BASU for include In file included from src/plugins/mpris/mpris.cpp:2: src/plugins/mpris/mpris.h:11:14: fatal error: 'systemd/sd-bus.h' file not found #include ^~~~~~~~~~~~~~~~~~ --- src/plugins/mpris/CMakeLists.txt | 4 ++++ src/plugins/mpris/dbus.h | 2 +- src/plugins/mpris/mpris.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/mpris/CMakeLists.txt b/src/plugins/mpris/CMakeLists.txt index e9c6a3742..2468be502 100644 --- a/src/plugins/mpris/CMakeLists.txt +++ b/src/plugins/mpris/CMakeLists.txt @@ -4,10 +4,13 @@ set (mpris_SOURCES if (USE_ELOGIND) set(SDBUS "libelogind >= 239.3") + set(SDBUS_HEADER "") elseif (USE_BASU) set(SDBUS "basu") + set(SDBUS_HEADER "") else() set(SDBUS "libsystemd") + set(SDBUS_HEADER "") endif() find_package(PkgConfig) @@ -18,5 +21,6 @@ if (NOT DEFINED SDBUS_LINK_LIBRARIES) else() message(STATUS "[mpris] plugin enabled. using " ${SDBUS_LINK_LIBRARIES}) add_library(mpris SHARED ${mpris_SOURCES}) + target_compile_definitions(mpris PUBLIC SDBUS_HEADER=${SDBUS_HEADER}) target_link_libraries(mpris PkgConfig::SDBUS) endif() diff --git a/src/plugins/mpris/dbus.h b/src/plugins/mpris/dbus.h index 03e098dbf..8099dc3c1 100644 --- a/src/plugins/mpris/dbus.h +++ b/src/plugins/mpris/dbus.h @@ -1,7 +1,7 @@ #pragma once extern "C" { - #include + #include SDBUS_HEADER } extern const sd_bus_vtable musikcube_mp_table[]; diff --git a/src/plugins/mpris/mpris.h b/src/plugins/mpris/mpris.h index 92d145c75..ce6e8e567 100644 --- a/src/plugins/mpris/mpris.h +++ b/src/plugins/mpris/mpris.h @@ -8,7 +8,7 @@ #include extern "C" { - #include + #include SDBUS_HEADER } using namespace musik::core::sdk;