Improvements to makefiles

- Added cmake file to find D-Bus
- Removed remaining AddEngine stuff
- Fixed cross compiling for windows trying to use dbus after previous commit
- Compilation tested on Linux, FreeBSD, OpenBSD and cross compilation from linux for windows using mingw compiler
This commit is contained in:
Jonas Kvinge 2018-05-15 00:25:30 +02:00
parent 6b1ae5d5ac
commit eab25bbd17
6 changed files with 303 additions and 310 deletions

View File

@ -27,6 +27,7 @@ include(cmake/C++11Compat.cmake)
include(cmake/Version.cmake)
include(cmake/Summary.cmake)
include(cmake/OptionalSource.cmake)
include(cmake/ParseArguments.cmake)
include(cmake/Rpm.cmake)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
@ -78,8 +79,10 @@ find_package(Protobuf REQUIRED)
find_library(PROTOBUF_STATIC_LIBRARY libprotobuf.a libprotobuf)
if(LINUX)
find_package(ALSA REQUIRED)
find_package(DBus REQUIRED)
else(LINUX)
find_package(ALSA)
find_package(DBus)
endif(LINUX)
if(ALSA_FOUND)
set(HAVE_ALSA ON)
@ -87,8 +90,8 @@ endif()
find_package(X11)
pkg_check_modules(GSTREAMER gstreamer-1.0)
pkg_check_modules(GSTREAMER_BASE gstreamer-base-1.0)
pkg_check_modules(GSTREAMER_APP gstreamer-app-1.0)
pkg_check_modules(GSTREAMER_AUDIO gstreamer-audio-1.0)
pkg_check_modules(GSTREAMER_APP gstreamer-app-1.0)
pkg_check_modules(GSTREAMER_TAG gstreamer-tag-1.0)
pkg_check_modules(GSTREAMER_PBUTILS gstreamer-pbutils-1.0)
pkg_check_modules(LIBXINE libxine)
@ -116,6 +119,10 @@ find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core OpenGL Sql Network X
if(X11_FOUND)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras)
endif()
if(DBUS_FOUND)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus)
get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION)
endif()
if(NOT APPLE)
find_package(Qt5 COMPONENTS WebKitWidgets)
endif(NOT APPLE)
@ -125,6 +132,22 @@ if(APPLE)
endif(NOT QT_MAC_USE_COCOA)
endif(APPLE)
if(UNIX AND X11_FOUND AND DBUS_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml Qt5::X11Extras Qt5::DBus)
elseif(UNIX AND X11_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml Qt5::X11Extras)
else()
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql Qt5::OpenGL Qt5::Xml)
endif()
# Remove GLU and GL from the link line - they're not really required and don't exist on my mingw toolchain
list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL")
# Don't try to use webkit if their include directories couldn't be found.
if (NOT QT_QTWEBKIT_INCLUDE_DIR)
set (QT_USE_QTWEBKIT 0)
endif (NOT QT_QTWEBKIT_INCLUDE_DIR)
# TAGLIB
pkg_check_modules(TAGLIB taglib)
# Only use system taglib if it's greater than 1.11.1 because of audio file detection by content.
@ -160,135 +183,6 @@ endif()
# CHROMAPRINT
CHECK_INCLUDE_FILES(chromaprint.h CHROMAPRINT_H)
if (APPLE)
find_library(SPARKLE Sparkle)
add_subdirectory(3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
endif (APPLE)
# Set up definitions and paths
add_definitions(${QT_DEFINITIONS})
link_directories(${TAGLIB_LIBRARY_DIRS})
link_directories(${GSTREAMER_LIBRARY_DIRS})
# Don't try to use webkit if their include directories couldn't be found.
if (NOT QT_QTWEBKIT_INCLUDE_DIR)
set (QT_USE_QTWEBKIT 0)
endif (NOT QT_QTWEBKIT_INCLUDE_DIR)
include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${GLIBCONFIG_INCLUDE_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${LIBXML_INCLUDE_DIRS})
include_directories(${TAGLIB_INCLUDE_DIRS})
include_directories(${GSTREAMER_INCLUDE_DIRS})
include_directories(${GSTREAMER_APP_INCLUDE_DIRS})
include_directories(${GSTREAMER_AUDIO_INCLUDE_DIRS})
include_directories(${GSTREAMER_BASE_INCLUDE_DIRS})
include_directories(${GSTREAMER_TAG_INCLUDE_DIRS})
include_directories(${GSTREAMER_PBUTILS_INCLUDE_DIRS})
if (WIN32)
# RC compiler
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
enable_language(RC)
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I ${CMAKE_SOURCE_DIR}/dist/windows")
endif(WIN32)
add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS)
# Optional bits
if(WIN32)
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF)
endif(WIN32)
optional_component(GSTREAMER ON "Engine: GStreamer backend"
DEPENDS "gstreamer-1.0" GSTREAMER_FOUND
DEPENDS "gstreamer-base-1.0" GSTREAMER_BASE_FOUND
DEPENDS "gstreamer-app-1.0" GSTREAMER_APP_FOUND
DEPENDS "gstreamer-audio-1.0" GSTREAMER_AUDIO_FOUND
DEPENDS "gstreamer-tag-1.0" GSTREAMER_TAG_FOUND
DEPENDS "gstreamer-pbutils-1.0" GSTREAMER_PBUTILS_FOUND
)
optional_component(XINE OFF "Engine: Xine backend"
DEPENDS "libxine" LIBXINE_FOUND
)
optional_component(VLC OFF "Engine: VLC backend"
DEPENDS "libvlc" LIBVLC_FOUND
)
optional_component(PHONON OFF "Engine: Phonon backend"
DEPENDS "phonon4qt5" PHONON4QT5_FOUND
)
optional_component(AUDIOCD ON "Devices: Audio CD support"
DEPENDS "libcdio" CDIO_FOUND
)
optional_component(LIBGPOD ON "Devices: iPod classic support"
DEPENDS "libgpod" LIBGPOD_FOUND
)
optional_component(GIO ON "Devices: GIO device backend"
DEPENDS "libgio" GIO_FOUND
DEPENDS "Unix or Windows" "NOT APPLE"
)
optional_component(IMOBILEDEVICE ON "Devices: iPod Touch, iPhone, iPad support"
DEPENDS "libimobiledevice" IMOBILEDEVICE_FOUND
DEPENDS "libplist" PLIST_FOUND
DEPENDS "libusbmuxd" USBMUXD_FOUND
DEPENDS "iPod classic support" HAVE_LIBGPOD
)
optional_component(LIBMTP ON "Devices: MTP support"
DEPENDS "libmtp" LIBMTP_FOUND
)
optional_component(LIBLASTFM ON "Last.fm support"
DEPENDS "liblastfm" LASTFM5_LIBRARIES LASTFM5_INCLUDE_DIRS
)
optional_component(DBUS ON "D-Bus support"
DEPENDS "Unix" "NOT APPLE"
)
optional_component(DEVICEKIT ON "Devices: DeviceKit backend"
DEPENDS "D-Bus support" HAVE_DBUS
)
optional_component(UDISKS2 ON "Devices: UDisks2 backend"
DEPENDS "D-Bus support" HAVE_DBUS
)
optional_component(SPARKLE ON "Sparkle integration"
DEPENDS "Mac OS X" APPLE
DEPENDS "Sparkle" SPARKLE
)
optional_component(LIBPULSE ON "Pulse audio integration"
DEPENDS "libpulse" LIBPULSE_FOUND
)
if (HAVE_DBUS)
find_package(Qt5 COMPONENTS DBus)
get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION)
endif ()
# We can include the Qt definitions now
#include(${QT_USE_FILE})
if(WIN32)
set(QT_LIBRARIES Qt5::Core Qt5::OpenGL Qt5::Sql Qt5::Network Qt5::Xml Qt5::Widgets Qt5::Concurrent)
else(WIN32)
set(QT_LIBRARIES Qt5::Core Qt5::OpenGL Qt5::Sql Qt5::Network Qt5::Xml Qt5::Widgets Qt5::Concurrent Qt5::X11Extras Qt5::DBus)
endif(WIN32)
# Remove GLU and GL from the link line - they're not really required and don't exist on my mingw toolchain
list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL")
# Use system sha2 if it's available
find_path(SHA2_INCLUDE_DIRS sha2.h)
find_library(SHA2_LIBRARIES sha2)
@ -340,15 +234,121 @@ endif (USE_SYSTEM_QXT)
set(QOCOA_LIBRARIES Qocoa)
add_subdirectory(3rdparty/qocoa)
# Windows
if (WIN32)
add_subdirectory(3rdparty/qtwin)
endif (WIN32)
if (APPLE)
find_library(SPARKLE Sparkle)
add_subdirectory(3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
endif (APPLE)
if (WIN32)
# RC compiler
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
enable_language(RC)
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I ${CMAKE_SOURCE_DIR}/dist/windows")
endif(WIN32)
# Optional bits
if(WIN32)
option(ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF)
endif(WIN32)
optional_component(DBUS ON "D-Bus support"
DEPENDS "D-Bus" DBUS_FOUND
)
optional_component(GSTREAMER ON "Engine: GStreamer backend"
DEPENDS "gstreamer-1.0" GSTREAMER_FOUND
DEPENDS "gstreamer-base-1.0" GSTREAMER_BASE_FOUND
DEPENDS "gstreamer-app-1.0" GSTREAMER_APP_FOUND
DEPENDS "gstreamer-audio-1.0" GSTREAMER_AUDIO_FOUND
DEPENDS "gstreamer-tag-1.0" GSTREAMER_TAG_FOUND
DEPENDS "gstreamer-pbutils-1.0" GSTREAMER_PBUTILS_FOUND
)
optional_component(XINE OFF "Engine: Xine backend"
DEPENDS "libxine" LIBXINE_FOUND
)
optional_component(VLC OFF "Engine: VLC backend"
DEPENDS "libvlc" LIBVLC_FOUND
)
optional_component(PHONON OFF "Engine: Phonon backend"
DEPENDS "phonon4qt5" PHONON_FOUND
)
optional_component(AUDIOCD ON "Devices: Audio CD support"
DEPENDS "libcdio" CDIO_FOUND
)
optional_component(LIBGPOD ON "Devices: iPod classic support"
DEPENDS "libgpod" LIBGPOD_FOUND
)
optional_component(GIO ON "Devices: GIO device backend"
DEPENDS "libgio" GIO_FOUND
DEPENDS "Unix or Windows" "NOT APPLE"
)
optional_component(IMOBILEDEVICE ON "Devices: iPod Touch, iPhone, iPad support"
DEPENDS "libimobiledevice" IMOBILEDEVICE_FOUND
DEPENDS "libplist" PLIST_FOUND
DEPENDS "libusbmuxd" USBMUXD_FOUND
DEPENDS "iPod classic support" HAVE_LIBGPOD
)
optional_component(LIBMTP ON "Devices: MTP support"
DEPENDS "libmtp" LIBMTP_FOUND
)
optional_component(LIBLASTFM ON "Last.fm support"
DEPENDS "liblastfm" LASTFM5_LIBRARIES LASTFM5_INCLUDE_DIRS
)
optional_component(DEVICEKIT ON "Devices: DeviceKit backend"
DEPENDS "D-Bus support" DBUS_FOUND
)
optional_component(UDISKS2 ON "Devices: UDisks2 backend"
DEPENDS "D-Bus support" DBUS_FOUND
)
optional_component(LIBPULSE ON "Pulse audio integration"
DEPENDS "libpulse" LIBPULSE_FOUND
)
optional_component(SPARKLE ON "Sparkle integration"
DEPENDS "Mac OS X" APPLE
DEPENDS "Sparkle" SPARKLE
)
#if(IMOBILEDEVICE_FOUND AND PLIST_FOUND)
#add_subdirectory(ext/gstafc)
#endif(IMOBILEDEVICE_FOUND AND PLIST_FOUND)
# Set up definitions and paths
add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS)
include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${GLIBCONFIG_INCLUDE_DIRS})
if(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_VERSION VERSION_GREATER 1.1.1)
set(IMOBILEDEVICE_USES_UDIDS ON)
endif()
# Subdirectories
add_subdirectory(src)
if (WIN32)
add_subdirectory(3rdparty/qtwin)
endif (WIN32)
add_subdirectory(dist)
add_subdirectory(ext/libstrawberry-common)
add_subdirectory(ext/libstrawberry-tagreader)
@ -365,3 +365,6 @@ add_custom_target(uninstall
# Show a summary of what we have enabled
summary_show()
if(NOT HAVE_GSTREAMER AND NOT HAVE_XINE AND NOT HAVE_VLC AND NOT HAVE_PHONON)
message(FATAL_ERROR "You need to enable either GStreamer, Xine, VLC or Phonon to compile!")
endif()

View File

@ -2,6 +2,10 @@ Strawberry Music Player
=======================
ChangeLog
Version 0.1.4:
* Fixed compliation with clang compiler
* This release is mainly to get it working on openbsd and freebsd.
Version 0.1.3:
* Audio file detection by content
* Added builtin taglib to 3rdparty to support detecting audio by content instead of just file extension

View File

@ -1,88 +0,0 @@
# Strawberry Music Player
# Copyright 2013, Jonas Kvinge <jonas@strawbs.net>
#
# Strawberry is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Strawberry is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
macro(add_engine engine_lower engine_upper lib_list src_list inc_list enabled)
#message(STATUS "ADD ENGINE: ${engine_lower} ${engine_upper} ${lib_list} ${src_list} ${inc_list} ${enabled}")
#set(ENGINE_LIBRARIES "")
# recreate list
set(lib_list ${lib_list})
#list(GET lib_list 0 name)
# add a user selectable build option
option(ENGINE_${engine_upper}_ENABLED "enable engine ${engine_upper}" ${enabled})
# check if engine is enabled and needed librares are available
if(ENGINE_${engine_upper}_ENABLED)
# check for all needed libraries
foreach(lib ${lib_list})
#pkg_check_modules(${lib} ${lib})
if (NOT ${lib}_FOUND MATCHES 1)
set(ENGINE_${engine_upper}_LIB_MISSING TRUE)
endif(NOT ${lib}_FOUND MATCHES 1)
endforeach(lib ${lib_list})
if(ENGINE_${engine_upper}_LIB_MISSING)
set(ENGINES_MISSING "${ENGINES_MISSING} ${engine_lower}")
#set("HAVE_${engine_upper}" 0 CACHE INTERNAL ${engine_upper})
set("HAVE_${engine_upper}" OFF)
else(ENGINE_${engine_upper}_LIB_MISSING)
# add define -DHAVE_<engine> so we can clutter the code with #ifdefs
#set("HAVE_${engine_upper}" 1 CACHE INTERNAL ${engine_upper})
set("HAVE_${engine_upper}" ON)
# add sources and headers
list(APPEND SOURCES ${src_list})
list(APPEND HEADERS ${inc_list})
# add libraries to link against
foreach(lib ${lib_list})
#set(ENGINE_LIBRARIES ${ENGINE_LIBRARIES} ${${lib}_LIBRARIES} CACHE INTERNAL libraries)
set(ENGINE_LIBRARIES ${ENGINE_LIBRARIES} ${${lib}_LIBRARIES})
endforeach(lib ${lib_list})
# add to list of enabled engines
set(ENGINES_ENABLED "${ENGINES_ENABLED} ${engine_lower}")
endif(ENGINE_${engine_upper}_LIB_MISSING)
else(ENGINE_${engine_upper}_ENABLED)
set(ENGINES_DISABLED "${ENGINES_DISABLED} ${engine_lower}")
#set("HAVE_${engine_upper}" 0 CACHE INTERNAL ${engine_upper})
set("HAVE_${engine_upper}" OFF)
endif(ENGINE_${engine_upper}_ENABLED)
endmacro(add_engine engine_lower engine_upper lib_list src_list inc_list enabled)
# print engines to be built
macro(print_engines)
if(ENGINES_ENABLED)
message(STATUS "Building engines:${ENGINES_ENABLED}")
endif(ENGINES_ENABLED)
if(ENGINES_DISABLED)
message(STATUS "Disabled engines:${ENGINES_DISABLED}")
endif(ENGINES_DISABLED)
if(ENGINES_MISSING)
message(STATUS "Missing engines:${ENGINES_MISSING}")
endif(ENGINES_MISSING)
#message(STATUS "Engine libraries:${ENGINE_LIBRARIES}")
# need at least 1 engine
if(NOT ENGINES_ENABLED)
message(FATAL_ERROR "No engine enabled!")
endif(NOT ENGINES_ENABLED)
endmacro(print_engines)

43
cmake/FindDBus.cmake Normal file
View File

@ -0,0 +1,43 @@
if(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR)
# Already in cache, be silent
set(DBUS_FIND_QUIETLY TRUE)
endif(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR)
set(DBUS_LIBRARY)
set(DBUS_INCLUDE_DIR)
set(DBUS_ARCH_INCLUDE_DIR)
FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
/usr/include
/usr/include/dbus-1.0
/usr/local/include
/usr/local/include/dbus-1.0
)
FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
/usr/lib/include
/usr/lib/dbus-1.0/include
/usr/lib64/include
/usr/lib64/dbus-1.0/include
/usr/local/lib/include
/usr/local/lib/dbus-1.0/include
/usr/local/lib64/include
/usr/local/lib64/dbus-1.0/include
)
FIND_LIBRARY(DBUS_LIBRARY NAMES dbus-1 dbus
PATHS
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
)
if(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR)
MESSAGE(STATUS "D-Bus found: includes in ${DBUS_INCLUDE_DIR}, library in ${DBUS_LIBRARY}")
set(DBUS_FOUND TRUE)
else(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR)
MESSAGE(STATUS "D-Bus not found")
endif(DBUS_INCLUDE_DIR AND DBUS_LIBRARY AND DBUS_ARCH_INCLUDE_DIR)
MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_LIBRARY DBUS_ARCH_INCLUDE_DIR)

