Merge remote-tracking branch 'robertgzr/buildoptions' into clangen/contributions-03-12-2022

This commit is contained in:
casey langen 2022-03-12 13:17:51 -08:00
commit feb316864a
3 changed files with 27 additions and 23 deletions

View File

@ -4,28 +4,13 @@ if (NOT "${LIBOPENMPT}" STREQUAL "LIBOPENMPT-NOTFOUND")
add_plugin("src/plugins/libopenmptdecoder" "openmptdecoder")
endif()
# systemd / MPRIS detection
if (NOT ENABLE_MPRIS MATCHES "false")
find_library(LIB_SYSTEMD NAMES systemd)
if (NOT LIB_SYSTEMD MATCHES "LIB_SYSTEMD-NOTFOUND")
message(STATUS "[mpris] systemd found at " ${LIB_SYSTEMD})
message(STATUS "[mpris] setting ENABLE_MPRIS=true")
set(ENABLE_MPRIS "true")
else()
message(STATUS "[mpris] systemd *not* found. MPRIS plugin not enabled")
set(ENABLE_MPRIS "false")
endif()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_plugin("src/plugins/alsaout" "alsaout")
add_plugin("src/plugins/pulseout" "pulseout")
add_plugin("src/plugins/mpris" "mpris")
if (${ENABLE_PIPEWIRE} MATCHES "true")
add_plugin("src/plugins/pipewireout" "pipewireout")
endif()
if (${ENABLE_MPRIS} MATCHES "true")
add_plugin("src/plugins/mpris" "mpris")
endif()
if (${ENABLE_SNDIO} MATCHES "true")
add_plugin("src/plugins/sndioout" "sndioout")
endif()

View File

@ -1,7 +1,12 @@
macro(add_plugin plugin_dir plugin_name)
message(STATUS "[add-plugin] adding '${plugin_name}' at path '${plugin_dir}")
add_subdirectory(${plugin_dir})
get_property(PLUGIN_DISABLED GLOBAL PROPERTY "DISABLE_${plugin_name}")
if (NOT PLUGIN_DISABLED STREQUAL "true")
add_dependencies(musikcube ${plugin_name})
add_dependencies(musikcubed ${plugin_name})
add_dependencies(core_c_demo ${plugin_name})
else()
message(STATUS "[add-plugin] *** WARNING! *** ${plugin_name} not found.")
endif()
endmacro(add_plugin)

View File

@ -2,8 +2,22 @@ set (mpris_SOURCES
mpris.cpp
dbus.cpp)
find_package(PkgConfig)
pkg_check_modules (SYSTEMD REQUIRED libsystemd)
if (USE_ELOGIND MATCHES "true")
set(SDBUS "libelogind >= 239.3")
elseif (USE_BASU MATCHES "true")
set(SDBUS "basu")
else()
set(SDBUS "libsystemd")
endif()
find_package(PkgConfig)
pkg_check_modules(SDBUS IMPORTED_TARGET ${SDBUS})
if (SDBUS_LINK_LIBRARIES STREQUAL "")
message(STATUS "[mpris] plugin enabled. using " ${SDBUS_LINK_LIBRARIES})
add_library(mpris SHARED ${mpris_SOURCES})
target_link_libraries(mpris systemd)
target_link_libraries(mpris PkgConfig::SDBUS)
else()
set_property(GLOBAL PROPERTY DISABLE_mpris "true")
message(STATUS "[mpris] plugin *not* enabled. setting 'DISABLE_mpris=true'")
endif()