mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Improve the way we scan for and add plugin, and also add the ability to
log colors.
This commit is contained in:
parent
090c5f288d
commit
120b6fec0b
@ -1,33 +0,0 @@
|
|||||||
# libopenmpt detection
|
|
||||||
find_library(LIBOPENMPT NAMES openmpt)
|
|
||||||
if (NOT "${LIBOPENMPT}" STREQUAL "LIBOPENMPT-NOTFOUND")
|
|
||||||
add_plugin("src/plugins/libopenmptdecoder" "openmptdecoder")
|
|
||||||
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_SNDIO} MATCHES "true")
|
|
||||||
add_plugin("src/plugins/sndioout" "sndioout")
|
|
||||||
endif()
|
|
||||||
elseif (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
|
||||||
add_subdirectory(src/plugins/sndioout)
|
|
||||||
if (${ENABLE_PULSEAUDIO} MATCHES "true")
|
|
||||||
add_plugin("src/plugins/pulseout" "pulseout")
|
|
||||||
endif()
|
|
||||||
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
|
||||||
add_subdirectory(src/plugins/sndioout)
|
|
||||||
if (${ENABLE_PULSEAUDIO} MATCHES "true")
|
|
||||||
add_plugin("src/plugins/pulseout" "pulseout")
|
|
||||||
endif()
|
|
||||||
if (${ENABLE_ALSA} MATCHES "true")
|
|
||||||
add_plugin("src/plugins/alsaout" "alsaout")
|
|
||||||
endif()
|
|
||||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
|
||||||
add_plugin("src/plugins/coreaudioout" "coreaudioout")
|
|
||||||
add_plugin("src/plugins/macosmediakeys" "macosmediakeys")
|
|
||||||
endif()
|
|
@ -1,12 +1,18 @@
|
|||||||
macro(add_plugin plugin_dir plugin_name)
|
macro(add_plugin plugin_dir plugin_name)
|
||||||
message(STATUS "[add-plugin] adding '${plugin_name}' at path '${plugin_dir}")
|
|
||||||
add_subdirectory(${plugin_dir})
|
add_subdirectory(${plugin_dir})
|
||||||
get_property(PLUGIN_DISABLED GLOBAL PROPERTY "DISABLE_${plugin_name}")
|
get_property(PLUGIN_DISABLED GLOBAL PROPERTY "DISABLE_${plugin_name}")
|
||||||
if (NOT PLUGIN_DISABLED STREQUAL "true")
|
if (NOT PLUGIN_DISABLED STREQUAL "true")
|
||||||
|
message(STATUS "[add-plugin] ${BoldGreen}added ${plugin_name}${ColorReset}")
|
||||||
add_dependencies(musikcube ${plugin_name})
|
add_dependencies(musikcube ${plugin_name})
|
||||||
add_dependencies(musikcubed ${plugin_name})
|
add_dependencies(musikcubed ${plugin_name})
|
||||||
add_dependencies(core_c_demo ${plugin_name})
|
add_dependencies(core_c_demo ${plugin_name})
|
||||||
else()
|
else()
|
||||||
message(STATUS "[add-plugin] *** WARNING! *** ${plugin_name} not found.")
|
message(STATUS "[add-plugin] ${BoldRed}skipped ${plugin_name}${ColorReset}")
|
||||||
endif()
|
endif()
|
||||||
endmacro(add_plugin)
|
endmacro(add_plugin)
|
||||||
|
|
||||||
|
macro(disable_plugin plugin_name)
|
||||||
|
set(PROPERTY_NAME "DISABLE_${plugin_name}")
|
||||||
|
set_property(GLOBAL PROPERTY ${PROPERTY_NAME} "true")
|
||||||
|
get_property(PLUGIN_DISABLED GLOBAL PROPERTY "DISABLE_${plugin_name}")
|
||||||
|
endmacro(disable_plugin)
|
||||||
|
20
.cmake/Colors.cmake
Normal file
20
.cmake/Colors.cmake
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# https://stackoverflow.com/a/19578320
|
||||||
|
if (NOT WIN32)
|
||||||
|
string(ASCII 27 Esc)
|
||||||
|
set(ColorReset "${Esc}[m")
|
||||||
|
set(ColorBold "${Esc}[1m")
|
||||||
|
set(Red "${Esc}[31m")
|
||||||
|
set(Green "${Esc}[32m")
|
||||||
|
set(Yellow "${Esc}[33m")
|
||||||
|
set(Blue "${Esc}[34m")
|
||||||
|
set(Magenta "${Esc}[35m")
|
||||||
|
set(Cyan "${Esc}[36m")
|
||||||
|
set(White "${Esc}[37m")
|
||||||
|
set(BoldRed "${Esc}[1;31m")
|
||||||
|
set(BoldGreen "${Esc}[1;32m")
|
||||||
|
set(BoldYellow "${Esc}[1;33m")
|
||||||
|
set(BoldBlue "${Esc}[1;34m")
|
||||||
|
set(BoldMagenta "${Esc}[1;35m")
|
||||||
|
set(BoldCyan "${Esc}[1;36m")
|
||||||
|
set(BoldWhite "${Esc}[1;37m")
|
||||||
|
endif()
|
@ -14,6 +14,7 @@ set (LIBRARY_OUTPUT_PATH ${musikcube_SOURCE_DIR}/bin/plugins)
|
|||||||
set (EXECUTABLE_OUTPUT_PATH ${musikcube_SOURCE_DIR}/bin)
|
set (EXECUTABLE_OUTPUT_PATH ${musikcube_SOURCE_DIR}/bin)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/.cmake)
|
||||||
|
include(Colors)
|
||||||
include(CMakeToolsHelpers OPTIONAL)
|
include(CMakeToolsHelpers OPTIONAL)
|
||||||
include(CheckAtomic)
|
include(CheckAtomic)
|
||||||
include(AddPlugin)
|
include(AddPlugin)
|
||||||
@ -85,16 +86,30 @@ add_subdirectory(src/musikcubed)
|
|||||||
add_dependencies(musikcube musikcore)
|
add_dependencies(musikcube musikcore)
|
||||||
add_dependencies(musikcubed musikcore)
|
add_dependencies(musikcubed musikcore)
|
||||||
|
|
||||||
|
# tag readers
|
||||||
add_plugin("src/plugins/taglib_plugin" "taglibreader")
|
add_plugin("src/plugins/taglib_plugin" "taglibreader")
|
||||||
|
# outputs
|
||||||
add_plugin("src/plugins/nullout" "nullout")
|
add_plugin("src/plugins/nullout" "nullout")
|
||||||
|
add_plugin("src/plugins/alsaout" "alsaout")
|
||||||
|
add_plugin("src/plugins/pulseout" "pulseout")
|
||||||
|
add_plugin("src/plugins/pipewireout" "pipewireout")
|
||||||
|
add_plugin("src/plugins/sndioout" "sndioout")
|
||||||
|
add_plugin("src/plugins/coreaudioout" "coreaudioout")
|
||||||
|
# remotes
|
||||||
add_plugin("src/plugins/server" "server")
|
add_plugin("src/plugins/server" "server")
|
||||||
|
add_plugin("src/plugins/mpris" "mpris")
|
||||||
|
add_plugin("src/plugins/macosmediakeys" "macosmediakeys")
|
||||||
|
# streams
|
||||||
add_plugin("src/plugins/httpdatastream" "httpdatastream")
|
add_plugin("src/plugins/httpdatastream" "httpdatastream")
|
||||||
add_plugin("src/plugins/stockencoders" "stockencoders")
|
# decoders
|
||||||
add_plugin("src/plugins/supereqdsp" "supereqdsp")
|
|
||||||
add_plugin("src/plugins/gmedecoder" "gmedecoder")
|
|
||||||
add_plugin("src/plugins/ffmpegdecoder" "ffmpegdecoder")
|
add_plugin("src/plugins/ffmpegdecoder" "ffmpegdecoder")
|
||||||
|
add_plugin("src/plugins/libopenmptdecoder" "openmptdecoder")
|
||||||
|
add_plugin("src/plugins/gmedecoder" "gmedecoder")
|
||||||
|
# encoders
|
||||||
|
add_plugin("src/plugins/stockencoders" "stockencoders")
|
||||||
|
# dsps
|
||||||
|
add_plugin("src/plugins/supereqdsp" "supereqdsp")
|
||||||
|
|
||||||
include(AddOsSpecificPlugins)
|
|
||||||
include(InstallFiles)
|
include(InstallFiles)
|
||||||
include(GeneratePackage)
|
include(GeneratePackage)
|
||||||
include(PostBuild)
|
include(PostBuild)
|
||||||
|
@ -3,8 +3,11 @@ set (alsaout_SOURCES
|
|||||||
AlsaOut.cpp
|
AlsaOut.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(alsaout SHARED ${alsaout_SOURCES})
|
|
||||||
|
|
||||||
find_library(LIBASOUND asound)
|
find_library(LIBASOUND asound)
|
||||||
target_link_libraries(alsaout ${LIBASOUND})
|
|
||||||
|
|
||||||
|
if ("${LIBASOUND}" STREQUAL "LIBASOUND-NOTFOUND")
|
||||||
|
disable_plugin(alsaout)
|
||||||
|
else()
|
||||||
|
add_library(alsaout SHARED ${alsaout_SOURCES})
|
||||||
|
target_link_libraries(alsaout ${LIBASOUND})
|
||||||
|
endif()
|
||||||
|
@ -14,4 +14,6 @@ if (APPLE)
|
|||||||
|
|
||||||
add_library(coreaudioout SHARED ${coreaudioout_SOURCES})
|
add_library(coreaudioout SHARED ${coreaudioout_SOURCES})
|
||||||
target_link_libraries(coreaudioout ${FRAMEWORK_LIBS})
|
target_link_libraries(coreaudioout ${FRAMEWORK_LIBS})
|
||||||
endif (APPLE)
|
else()
|
||||||
|
disable_plugin(coreaudioout)
|
||||||
|
endif()
|
||||||
|
@ -9,13 +9,17 @@ add_library(openmptdecoder SHARED ${openmptdecoder_SOURCES})
|
|||||||
|
|
||||||
if (${BUILD_STANDALONE} MATCHES "true")
|
if (${BUILD_STANDALONE} MATCHES "true")
|
||||||
target_include_directories(openmptdecoder BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES})
|
target_include_directories(openmptdecoder BEFORE PRIVATE ${VENDOR_INCLUDE_DIRECTORIES})
|
||||||
find_vendor_library(OPENMPTLIB openmpt)
|
find_vendor_library(LIBOPENMPT openmpt)
|
||||||
target_link_libraries(openmptdecoder ${OPENMPTLIB})
|
target_link_libraries(openmptdecoder ${LIBOPENMPT})
|
||||||
else()
|
else()
|
||||||
find_library(OPENMPTLIB NAMES openmpt)
|
find_library(LIBOPENMPT NAMES openmpt)
|
||||||
find_library(MPG123LIB NAMES mpg123)
|
find_library(LIBMPG123 NAMES mpg123)
|
||||||
find_library(ZLIB NAMES z)
|
find_library(LIBZ NAMES z)
|
||||||
target_link_libraries(openmptdecoder ${OPENMPTLIB} ${MPG123LIB} ${ZLIB})
|
if ("${LIBOPENMPT}" STREQUAL "LIBOPENMPT-NOTFOUND")
|
||||||
|
disable_plugin(openmptdecoder)
|
||||||
|
else()
|
||||||
|
target_link_libraries(openmptdecoder ${LIBOPENMPT} ${LIBMPG123} ${LIBZ})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,9 +4,12 @@ set (macosmediakeys_SOURCES
|
|||||||
SPMediaKeyTap.m
|
SPMediaKeyTap.m
|
||||||
)
|
)
|
||||||
|
|
||||||
FIND_LIBRARY(APP_KIT_LIBRARY AppKit)
|
if (APPLE)
|
||||||
FIND_LIBRARY(CARBON_LIBRARY Carbon)
|
FIND_LIBRARY(APP_KIT_LIBRARY AppKit)
|
||||||
MARK_AS_ADVANCED (APP_KIT_LIBRARY CARBON_LIBRARY)
|
FIND_LIBRARY(CARBON_LIBRARY Carbon)
|
||||||
|
MARK_AS_ADVANCED (APP_KIT_LIBRARY CARBON_LIBRARY)
|
||||||
add_library(macosmediakeys SHARED ${macosmediakeys_SOURCES})
|
add_library(macosmediakeys SHARED ${macosmediakeys_SOURCES})
|
||||||
target_link_libraries(macosmediakeys ${APP_KIT_LIBRARY} ${CARBON_LIBRARY})
|
target_link_libraries(macosmediakeys ${APP_KIT_LIBRARY} ${CARBON_LIBRARY})
|
||||||
|
else()
|
||||||
|
disable_plugin(macosmediakeys)
|
||||||
|
endif()
|
@ -13,11 +13,10 @@ endif()
|
|||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(SDBUS IMPORTED_TARGET ${SDBUS})
|
pkg_check_modules(SDBUS IMPORTED_TARGET ${SDBUS})
|
||||||
|
|
||||||
if (SDBUS_LINK_LIBRARIES STREQUAL "")
|
if (NOT DEFINED SDBUS_LINK_LIBRARIES)
|
||||||
|
disable_plugin(mpris)
|
||||||
|
else()
|
||||||
message(STATUS "[mpris] plugin enabled. using " ${SDBUS_LINK_LIBRARIES})
|
message(STATUS "[mpris] plugin enabled. using " ${SDBUS_LINK_LIBRARIES})
|
||||||
add_library(mpris SHARED ${mpris_SOURCES})
|
add_library(mpris SHARED ${mpris_SOURCES})
|
||||||
target_link_libraries(mpris PkgConfig::SDBUS)
|
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()
|
endif()
|
||||||
|
@ -3,10 +3,12 @@ set (pipewireout_SOURCES
|
|||||||
PipeWireOut.cpp
|
PipeWireOut.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
message(STATUS "[pipewireout] plugin enabled")
|
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(PIPEWIRE REQUIRED IMPORTED_TARGET libpipewire-0.3)
|
pkg_check_modules(PIPEWIRE IMPORTED_TARGET libpipewire-0.3)
|
||||||
|
|
||||||
add_library(pipewireout SHARED ${pipewireout_SOURCES})
|
if (NOT DEFINED PIPEWIRE_LINK_LIBRARIES)
|
||||||
target_link_libraries(pipewireout PkgConfig::PIPEWIRE)
|
disable_plugin(pipewireout)
|
||||||
|
else()
|
||||||
|
add_library(pipewireout SHARED ${pipewireout_SOURCES})
|
||||||
|
target_link_libraries(pipewireout PkgConfig::PIPEWIRE)
|
||||||
|
endif()
|
||||||
|
@ -4,7 +4,11 @@ set (pulseout_SOURCES
|
|||||||
PulseOut.cpp
|
PulseOut.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(pulseout SHARED ${pulseout_SOURCES})
|
|
||||||
|
|
||||||
find_library(LIBPULSE pulse)
|
find_library(LIBPULSE pulse)
|
||||||
target_link_libraries(pulseout ${LIBPULSE})
|
|
||||||
|
if ("${LIBPULSE}" STREQUAL "LIBPULSE-NOTFOUND")
|
||||||
|
disable_plugin(pulseout)
|
||||||
|
else()
|
||||||
|
add_library(pulseout SHARED ${pulseout_SOURCES})
|
||||||
|
target_link_libraries(pulseout ${LIBPULSE})
|
||||||
|
endif()
|
||||||
|
@ -3,7 +3,11 @@ set (sndioout_SOURCES
|
|||||||
SndioOut.cpp
|
SndioOut.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(sndioout SHARED ${sndioout_SOURCES})
|
|
||||||
|
|
||||||
find_library(LIBSNDIO sndio)
|
find_library(LIBSNDIO sndio)
|
||||||
target_link_libraries(sndioout ${LIBSNDIO})
|
|
||||||
|
if ("${LIBSNDIO}" STREQUAL "LIBSNDIO-NOTFOUND")
|
||||||
|
disable_plugin(sndioout)
|
||||||
|
else()
|
||||||
|
add_library(sndioout SHARED ${sndioout_SOURCES})
|
||||||
|
target_link_libraries(sndioout ${LIBSNDIO})
|
||||||
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user