View File

@ -16,8 +16,8 @@
# You should have received a copy of the GNU General Public License
# along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Woverloaded-virtual -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-local-typedefs -fpermissive --std=c++11 -U__STRICT_ANSI__")
option(BUILD_WERROR "Build with -Werror" ON)
@ -28,31 +28,44 @@ if(BUILD_WERROR)
endif (LINUX)
endif(BUILD_WERROR)
# Set up definitions and paths
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
if(WIN32)
include_directories(../3rdparty/qtwin)
endif(WIN32)
add_definitions(${QT_DEFINITIONS})
add_definitions(-DQT_USE_QSTRINGBUILDER)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DBOOST_BIND_NO_PLACEHOLDERS)
if(ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_VERSION VERSION_GREATER 1.1.1)
set(IMOBILEDEVICE_USES_UDIDS ON)
endif()
include_directories(${CMAKE_BINARY_DIR})
include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${GLIBCONFIG_INCLUDE_DIRS})
include_directories(${GOBJECT_INCLUDE_DIRS})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${LIBXML_INCLUDE_DIRS})
include_directories(${CHROMAPRINT_INCLUDE_DIRS})
include_directories(${OPENGL_INCLUDE_DIR})
if(HAVE_GSTREAMER)
link_directories(${GSTREAMER_LIBRARY_DIRS})
include_directories(${GSTREAMER_INCLUDE_DIRS})
include_directories(${GSTREAMER_APP_INCLUDE_DIRS})
include_directories(${GSTREAMER_AUDIO_INCLUDE_DIRS})
include_directories(${GSTREAMER_BASE_INCLUDE_DIRS})
include_directories(${GSTREAMER_TAG_INCLUDE_DIRS})
include_directories(${GSTREAMER_PBUTILS_INCLUDE_DIRS})
endif()
if(HAVE_PHONON)
include_directories(${PHONON_INCLUDE_DIRS})
endif()
link_directories(${TAGLIB_LIBRARY_DIRS})
include_directories(${TAGLIB_INCLUDE_DIRS})
include_directories(${SHA2_INCLUDE_DIRS})
include_directories(${QTSINGLEAPPLICATION_INCLUDE_DIRS})
include_directories(${QXT_INCLUDE_DIRS})
include_directories(${CHROMAPRINT_INCLUDE_DIRS})
find_package(OpenGL)
include_directories(${OPENGL_INCLUDE_DIR})
if(HAVE_LIBLASTFM)
include_directories(${LASTFM5_INCLUDE_DIRS})
@ -62,8 +75,10 @@ include_directories(${CMAKE_SOURCE_DIR}/ext/libstrawberry-common)
include_directories(${CMAKE_SOURCE_DIR}/ext/libstrawberry-tagreader)
include_directories(${CMAKE_BINARY_DIR}/ext/libstrawberry-tagreader)
include(../cmake/AddEngine.cmake)
include(../cmake/ParseArguments.cmake)
# Windows
if (WIN32)
include_directories(../3rdparty/qtwin)
endif (WIN32)
set(SOURCES
core/mainwindow.cpp
@ -471,29 +486,38 @@ set(OTHER_SOURCES)
option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON)
# Engines
# ALSA
optional_source(HAVE_ALSA
SOURCES
engine/alsadevicefinder.cpp
)
set(GST_ENGINE_SRC engine/gstengine.cpp engine/gstenginepipeline.cpp engine/gstelementdeleter.cpp)
set(GST_ENGINE_MOC engine/gstengine.h engine/gstenginepipeline.h engine/gstelementdeleter.h)
set(GST_ENGINE_LIB GSTREAMER GSTREAMER_BASE GSTREAMER_APP GSTREAMER_AUDIO GSTREAMER_TAG GSTREAMER_PBUTILS)
#set(GST_ENGINE_LIB gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 streamer-audio-1.0 gstreamer-tag-1.0 gstreamer-pbutils-1.0)
#set(GST_ENGINE_LIB ${GSTREAMER_BASE_LIBRARIES} ${GSTREAMER_LIBRARIES} ${GSTREAMER_APP_LIBRARIES} ${GSTREAMER_TAG_LIBRARIES} ${GSTREAMER_PBUTILS_LIBRARIES})
# X11
optional_source(X11_FOUND SOURCES widgets/osd_x11.cpp)
set(XINE_ENGINE_SRC engine/xineengine.cpp engine/xinescope.c)
set(XINE_ENGINE_MOC engine/xineengine.h)
# GStreamer
optional_source(HAVE_GSTREAMER
SOURCES engine/gstengine.cpp engine/gstenginepipeline.cpp engine/gstelementdeleter.cpp
HEADERS engine/gstengine.h engine/gstenginepipeline.h engine/gstelementdeleter.h
)
set(VLC_ENGINE_SRC engine/vlcengine.cpp)
set(VLC_ENGINE_MOC engine/vlcengine.h)
# Xine
optional_source(HAVE_XINE
SOURCES engine/xineengine.cpp engine/xinescope.c
HEADERS engine/xineengine.h
)
set(PHONON_ENGINE_SRC engine/phononengine.cpp)
set(PHONON_ENGINE_MOC engine/phononengine.h)
# VLC
optional_source(HAVE_VLC
SOURCES engine/vlcengine.cpp
HEADERS engine/vlcengine.h
)
add_engine(gstreamer GSTREAMER "${GST_ENGINE_LIB}" "${GST_ENGINE_SRC}" "${GST_ENGINE_MOC}" ON)
add_engine(xine XINE LIBXINE "${XINE_ENGINE_SRC}" "${XINE_ENGINE_MOC}" OFF)
add_engine(vlc VLC LIBVLC "${VLC_ENGINE_SRC}" "${VLC_ENGINE_MOC}" OFF)
add_engine(phonon PHONON PHONON "${PHONON_ENGINE_SRC}" "${PHONON_ENGINE_MOC}" OFF)
print_engines()
# Phonon
optional_source(HAVE_PHONON
SOURCES engine/phononengine.cpp
HEADERS engine/phononengine.h
)
# Lastfm
optional_source(HAVE_LIBLASTFM
@ -504,59 +528,8 @@ optional_source(HAVE_LIBLASTFM
covermanager/lastfmcoverprovider.h
)
# Platform specific - Linux
optional_source(HAVE_ALSA
SOURCES
engine/alsadevicefinder.cpp
)
# Platform specific - OS X
optional_source(APPLE
SOURCES
core/mac_startup.mm
core/macsystemtrayicon.mm
core/macscreensaver.cpp
core/macfslistener.mm
core/scoped_nsautorelease_pool.mm
widgets/osd_mac.mm
engine/osxdevicefinder.cpp
device/macdevicelister.mm
globalshortcuts/shortcutgrabber.mm
globalshortcuts/macglobalshortcutbackend.mm
globalshortcuts/globalshortcutgrabber.mm
HEADERS
core/mac_startup.h
core/macsystemtrayicon.h
core/macscreensaver.h
core/macfslistener.h
core/mac_utilities.h
core/mac_delegate.h
engine/osxdevicefinder.h
device/macdevicelister.h
globalshortcuts/macglobalshortcutbackend.h
)
if (APPLE)
optional_source(HAVE_LIBMTP
SOURCES
device/macdevicelister.mm
HEADERS
device/macdevicelister.h
)
endif()
# Platform specific - Windows
optional_source(WIN32
SOURCES
engine/directsounddevicefinder.cpp
widgets/osd_win.cpp
)
# Platform specific - X11
optional_source(UNIX SOURCES widgets/osd_x11.cpp)
# DBUS and MPRIS - Unix specific
if(HAVE_DBUS)
if(UNIX AND HAVE_DBUS)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
# MPRIS DBUS interfaces
@ -666,7 +639,7 @@ if(HAVE_DBUS)
dbus/udisks2job)
endif(HAVE_UDISKS2)
endif(HAVE_DBUS)
endif(UNIX AND HAVE_DBUS)
optional_source(HAVE_DBUS
SOURCES
@ -745,6 +718,7 @@ optional_source(HAVE_LIBPULSE
engine/pulsedevicefinder.cpp
)
# MusicBrainz, Organise and transcode require GStreamer
optional_source(HAVE_GSTREAMER
SOURCES
core/organise.cpp
@ -803,7 +777,49 @@ optional_source(HAVE_AUDIOCD
device/cddasongloader.h
UI
)
endif(HAVE_GSTREAMER)
endif()
# Platform specific - macOS
optional_source(APPLE
SOURCES
core/mac_startup.mm
core/macsystemtrayicon.mm
core/macscreensaver.cpp
core/macfslistener.mm
core/scoped_nsautorelease_pool.mm
widgets/osd_mac.mm
engine/osxdevicefinder.cpp
device/macdevicelister.mm
globalshortcuts/shortcutgrabber.mm
globalshortcuts/macglobalshortcutbackend.mm
globalshortcuts/globalshortcutgrabber.mm
HEADERS
core/mac_startup.h
core/macsystemtrayicon.h
core/macscreensaver.h
core/macfslistener.h
core/mac_utilities.h
core/mac_delegate.h
engine/osxdevicefinder.h
device/macdevicelister.h
globalshortcuts/macglobalshortcutbackend.h
)
if (APPLE)
optional_source(HAVE_LIBMTP
SOURCES
device/macdevicelister.mm
HEADERS
device/macdevicelister.h
)
endif()
# Platform specific - Windows
optional_source(WIN32
SOURCES
engine/directsounddevicefinder.cpp
widgets/osd_win.cpp
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
@ -834,7 +850,6 @@ target_link_libraries(strawberry_lib
${TAGLIB_LIBRARIES}
${GOBJECT_LIBRARIES}
${QT_LIBRARIES}
${ENGINE_LIBRARIES}
${CHROMAPRINT_LIBRARIES}
${QTSINGLEAPPLICATION_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
@ -847,6 +862,22 @@ if(HAVE_ALSA)
target_link_libraries(strawberry_lib ${ALSA_LIBRARIES})
endif(HAVE_ALSA)
if(HAVE_GSTREAMER)
target_link_libraries(strawberry_lib ${GSTREAMER_LIBRARIES} ${GSTREAMER_BASE_LIBRARIES} ${GSTREAMER_AUDIO_LIBRARIES} ${GSTREAMER_APP_LIBRARIES} ${GSTREAMER_TAG_LIBRARIES} ${GSTREAMER_PBUTILS_LIBRARIES})
endif()
if(HAVE_XINE)
target_link_libraries(strawberry_lib ${LIBXINE_LIBRARIES})
endif()
if(HAVE_VLC)
target_link_libraries(strawberry_lib ${LIBVLC_LIBRARIES})
endif()
if(HAVE_PHONON)
target_link_libraries(strawberry_lib ${PHONON_LIBRARIES})
endif()
if(HAVE_LIBLASTFM)
target_link_libraries(strawberry_lib ${LASTFM5_LIBRARIES})
endif(HAVE_LIBLASTFM)

View File

@ -23,7 +23,7 @@
#include "phononengine.h"
#include "core/logging.h"
#include "taskmanager.h"
#include "core/taskmanager.h"
PhononEngine::PhononEngine(TaskManager *task_manager)
: media_object_(new Phonon::MediaObject(this)),