mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
Add FindPhonon.cmake from kde, and uses phonon/ includes as that's the "proper" include path for both qt- and kde-phonon
This commit is contained in:
@@ -38,6 +38,13 @@ INCLUDE( MacroLogFeature )
|
|||||||
#macro_log_feature(LIBLASTFM_FOUND "LastFm" "Qt library for the Last.fm webservices" "https://github.com/mxcl/liblastfm" FALSE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork")
|
#macro_log_feature(LIBLASTFM_FOUND "LastFm" "Qt library for the Last.fm webservices" "https://github.com/mxcl/liblastfm" FALSE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork")
|
||||||
set(LIBLASTFM_FOUND true)
|
set(LIBLASTFM_FOUND true)
|
||||||
|
|
||||||
|
find_package(Phonon REQUIRED)
|
||||||
|
if(PHONON_FOUND)
|
||||||
|
message("Phonon found, all is good!" )
|
||||||
|
else()
|
||||||
|
message(STATUS "Phonon not found, but required!")
|
||||||
|
endif()
|
||||||
|
|
||||||
macro_optional_find_package(LibEchonest 1.1.1)
|
macro_optional_find_package(LibEchonest 1.1.1)
|
||||||
macro_log_feature(LIBECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest is needed for dynamic playlists and the infosystem")
|
macro_log_feature(LIBECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest is needed for dynamic playlists and the infosystem")
|
||||||
|
|
||||||
|
71
CMakeModules/FindPhonon.cmake
Normal file
71
CMakeModules/FindPhonon.cmake
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# Find libphonon
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# PHONON_FOUND - system has Phonon Library
|
||||||
|
# PHONON_INCLUDES - the Phonon include directory
|
||||||
|
# PHONON_LIBS - link these to use Phonon
|
||||||
|
# PHONON_VERSION - the version of the Phonon Library
|
||||||
|
|
||||||
|
# Copyright (c) 2008, Matthias Kretz <kretz@kde.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
macro(_phonon_find_version)
|
||||||
|
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h")
|
||||||
|
if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
|
||||||
|
set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
|
||||||
|
endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
|
||||||
|
file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000)
|
||||||
|
string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}")
|
||||||
|
set(PHONON_VERSION "${CMAKE_MATCH_1}")
|
||||||
|
message(STATUS "Phonon Version: ${PHONON_VERSION}")
|
||||||
|
endmacro(_phonon_find_version)
|
||||||
|
|
||||||
|
if(PHONON_FOUND)
|
||||||
|
# Already found, nothing more to do except figuring out the version
|
||||||
|
_phonon_find_version()
|
||||||
|
else(PHONON_FOUND)
|
||||||
|
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||||
|
set(PHONON_FIND_QUIETLY TRUE)
|
||||||
|
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||||
|
|
||||||
|
# As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir)
|
||||||
|
find_library(PHONON_LIBRARY NAMES phonon phonon4 PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
|
||||||
|
# then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.)
|
||||||
|
find_library(PHONON_LIBRARY NAMES phonon phonon4)
|
||||||
|
|
||||||
|
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
|
||||||
|
find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h)
|
||||||
|
|
||||||
|
if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||||
|
set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
|
||||||
|
set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
|
||||||
|
set(PHONON_FOUND TRUE)
|
||||||
|
_phonon_find_version()
|
||||||
|
else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||||
|
set(PHONON_FOUND FALSE)
|
||||||
|
endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
|
||||||
|
|
||||||
|
if(PHONON_FOUND)
|
||||||
|
if(NOT PHONON_FIND_QUIETLY)
|
||||||
|
message(STATUS "Found Phonon: ${PHONON_LIBRARY}")
|
||||||
|
message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}")
|
||||||
|
endif(NOT PHONON_FIND_QUIETLY)
|
||||||
|
else(PHONON_FOUND)
|
||||||
|
if(Phonon_FIND_REQUIRED)
|
||||||
|
if(NOT PHONON_INCLUDE_DIR)
|
||||||
|
message(STATUS "Phonon includes NOT found!")
|
||||||
|
endif(NOT PHONON_INCLUDE_DIR)
|
||||||
|
if(NOT PHONON_LIBRARY)
|
||||||
|
message(STATUS "Phonon library NOT found!")
|
||||||
|
endif(NOT PHONON_LIBRARY)
|
||||||
|
message(FATAL_ERROR "Phonon library or includes NOT found!")
|
||||||
|
else(Phonon_FIND_REQUIRED)
|
||||||
|
message(STATUS "Unable to find Phonon")
|
||||||
|
endif(Phonon_FIND_REQUIRED)
|
||||||
|
endif(PHONON_FOUND)
|
||||||
|
|
||||||
|
|
||||||
|
mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES)
|
||||||
|
endif(PHONON_FOUND)
|
@@ -7,7 +7,6 @@ ENDIF()
|
|||||||
SET( QT_USE_QTSQL TRUE )
|
SET( QT_USE_QTSQL TRUE )
|
||||||
SET( QT_USE_QTNETWORK TRUE )
|
SET( QT_USE_QTNETWORK TRUE )
|
||||||
SET( QT_USE_QTXML TRUE )
|
SET( QT_USE_QTXML TRUE )
|
||||||
SET( QT_USE_PHONON TRUE )
|
|
||||||
SET( QT_USE_QTWEBKIT TRUE )
|
SET( QT_USE_QTWEBKIT TRUE )
|
||||||
|
|
||||||
INCLUDE( ${QT_USE_FILE} )
|
INCLUDE( ${QT_USE_FILE} )
|
||||||
@@ -135,6 +134,7 @@ INCLUDE_DIRECTORIES(
|
|||||||
${THIRDPARTY_DIR}/qtweetlib/tomahawk-custom
|
${THIRDPARTY_DIR}/qtweetlib/tomahawk-custom
|
||||||
|
|
||||||
${TAGLIB_INCLUDES}
|
${TAGLIB_INCLUDES}
|
||||||
|
${PHONON_INCLUDES}
|
||||||
${QJSON_INCLUDE_DIR}
|
${QJSON_INCLUDE_DIR}
|
||||||
${LIBECHONEST_INCLUDE_DIR}
|
${LIBECHONEST_INCLUDE_DIR}
|
||||||
${LIBECHONEST_INCLUDE_DIR}/..
|
${LIBECHONEST_INCLUDE_DIR}/..
|
||||||
@@ -209,6 +209,7 @@ ENDIF(GLOOX_FOUND)
|
|||||||
TARGET_LINK_LIBRARIES( tomahawk
|
TARGET_LINK_LIBRARIES( tomahawk
|
||||||
${LINK_LIBRARIES}
|
${LINK_LIBRARIES}
|
||||||
${TOMAHAWK_LIBRARIES}
|
${TOMAHAWK_LIBRARIES}
|
||||||
|
${PHONON_LIBS}
|
||||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${MAC_EXTRA_LIBS}
|
${MAC_EXTRA_LIBS}
|
||||||
|
@@ -4,7 +4,6 @@ SET( QT_USE_QTGUI TRUE )
|
|||||||
SET( QT_USE_QTSQL TRUE )
|
SET( QT_USE_QTSQL TRUE )
|
||||||
SET( QT_USE_QTNETWORK TRUE )
|
SET( QT_USE_QTNETWORK TRUE )
|
||||||
SET( QT_USE_QTXML TRUE )
|
SET( QT_USE_QTXML TRUE )
|
||||||
SET( QT_USE_PHONON TRUE )
|
|
||||||
SET( QT_USE_QTUITOOLS TRUE )
|
SET( QT_USE_QTUITOOLS TRUE )
|
||||||
|
|
||||||
include( ${QT_USE_FILE} )
|
include( ${QT_USE_FILE} )
|
||||||
@@ -338,6 +337,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/.
|
|||||||
${LIBECHONEST_INCLUDE_DIR}/..
|
${LIBECHONEST_INCLUDE_DIR}/..
|
||||||
${CLUCENE_INCLUDE_DIR}
|
${CLUCENE_INCLUDE_DIR}
|
||||||
${CLUCENE_LIBRARY_DIR}
|
${CLUCENE_LIBRARY_DIR}
|
||||||
|
${PHONON_INCLUDES}
|
||||||
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
|
${CMAKE_BINARY_DIR}/thirdparty/liblastfm2/src
|
||||||
|
|
||||||
../../include
|
../../include
|
||||||
@@ -411,6 +411,7 @@ target_link_libraries( tomahawklib
|
|||||||
portfwd
|
portfwd
|
||||||
|
|
||||||
# External deps
|
# External deps
|
||||||
|
${PHONON_LIBS}
|
||||||
${TAGLIB_LIBRARIES}
|
${TAGLIB_LIBRARIES}
|
||||||
${CLUCENE_LIBRARIES}
|
${CLUCENE_LIBRARIES}
|
||||||
${LIBECHONEST_LIBRARY}
|
${LIBECHONEST_LIBRARY}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
#include <MediaObject>
|
#include <phonon/MediaObject>
|
||||||
#include <AudioOutput>
|
#include <phonon/AudioOutput>
|
||||||
|
|
||||||
#include "result.h"
|
#include "result.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
unsigned int volume() const { return m_audioOutput->volume() * 100.0; } // in percent
|
unsigned int volume() const { return m_audioOutput->volume() * 100.0; } // in percent
|
||||||
bool isPlaying() const { return m_mediaObject->state() == Phonon::PlayingState; }
|
bool isPlaying() const { return m_mediaObject->state() == Phonon::PlayingState; }
|
||||||
bool isPaused() const { return m_mediaObject->state() == Phonon::PausedState; }
|
bool isPaused() const { return m_mediaObject->state() == Phonon::PausedState; }
|
||||||
|
|
||||||
/* Returns the PlaylistInterface of the currently playing track. Note: This might be different to the current playlist! */
|
/* Returns the PlaylistInterface of the currently playing track. Note: This might be different to the current playlist! */
|
||||||
PlaylistInterface* currentTrackPlaylist() const { return m_currentTrackPlaylist; }
|
PlaylistInterface* currentTrackPlaylist() const { return m_currentTrackPlaylist; }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user