Introduced add_plugin() to CMake build system to ensure dependencies are

properly configured for musikcube and musikcubed targets.
This commit is contained in:
Casey Langen 2022-02-10 18:34:07 -08:00
parent 0f80b32674
commit c59b130569
3 changed files with 26 additions and 21 deletions

View File

@ -1,10 +1,7 @@
# libopenmpt detection
find_library(LIBOPENMPT NAMES openmpt)
if ("${LIBOPENMPT}" STREQUAL "LIBOPENMPT-NOTFOUND")
message(STATUS "[libopenmpt] *not* found! plugin will not be built.")
else()
message(STATUS "[libopenmpt] enabled = true; found library at ${LIBOPENMPT}")
add_subdirectory(src/plugins/libopenmptdecoder)
if (NOT "${LIBOPENMPT}" STREQUAL "LIBOPENMPT-NOTFOUND")
add_plugin(libopenmptdecoder)
endif()
# systemd / MPRIS detection
@ -24,28 +21,28 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_subdirectory(src/plugins/alsaout)
add_subdirectory(src/plugins/pulseout)
if (${ENABLE_PIPEWIRE} MATCHES "true")
add_subdirectory(src/plugins/pipewireout)
add_plugin(pipewireout)
endif()
if (${ENABLE_MPRIS} MATCHES "true")
add_subdirectory(src/plugins/mpris)
add_plugin(mpris)
endif()
if (${ENABLE_SNDIO} MATCHES "true")
add_subdirectory(src/plugins/sndioout)
add_plugin(sndioout)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_subdirectory(src/plugins/sndioout)
if (${ENABLE_PULSEAUDIO} MATCHES "true")
add_subdirectory(src/plugins/pulseout) # disabled by default
add_plugin(pulseout)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_subdirectory(src/plugins/sndioout)
if (${ENABLE_PULSEAUDIO} MATCHES "true")
add_subdirectory(src/plugins/pulseout) # disabled by default
add_plugin(pulseout)
endif()
if (${ENABLE_ALSA} MATCHES "true")
add_subdirectory(src/plugins/alsaout) # disabled by default
add_plugin(alsaout)
endif()
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_subdirectory(src/plugins/coreaudioout)
add_subdirectory(src/plugins/macosmediakeys)
add_plugin(coreaudioout)
add_plugin(macosmediakeys)
endif()

6
.cmake/AddPlugin.cmake Normal file
View File

@ -0,0 +1,6 @@
function(add_plugin plugin_name)
message(STATUS "[add-plugin] adding '${plugin_name}' to musikcube and musikcubed targets")
add_subdirectory("src/plugins/${plugin_name}")
add_dependencies(musikcube plugin_name)
add_dependencies(musikcubed plugin_name)
endfunction(add_plugin)

View File

@ -16,6 +16,7 @@ set (EXECUTABLE_OUTPUT_PATH ${musikcube_SOURCE_DIR}/bin)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake)
include(CMakeToolsHelpers OPTIONAL)
include(CheckAtomic)
include(AddPlugin)
include(ConfigureRpath)
include(ConfigureStandalone)
include(ConfigureBsdPaths)
@ -72,18 +73,19 @@ add_subdirectory(src/musikcore)
add_subdirectory(src/core_c_demo)
add_subdirectory(src/musikcube)
add_subdirectory(src/musikcubed)
add_subdirectory(src/plugins/taglib_plugin)
add_subdirectory(src/plugins/nullout)
add_subdirectory(src/plugins/server)
add_subdirectory(src/plugins/httpdatastream)
add_subdirectory(src/plugins/stockencoders)
add_subdirectory(src/plugins/supereqdsp)
add_subdirectory(src/plugins/gmedecoder)
add_subdirectory(src/plugins/ffmpegdecoder)
add_dependencies(musikcube musikcore)
add_dependencies(musikcubed musikcore)
add_plugin(taglib_plugin)
add_plugin(nullout)
add_plugin(server)
add_plugin(httpdatastream)
add_plugin(stockencoders)
add_plugin(supereqdsp)
add_plugin(gmedecoder)
add_plugin(ffmpegdecoder)
include(AddOsSpecificPlugins)
include(InstallFiles)
include(GenerateDeb)