CMake support \o/

Also fixes xine deprecation messages.
This commit is contained in:
John Maguire 2010-02-28 17:28:56 +00:00
parent 2c04b4a23a
commit f9ad923f3a
6 changed files with 283 additions and 4 deletions

View File

@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 2.6)
set(SINGLEAPP-SOURCES
qtlocalpeer.cpp
qtlockedfile.cpp
qtsingleapplication.cpp
qtsinglecoreapplication.cpp
)
set(SINGLEAPP-MOC-HEADERS
qtlocalpeer.h
qtsingleapplication.h
qtsinglecoreapplication.h
)
if(WIN32)
set(SINGLEAPP-SOURCES ${SINGLEAPP-SOURCES} qtlockedfile_win.cpp)
elseif(WIN32)
set(SINGLEAPP-SOURCES ${SINGLEAPP-SOURCES} qtlockedfile_unix.cpp)
endif(WIN32)
QT4_WRAP_CPP(SINGLEAPP-SOURCES-MOC ${SINGLEAPP-MOC-HEADERS})
ADD_LIBRARY(qtsingleapplication
${SINGLEAPP-SOURCES}
${SINGLEAPP-SOURCES-MOC}
)

25
3rdparty/qxt/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 2.6)
set(QXT-SOURCES
qxtglobal.cpp
qxtglobalshortcut.cpp
)
set(QXT-MOC-HEADERS
qxtglobalshortcut.h
)
if(WIN32)
set(QXT-SOURCES ${QXT-SOURCES} qxtglobalshortcut_win.cpp)
elseif(APPLE)
set(QXT-SOURCES ${QXT-SOURCES} qxtglobalshortcut_mac.cpp)
else(WIN32)
set(QXT-SOURCES ${QXT-SOURCES} qxtglobalshortcut_x11.cpp)
endif(WIN32)
QT4_WRAP_CPP(QXT-SOURCES-MOC ${QXT-MOC-HEADERS})
ADD_LIBRARY(qxt
${QXT-SOURCES}
${QXT-SOURCES-MOC}
)

54
CMakeLists.txt Normal file
View File

@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 2.6)
include(FindPkgConfig)
find_package(Qt4 REQUIRED)
set(QT_USE_QTOPENGL 1)
set(QT_USE_QTSQL 1)
set(QT_USE_QTNETWORK 1)
set(QT_USE_QTXML 1)
if(WIN32)
set(QT_USE_PHONON 1)
endif(WIN32)
find_package(OpenGL REQUIRED)
find_package(Boost REQUIRED)
pkg_check_modules(TAGLIB taglib)
pkg_check_modules(XINE libxine)
pkg_check_modules(LIBNOTIFY libnotify)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Boost not found")
endif (NOT Boost_FOUND)
if (LIBNOTIFY_FOUND)
add_definitions(-DHAVE_LIBNOTIFY)
link_directories(${LIBNOTIFY_LIBRARY_DIRS})
include_directories(${LIBNOTIFY_INCLUDE_DIRS})
endif (LIBNOTIFY_FOUND)
find_library(LASTFM_LIBRARY_DIRS lastfm)
find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
add_definitions(-DNDEBUG)
add_definitions(-DQT_NO_DEBUG_OUTPUT)
endif(${CMAKE_BUILD_TYPE} MATCHES "Release")
# Set up definitions and paths
add_definitions(${QT_DEFINITIONS})
link_directories(${TAGLIB_LIBRARY_DIRS})
link_directories(${XINE_LIBRARY_DIRS})
link_directories(${LASTFM_LIBRARY_DIRS})
include(${QT_USE_FILE})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${TAGLIB_INCLUDE_DIRS})
include_directories(${XINE_INCLUDE_DIRS})
include_directories(${LASTFM_INCLUDE_DIRS})
# Subdirectories
add_subdirectory(3rdparty/qtsingleapplication)
add_subdirectory(3rdparty/qxt)
add_subdirectory(src)

