2010-10-17 05:32:01 +02:00
PROJECT ( tomahawk )
CMAKE_MINIMUM_REQUIRED ( VERSION 2.8 )
2011-04-12 11:00:07 -04:00
IF ( ${ CMAKE_VERSION } VERSION_GREATER 2.8.3 )
CMAKE_POLICY ( SET CMP0017 NEW )
ENDIF ( ${ CMAKE_VERSION } VERSION_GREATER 2.8.3 )
2011-04-12 10:53:32 -04:00
2011-03-02 04:34:59 +01:00
###
### Tomahawk application info
###
2011-04-04 16:44:39 +02:00
SET ( TOMAHAWK_ORGANIZATION_NAME "Tomahawk" )
SET ( TOMAHAWK_ORGANIZATION_DOMAIN "tomahawk-player.org" )
SET ( TOMAHAWK_APPLICATION_NAME "Tomahawk" )
2011-07-07 02:52:31 +02:00
SET ( TOMAHAWK_DESCRIPTION_SUMMARY "The social media player" )
SET ( TOMAHAWK_VERSION_MAJOR 0 )
SET ( TOMAHAWK_VERSION_MINOR 1 )
SET ( TOMAHAWK_VERSION_PATCH 0 )
SET ( TOMAHAWK_VERSION ${ TOMAHAWK_VERSION_MAJOR } . ${ TOMAHAWK_VERSION_MINOR } . ${ TOMAHAWK_VERSION_PATCH } )
2011-03-02 04:34:59 +01:00
# set paths
2011-02-21 16:29:17 +01:00
SET ( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/CMakeModules" )
2011-02-21 13:10:30 +01:00
SET ( THIRDPARTY_DIR ${ CMAKE_SOURCE_DIR } /thirdparty )
2011-07-07 02:52:31 +02:00
SET ( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET ( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
SET ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" )
# installer creation
INCLUDE ( CPack.cmake )
2010-10-17 05:32:01 +02:00
# Check if we need qtgui:
IF ( "${gui}" STREQUAL "no" )
ADD_DEFINITIONS ( -DENABLE_HEADLESS )
MESSAGE ( STATUS "Building in HEADLESS mode ***" )
2011-03-21 09:21:58 +01:00
FIND_PACKAGE ( Qt4 4.7.0 COMPONENTS QtCore QtXml QtNetwork REQUIRED )
2010-10-17 05:32:01 +02:00
ELSE ( )
MESSAGE ( STATUS "Building full GUI version ***" )
2011-03-21 09:21:58 +01:00
FIND_PACKAGE ( Qt4 4.7.0 COMPONENTS QtGui QtCore QtXml QtNetwork REQUIRED )
2010-10-17 05:32:01 +02:00
ENDIF ( )
2011-02-21 18:00:02 +01:00
#deps
INCLUDE ( MacroOptionalFindPackage )
INCLUDE ( MacroLogFeature )
# required
2011-03-24 19:18:42 -04:00
#While we distribute our own liblastfm2, don't need to look for it
#macro_optional_find_package(LibLastFm 0.3.3)
#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 )
2011-02-21 18:00:02 +01:00
2011-04-22 09:58:30 -04:00
find_package ( Phonon REQUIRED )
2011-04-30 11:25:28 -04:00
if ( PHONON_VERSION STRLESS "4.5.0" )
message ( FATAL_ERROR "Phonon version 4.5.0 or higher is required, you have version ${PHONON_VERSION}" )
else ( )
message ( STATUS "Phonon found; ensure that phonon-vlc is at least 0.4" )
endif ( )
2011-04-22 09:58:30 -04:00
2011-05-23 21:14:47 -04:00
macro_optional_find_package ( LibEchonest 1.1.7 )
2011-05-23 23:36:37 -04:00
macro_log_feature ( LIBECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest 1.1.8 is needed for dynamic playlists and the infosystem" )
2011-02-21 18:00:02 +01:00
macro_optional_find_package ( CLucene 0.9.23 )
macro_log_feature ( CLucene_FOUND "CLucene" "The open-source, C++ search engine" "http://clucene.sf.net" TRUE "" "CLucene is used for indexing the collection" )
macro_optional_find_package ( QJSON )
macro_log_feature ( QJSON_FOUND "QJson" "Qt library that maps JSON data to QVariant objects" "http://qjson.sf.net" TRUE "" "libqjson is used for encoding communication between Tomahawk instances" )
macro_optional_find_package ( Taglib 1.6.0 )
macro_log_feature ( TAGLIB_FOUND "TagLib" "Audio Meta-Data Library" "http://developer.kde.org/~wheeler/taglib.html" TRUE "" "taglib is needed for reading meta data from audio files" )
2011-04-17 21:25:24 +02:00
# this installs headers and such and should really be handled in a separate package by packagers
IF ( INTERNAL_JREEN )
2011-05-21 12:12:07 +02:00
ADD_SUBDIRECTORY ( ${ THIRDPARTY_DIR } /jreen )
2011-04-17 21:25:24 +02:00
SET ( LIBJREEN_INCLUDE_DIR ${ CMAKE_CURRENT_BINARY_DIR } /thirdparty/jreen/include )
2011-05-21 04:53:42 +02:00
SET ( LIBJREEN_LIBRARY jreen )
SET ( LIBJREEN_LIBRARIES ${ LIBJREEN_LIBRARY } )
2011-04-17 21:25:24 +02:00
SET ( LIBJREEN_FOUND true )
MESSAGE ( STATUS "INTERNAL libjreen: ${LIBJREEN_INCLUDE_DIR}, ${LIBJREEN_LIBRARY}" )
ELSE ( INTERNAL_JREEN )
macro_optional_find_package ( Jreen )
ENDIF ( INTERNAL_JREEN )
2011-05-21 04:38:55 +02:00
macro_log_feature ( LIBJREEN_FOUND "Jreen" "Qt XMPP Library" "http://gitorious.org/jreen/jreen" FALSE "" "Jreen is needed for the Jabber SIP plugin. \n\n Use -DINTERNAL_JREEN=ON to build the git submodule inside Tomahawk \n Be aware this installs a full jreen with headers and everything!\n" )
# this installs headers and such and should really be handled in a separate package by packagers
IF ( INTERNAL_QTWEETLIB )
2011-05-21 12:12:07 +02:00
ADD_SUBDIRECTORY ( ${ THIRDPARTY_DIR } /qtweetlib )
2011-05-21 05:15:33 +02:00
# copy headers to build/QTweetLib so we can use proper includes inside the code
FILE ( COPY ${ CMAKE_SOURCE_DIR } /thirdparty/qtweetlib/QTweetLib/src/ DESTINATION ${ CMAKE_BINARY_DIR } /QTweetLib )
SET ( QTWEETLIB_INCLUDE_DIR ${ CMAKE_BINARY_DIR } )
2011-05-21 04:38:55 +02:00
SET ( QTWEETLIB_LIBRARY tomahawk_qtweetlib )
SET ( QTWEETLIB_LIBRARIES ${ QTWEETLIB_LIBRARY } )
SET ( QTWEETLIB_FOUND true )
MESSAGE ( STATUS "INTERNAL libQTweetLib: ${QTWEETLIB_INCLUDE_DIR}, ${QTWEETLIB_LIBRARY}" )
ELSE ( INTERNAL_QTWEETLIB )
macro_optional_find_package ( QTweetLib )
ENDIF ( INTERNAL_QTWEETLIB )
macro_log_feature ( QTWEETLIB_FOUND "QTweetLib" "Qt Twitter Library" "https://github.com/minimoog/QTweetLib" FALSE "" "QTweetLib is needed for the Twitter SIP plugin. \n\n Use -DINTERNAL_QTWEETLIB=ON to build the git submodule inside Tomahawk \n" )
2011-05-21 12:12:07 +02:00
### libportfwd
SET ( LIBPORTFWD_INCLUDE_DIR ${ THIRDPARTY_DIR } /libportfwd/include )
SET ( LIBPORTFWD_LIBRARY tomahawk_portfwd )
SET ( LIBPORTFWD_LIBRARIES ${ LIBPORTFWD_LIBRARY } )
ADD_SUBDIRECTORY ( ${ THIRDPARTY_DIR } /libportfwd )
2011-04-17 21:25:24 +02:00
2011-03-11 13:34:11 -05:00
# we need pthreads too
find_package ( Threads )
2011-02-21 18:00:02 +01:00
2011-05-20 11:47:16 -04:00
find_package ( KDE4Installed )
2011-04-11 15:36:29 -04:00
find_package ( KDE4 )
IF ( KDE4_FOUND )
#KDE4 adds and removes some compiler flags that we don't like
STRING ( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${ CMAKE_C_FLAGS } )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
ELSE ( )
SET ( CLEAN_C_FLAGS ${ CMAKE_C_FLAGS } )
ENDIF ( )
2011-02-10 11:18:59 +01:00
include ( CheckTagLibFileName )
check_taglib_filename ( COMPLEX_TAGLIB_FILENAME )
2011-03-07 18:31:55 -05:00
IF ( WIN32 )
find_library ( QTSPARKLE_LIBRARIES qtsparkle )
ENDIF ( WIN32 )
2011-02-21 18:00:02 +01:00
#show dep log
2011-02-21 16:29:17 +01:00
macro_display_feature_log ( )
2011-03-18 14:45:42 -04:00
SET ( INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
# make uninstall support
CONFIGURE_FILE (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
2011-04-11 15:36:29 -04:00
# KDE4 defines an uninstall target for us automatically
IF ( NOT KDE4_FOUND )
ADD_CUSTOM_TARGET ( uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
ENDIF ( )
2011-03-18 14:45:42 -04:00
2011-03-11 13:38:32 -05:00
IF ( NOT APPLE )
# Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often
2011-03-11 14:56:44 -05:00
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined" )
2011-03-11 13:38:32 -05:00
ENDIF ( NOT APPLE )
2011-03-11 13:34:11 -05:00
2011-01-27 00:05:16 -05:00
ADD_SUBDIRECTORY ( thirdparty )
2010-12-28 06:12:48 +01:00
ADD_SUBDIRECTORY ( src/libtomahawk )
2011-05-25 03:44:33 +02:00
SET ( TOMAHAWK_LIBRARIES tomahawklib )
2010-10-17 05:32:01 +02:00
ADD_SUBDIRECTORY ( src )
2011-03-21 03:01:54 +01:00
ADD_SUBDIRECTORY ( admin )