Clementine-audio-player-Mac.../src/CMakeLists.txt

345 lines
9.4 KiB
CMake

cmake_minimum_required(VERSION 2.6)
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "-Wnon-virtual-dtor -Woverloaded-virtual -Wall")
# Source files
set(CLEMENTINE-SOURCES
mainwindow.cpp
player.cpp
library.cpp
librarybackend.cpp
playlist.cpp
playlistitem.cpp
engines/enginebase.cpp
engines/gstengine.cpp
analyzers/baranalyzer.cpp
analyzers/analyzerbase.cpp
fht.cpp
analyzers/blockanalyzer.cpp
analyzers/analyzercontainer.cpp
analyzers/boomanalyzer.cpp
analyzers/sonogram.cpp
analyzers/turbine.cpp
sliderwidget.cpp
playlistview.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
albumcovermanager.cpp
albumcoverloader.cpp
m3uparser.cpp
playlistsequence.cpp
xspfparser.cpp
globalshortcuts/globalshortcuts.cpp
fixlastfm.cpp
backgroundthread.cpp
osdpretty.cpp
playlistdelegates.cpp
groupbydialog.cpp
)
# Header files that have Q_OBJECT in
set(CLEMENTINE-MOC-HEADERS
mainwindow.h
player.h
library.h
librarybackend.h
playlist.h
engines/enginebase.h
engines/gstengine.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
albumcovermanager.h
albumcoverloader.h
m3uparser.h
playlistsequence.h
xspfparser.h
analyzers/analyzercontainer.h
analyzers/baranalyzer.h
analyzers/blockanalyzer.h
analyzers/analyzerbase.h
analyzers/boomanalyzer.h
analyzers/sonogram.h
analyzers/turbine.h
globalshortcuts/globalshortcuts.h
osdpretty.h
playlistdelegates.h
groupbydialog.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
albumcovermanager.ui
playlistsequence.ui
osdpretty.ui
groupbydialog.ui
)
# Resource files
set(CLEMENTINE-RESOURCES
../data/data.qrc
)
set(CLEMENTINE-LANGUAGES
cs
el
es
fr
pl
ru
sk
)
# OSD and DBus.
if(APPLE)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_mac.mm)
else(APPLE)
if(WIN32)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_win.cpp)
else(WIN32)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES} osd_x11.cpp)
# MPRIS
qt4_add_dbus_adaptor(MPRIS-PLAYER-SOURCES
../data/org.freedesktop.MediaPlayer.player.xml
player.h Player mpris_player MprisPlayer)
qt4_add_dbus_adaptor(MPRIS-ROOT-SOURCES
../data/org.freedesktop.MediaPlayer.root.xml
mpris.h MPRIS mpris_root MprisRoot)
qt4_add_dbus_adaptor(MPRIS-TRACKLIST-SOURCES
../data/org.freedesktop.MediaPlayer.tracklist.xml
player.h Player mpris_tracklist MprisTrackList)
# org.freedesktop.Notifications
qt4_add_dbus_interface(NOTIFICATION-SOURCES
../data/org.freedesktop.Notifications.xml
notification)
set(CLEMENTINE-SOURCES ${CLEMENTINE-SOURCES}
${MPRIS-PLAYER-SOURCES}
${MPRIS-ROOT-SOURCES}
${MPRIS-TRACKLIST-SOURCES}
${NOTIFICATION-SOURCES}
mpris.cpp
)
set(CLEMENTINE-MOC-HEADERS ${CLEMENTINE-MOC-HEADERS} mpris.h)
endif(WIN32)
endif(APPLE)
# resource file for windows
if(WIN32)
set(CLEMENTINE-WIN32-RESOURCES ../dist/windows/windres.rc)
endif(WIN32)
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})
# Translations
set (FILES_TO_TRANSLATE ${CLEMENTINE-SOURCES} ${CLEMENTINE-SOURCES-UI} ${CLEMENTINE-SOURCES-MOC})
# Make all the filenames relative
foreach (_file ${FILES_TO_TRANSLATE})
if (IS_ABSOLUTE ${_file})
file(RELATIVE_PATH _rel ${CMAKE_CURRENT_SOURCE_DIR} ${_file})
else (IS_ABSOLUTE ${_file})
set(_rel ${_file})
endif (IS_ABSOLUTE ${_file})
set(FILES_TO_TRANSLATE_REL ${FILES_TO_TRANSLATE_REL} ${_rel})
endforeach (_file)
set (XGETTEXT_OPTIONS --qt --keyword=tr --flag=tr:1:pass-c-format --flag=tr:1:pass-qt-format
--keyword=trUtf8 --flag=tr:1:pass-c-format --flag=tr:1:pass-qt-format
--keyword=translate:2 --flag=translate:2:pass-c-format --flag=translate:2:pass-qt-format
--keyword=QT_TR_NOOP --flag=QT_TR_NOOP:1:pass-c-format --flag=QT_TR_NOOP:1:pass-qt-format
--keyword=QT_TRANSLATE_NOOP:2 --flag=QT_TRANSLATE_NOOP:2:pass-c-format --flag=QT_TRANSLATE_NOOP:2:pass-qt-format
--keyword=_ --flag=_:1:pass-c-format --flag=_:1:pass-qt-format
--keyword=N_ --flag=N_:1:pass-c-format --flag=N_:1:pass-qt-format
--from-code=utf-8)
# Generate the .pot
set (CLEMENTINE-POT "${CMAKE_CURRENT_SOURCE_DIR}/translations/translations.pot")
add_custom_target(pot ALL
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE}
${XGETTEXT_OPTIONS} -C --omit-header --no-location
--directory=${CMAKE_CURRENT_SOURCE_DIR}
--output=${CMAKE_CURRENT_BINARY_DIR}/translations.pot
${FILES_TO_TRANSLATE_REL}
COMMAND cat ${CMAKE_CURRENT_SOURCE_DIR}/translations/header ${CMAKE_CURRENT_BINARY_DIR}/translations.pot > ${CLEMENTINE-POT}
DEPENDS ${FILES_TO_TRANSLATE})
# Merge the .pot into .po files
foreach (_lang ${CLEMENTINE-LANGUAGES})
set(_po ${CMAKE_CURRENT_SOURCE_DIR}/translations/${_lang}.po)
add_custom_target("po_${_lang}" ALL
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet -U --no-location
${_po} ${CLEMENTINE-POT}
DEPENDS ${_po})
add_dependencies("po_${_lang}" pot)
endforeach (_lang)
# Convert the .po files to .qm files
foreach (_lang ${CLEMENTINE-LANGUAGES})
set(_po_filename "${_lang}.po")
set(_po_filepath "${CMAKE_CURRENT_SOURCE_DIR}/translations/${_po_filename}")
set(_qm_filename "clementine_${_lang}.qm")
set(_qm_filepath "${CMAKE_CURRENT_BINARY_DIR}/${_qm_filename}")
add_custom_command(OUTPUT ${_qm_filepath}
COMMAND lconvert ARGS ${_po_filepath} -o ${_qm_filepath} -of qm
MAIN_DEPENDENCY ${_po_filepath}
)
set(CLEMENTINE-QM-FILES ${CLEMENTINE-QM-FILES} ${_qm_filepath})
endforeach (_lang)
# Generate a qrc file for the translations
set(CLEMENTINE-QM-RESOURCE ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
file(WRITE ${CLEMENTINE-QM-RESOURCE} "<RCC><qresource prefix=\"/translations\">")
foreach(QM-FILE ${CLEMENTINE-QM-FILES})
file(RELATIVE_PATH QM-RELATIVE-PATH ${CMAKE_CURRENT_BINARY_DIR} ${QM-FILE})
file(APPEND ${CLEMENTINE-QM-RESOURCE} "<file>" ${QM-RELATIVE-PATH} "</file>")
endforeach(QM-FILE)
file(APPEND ${CLEMENTINE-QM-RESOURCE} "</qresource></RCC>")
qt4_add_resources(CLEMENTINE-SOURCES-RESOURCE ${CLEMENTINE-QM-RESOURCE})
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")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/gmock/gtest/include")
set(EXECUTABLE_OUTPUT_PATH ..)
add_library(clementine_lib
${CLEMENTINE-SOURCES}
${CLEMENTINE-SOURCES-MOC}
${CLEMENTINE-SOURCES-UI}
${CLEMENTINE-SOURCES-RESOURCE}
)
target_link_libraries(clementine_lib
qtsingleapplication
qxt
lastfm
${GOBJECT_LIBRARIES}
${GLIB_LIBRARIES}
${GSTREAMER_LIBRARIES}
${TAGLIB_LIBRARIES}
${QT_LIBRARIES}
)
if (APPLE)
target_link_libraries(clementine_lib
${GROWL}
/System/Library/Frameworks/Carbon.framework
/System/Library/Frameworks/Foundation.framework
)
include_directories(${GROWL}/Headers)
endif (APPLE)
add_dependencies(clementine_lib qtsingleapplication qxt)
# Link against the qsqlite plugin on windows
if(WIN32)
set(3RDPARTY_SQLITE_LIBRARY qsqlite)
target_link_libraries(clementine_lib qsqlite)
endif(WIN32)
add_executable(clementine
MACOSX_BUNDLE
WIN32
${CLEMENTINE-WIN32-RESOURCES}
main.cpp
)
target_link_libraries(clementine clementine_lib)
set_target_properties(clementine PROPERTIES
MACOSX_BUNDLE_INFO_STRING "Clementine 0.2"
MACOSX_BUNDLE_ICON_FILE "clementine"
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.2"
)
install(TARGETS clementine
BUNDLE DESTINATION bin
RUNTIME DESTINATION bin
)
install(FILES ../dist/clementine_64.png
DESTINATION share/icons/hicolor/64x64/apps/
RENAME application-x-clementine.png
)
install(FILES ../dist/clementine.desktop
DESTINATION share/applications
)