172
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,172 @@
cmake_minimum_required(VERSION 2.6)
# Source files
set(CLEMENTINE-SOURCES
main.cpp
mainwindow.cpp
player.cpp
library.cpp
librarybackend.cpp
playlist.cpp
playlistitem.cpp
enginebase.cpp
analyzers/baranalyzer.cpp
analyzers/analyzerbase.cpp
fht.cpp
analyzers/blockanalyzer.cpp
sliderwidget.cpp
playlistview.cpp
backgroundthread.cpp
librarywatcher.cpp
song.cpp
songplaylistitem.cpp
libraryview.cpp
libraryconfig.cpp
systemtrayicon.cpp
libraryquery.cpp
fileview.cpp
fileviewlist.cpp
playlistheader.cpp
radioitem.cpp
radioservice.cpp
lastfmservice.cpp
radiomodel.cpp
lastfmconfig.cpp
busyindicator.cpp
radioplaylistitem.cpp
radioview.cpp
lastfmstationdialog.cpp
osd.cpp
trackslider.cpp
edittagdialog.cpp
lineedit.cpp
multiloadingindicator.cpp
somafmservice.cpp
settingsdialog.cpp
librarydirectorymodel.cpp
libraryconfigdialog.cpp
lastfmconfigdialog.cpp
about.cpp
albumcoverfetcher.cpp
addstreamdialog.cpp
savedradio.cpp
stylesheetloader.cpp
shortcutsdialog.cpp
)
# Header files that have Q_OBJECT in
set(CLEMENTINE-MOC-HEADERS
mainwindow.h
player.h
library.h
librarybackend.h
playlist.h
enginebase.h
sliderwidget.h
playlistview.h
backgroundthread.h
librarywatcher.h
songmimedata.h
libraryview.h
libraryconfig.h
systemtrayicon.h
fileview.h
fileviewlist.h
playlistheader.h
radioservice.h
lastfmservice.h
radiomodel.h
lastfmconfig.h
busyindicator.h
radiomimedata.h
radioview.h
lastfmstationdialog.h
osd.h
trackslider.h
edittagdialog.h
lineedit.h
multiloadingindicator.h
somafmservice.h
settingsdialog.h
librarydirectorymodel.h
libraryconfigdialog.h
lastfmconfigdialog.h
about.h
albumcoverfetcher.h
addstreamdialog.h
savedradio.h
shortcutsdialog.h
)
# UI files
set(CLEMENTINE-UI
mainwindow.ui
libraryconfig.ui
fileview.ui
lastfmconfig.ui
lastfmstationdialog.ui
trackslider.ui
edittagdialog.ui
multiloadingindicator.ui
settingsdialog.ui
libraryconfigdialog.ui
lastfmconfigdialog.ui
about.ui
addstreamdialog.ui
shortcutsdialog.ui
)
# Resource files
set(CLEMENTINE-RESOURCES
../data/data.qrc
translations.qrc
)
if(WIN32)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} phononengine.cpp osd_win.cpp)
set(CLEMENTINE-MOC-HEADERS ${CLEMENTINE-MOC-HEADERS} phononengine.h)
else(WIN32)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} xine-engine.cpp xine-scope.c)
set(CLEMENTINE-MOC-HEADERS ${CLEMENTINE-MOC-HEADERS} xine-engine.h)
endif(WIN32)
if(APPLE)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_mac.mm)
else(APPLE)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_x11.cpp)
endif(APPLE)
qt4_wrap_cpp(CLEMENTINE-SOURCES-MOC ${CLEMENTINE-MOC-HEADERS})
qt4_wrap_ui(CLEMENTINE-SOURCES-UI ${CLEMENTINE-UI})
qt4_add_resources(CLEMENTINE-SOURCES-RESOURCE ${CLEMENTINE-RESOURCES})
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qtsingleapplication")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/qxt")
set(EXECUTABLE_OUTPUT_PATH ..)
add_executable(clementine
${CLEMENTINE-SOURCES}
${CLEMENTINE-SOURCES-MOC}
${CLEMENTINE-SOURCES-UI}
${CLEMENTINE-SOURCES-RESOURCE}
)
target_link_libraries(clementine
${QT_LIBRARIES}
qtsingleapplication
qxt
${XINE_LIBRARIES}
${LIBNOTIFY_LIBRARIES}
${TAGLIB_LIBRARIES}
lastfm
)
add_dependencies(clementine qtsingleapplication qxt)
set_property(TARGET clementine
PROPERTY COMPILE_FLAGS
"-Werror=non-virtual-dtor -Woverloaded-virtual -Wall"
)
install(TARGETS clementine
RUNTIME DESTINATION bin)

View File

@ -901,11 +901,12 @@ XineEngine::XineEventListener( void *p, const xine_event_t* xineEvent )
} break;
case XINE_EVENT_MRL_REFERENCE: {
case XINE_EVENT_MRL_REFERENCE_EXT: {
/// xine has read the stream and found it actually links to something else
/// so we need to play that instead
QString message = QString::fromUtf8( static_cast<xine_mrl_reference_data_t*>(xineEvent->data)->mrl );
QString message = QString::fromUtf8(
static_cast<xine_mrl_reference_data_ext_t*>(xineEvent->data)->mrl);
XineEvent *e = new XineEvent( XineEvent::Redirecting );
e->setData( new QString( message ) );

View File

@ -132,7 +132,7 @@ scope_dispose( post_plugin_t *this )
xine_post_t*
scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target )
{
scope_plugin_t *scope_plugin = xine_xmalloc( sizeof(scope_plugin_t) );
scope_plugin_t *scope_plugin = malloc( sizeof(scope_plugin_t) );
post_plugin_t *post_plugin = (post_plugin_t*)scope_plugin;
{
@ -161,7 +161,7 @@ scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target )
post_plugin->xine = xine;
/* scope_plugin_t init */
scope_plugin->list = xine_xmalloc( sizeof(MyNode) );
scope_plugin->list = malloc( sizeof(MyNode) );
scope_plugin->list->next = scope_plugin->list;
return &post_plugin->xine_post;