2010-10-17 05:32:01 +02:00
PROJECT ( tomahawk )
2012-03-08 19:30:00 +01:00
CMAKE_MINIMUM_REQUIRED ( VERSION 2.8.6 )
2011-08-12 14:25:42 +02:00
SET ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" )
2012-04-02 04:02:10 +02:00
CMAKE_POLICY ( SET CMP0017 NEW )
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 )
2012-06-21 15:03:33 +02:00
SET ( TOMAHAWK_VERSION_MINOR 5 )
2012-06-24 23:51:24 +02:00
SET ( TOMAHAWK_VERSION_PATCH 99 )
2012-06-22 04:59:28 +02:00
#SET( TOMAHAWK_VERSION_RC 0 )
2011-07-07 03:18:12 +02:00
2013-01-02 11:09:21 +01:00
SET ( TOMAHAWK_TRANSLATION_LANGUAGES ar bg bn_IN ca cs de en el es fi fr hi_IN hu gl it ja lt pl pt_BR ru sv tr zh_CN zh_TW )
2012-12-21 03:47:50 +02:00
2012-03-03 01:14:21 +01:00
# enforce proper symbol exporting on all platforms
add_definitions ( "-fvisibility=hidden" )
2012-11-15 13:05:21 +01:00
# enforce using constBegin, constEnd for const-iterators
add_definitions ( "-DQT_STRICT_ITERATORS" )
2011-08-08 14:05:51 +02:00
# build options
option ( BUILD_GUI "Build Tomahawk with GUI" ON )
2011-08-13 22:42:08 +02:00
option ( BUILD_RELEASE "Generate TOMAHAWK_VERSION without GIT info" OFF )
2012-03-28 23:16:21 +02:00
option ( WITH_BREAKPAD "Build with breakpad integration" ON )
option ( WITH_CRASHREPORTER "Build with CrashReporter" ON )
2012-05-25 12:35:28 -04:00
option ( WITH_BINARY_ATTICA "Enable support for downloading binary resolvers automatically" ON )
2011-11-30 18:15:41 +01:00
option ( LEGACY_KDE_INTEGRATION "Install tomahawk.protocol file, deprecated since 4.6.0" OFF )
2011-08-08 14:05:51 +02:00
2012-03-28 23:16:21 +02:00
IF ( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" )
message ( STATUS "Build of breakpad library disabled on this platform." )
SET ( WITH_BREAKPAD OFF )
SET ( WITH_CRASHREPORTER OFF )
ENDIF ( )
# add definitions based on build options
2012-06-25 17:57:52 +02:00
IF ( WITH_BREAKPAD )
2012-03-28 23:16:21 +02:00
message ( STATUS "Build with support for breakpad." )
2012-06-25 17:57:52 +02:00
IF ( CMAKE_COMPILER_IS_GNUCXX )
2012-11-16 09:52:29 +01:00
ADD_DEFINITIONS ( -DSTDC_HEADERS -std=gnu++98 )
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTDC_HEADERS -std=gnu++98" )
2012-06-25 17:57:52 +02:00
ENDIF ( )
2012-03-28 23:16:21 +02:00
ENDIF ( )
2011-08-08 14:05:51 +02:00
# generate version string
2011-07-07 03:18:12 +02:00
2011-08-13 22:42:08 +02:00
# base string used in release and unstable builds
2011-07-07 02:52:31 +02:00
SET ( TOMAHAWK_VERSION ${ TOMAHAWK_VERSION_MAJOR } . ${ TOMAHAWK_VERSION_MINOR } . ${ TOMAHAWK_VERSION_PATCH } )
2011-07-07 03:18:12 +02:00
IF ( TOMAHAWK_VERSION_RC )
2011-08-13 22:42:08 +02:00
SET ( TOMAHAWK_VERSION ${ TOMAHAWK_VERSION } rc ${ TOMAHAWK_VERSION_RC } )
2011-07-07 03:18:12 +02:00
ENDIF ( )
2011-08-13 22:42:08 +02:00
# additional info for non-release builds
2012-09-20 15:33:04 +02:00
IF ( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" )
2011-08-13 23:00:00 +02:00
INCLUDE ( CMakeDateStamp )
SET ( TOMAHAWK_VERSION_DATE "${CMAKE_DATESTAMP_YEAR}${CMAKE_DATESTAMP_MONTH}${CMAKE_DATESTAMP_DAY}" )
2012-04-26 14:04:59 +02:00
IF ( TOMAHAWK_VERSION_DATE GREATER 0 )
2011-08-13 22:42:08 +02:00
SET ( TOMAHAWK_VERSION ${ TOMAHAWK_VERSION } . ${ TOMAHAWK_VERSION_DATE } )
ENDIF ( )
INCLUDE ( CMakeVersionSource )
IF ( CMAKE_VERSION_SOURCE )
SET ( TOMAHAWK_VERSION ${ TOMAHAWK_VERSION } - ${ CMAKE_VERSION_SOURCE } )
ENDIF ( )
2011-07-07 03:18:12 +02:00
ENDIF ( )
2011-03-02 04:34:59 +01:00
# set paths
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}" )
2011-12-27 03:17:37 +01:00
# make predefined install dirs available everywhere
2012-06-12 01:12:33 +02:00
INCLUDE ( GNUInstallDirs )
2011-12-27 03:17:37 +01:00
2011-07-07 02:52:31 +02:00
# installer creation
2011-08-13 21:51:31 +02:00
INCLUDE ( TomahawkCPack.cmake )
2010-10-17 05:32:01 +02:00
2011-08-08 14:05:51 +02:00
#deps
INCLUDE ( MacroOptionalFindPackage )
INCLUDE ( MacroLogFeature )
2010-10-17 05:32:01 +02:00
# Check if we need qtgui:
2011-08-08 14:05:51 +02:00
SET ( NEEDED_QT4_COMPONENTS QtCore QtXml QtNetwork )
IF ( NOT BUILD_GUI )
2010-10-17 05:32:01 +02:00
ADD_DEFINITIONS ( -DENABLE_HEADLESS )
2011-07-20 05:51:40 +02:00
MESSAGE ( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} in HEADLESS mode ***" )
2010-10-17 05:32:01 +02:00
ELSE ( )
2011-07-20 05:51:40 +02:00
MESSAGE ( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} full GUI version ***" )
2012-02-06 14:56:32 +01:00
LIST ( APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" )
2010-10-17 05:32:01 +02:00
ENDIF ( )
2011-08-26 18:40:19 -04:00
IF ( BUILD_GUI AND UNIX AND NOT APPLE )
FIND_PACKAGE ( X11 )
ENDIF ( )
2011-08-08 14:05:51 +02:00
macro_optional_find_package ( Qt4 4.7.0 COMPONENTS ${ NEEDED_QT4_COMPONENTS } )
2012-02-06 14:56:32 +01:00
macro_log_feature ( QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt.nokia.com" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too" )
2011-02-21 18:00:02 +01:00
2011-08-08 14:05:51 +02:00
macro_optional_find_package ( Phonon 4.5.0 )
macro_log_feature ( PHONON_FOUND "Phonon" "The Phonon multimedia library" "http://phonon.kde.org" TRUE "" "" )
if ( PHONON_FOUND )
message ( STATUS "Phonon found; ensure that phonon-vlc is at least 0.4" )
2011-04-30 11:25:28 -04:00
endif ( )
2011-04-22 09:58:30 -04:00
2012-07-24 12:28:10 +02:00
macro_optional_find_package ( Echonest 2.0.0 )
macro_log_feature ( ECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest 2.0.0 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-08-08 14:05:51 +02:00
include ( CheckTagLibFileName )
check_taglib_filename ( COMPLEX_TAGLIB_FILENAME )
2012-12-20 13:08:23 +01:00
macro_optional_find_package ( Boost )
2011-08-12 03:56:30 +02:00
macro_log_feature ( Boost_FOUND "Boost" "Provides free peer-reviewed portable C++ source libraries" "http://www.boost.org" TRUE "" "" ) #FIXME: give useful explaination
2011-08-29 00:10:30 -04:00
macro_optional_find_package ( QCA2 )
2012-08-03 01:28:03 +02:00
macro_log_feature ( QCA2_FOUND "QCA2" "Provides encryption and signing functions required for Grooveshark resolver" "http://delta.affinix.com/qca/" TRUE "" "" )
2011-08-12 03:56:30 +02:00
2012-06-18 17:07:51 -04:00
macro_optional_find_package ( LibAttica 0.4.0 )
2012-12-20 13:08:23 +01:00
macro_log_feature ( LIBATTICA_FOUND "libattica" "Provides support for installation of resolvers from the Tomahawk website" "https://projects.kde.org/projects/kdesupport/attica" TRUE "" "" )
2011-09-06 18:09:47 -04:00
2011-09-09 08:24:26 -04:00
macro_optional_find_package ( QuaZip )
2012-01-27 13:50:29 -05:00
macro_log_feature ( QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers automatically." "http://quazip.sourceforge.net/" TRUE "" "" )
2011-09-09 08:24:26 -04:00
2012-03-31 23:07:22 +02:00
macro_optional_find_package ( Jreen 1.0.5 )
macro_log_feature ( JREEN_FOUND "Jreen" "Qt XMPP Library" "http://qutim.org/jreen / https://github.com/euroelessar/jreen" FALSE "" "Jreen is needed for the Jabber SIP plugin.\n" )
2012-01-05 22:40:01 +01:00
macro_optional_find_package ( 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" )
2012-06-12 01:12:33 +02:00
macro_optional_find_package ( LibLastFm 1.0.0 )
2012-06-12 17:13:37 +02:00
macro_log_feature ( LIBLASTFM_FOUND "liblastfm" "Qt library for the Last.fm webservices" "https://github.com/eartle/liblastfm" TRUE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork" )
2011-08-08 14:05:51 +02:00
2012-11-03 01:04:13 +01:00
IF ( WIN32 )
macro_optional_find_package ( QtSparkle )
macro_log_feature ( QTSPARKLE_FOUND "qtsparkle" "Library for creating auto updaters written in Qt" "https://github.com/davidsansome/qtsparkle" FALSE "" "" )
ENDIF ( WIN32 )
2011-11-02 13:13:23 +01:00
#### submodules start
2012-01-05 22:40:01 +01:00
# automatically init submodules here, don't delete this code we may add submodules again
2011-02-21 18:00:02 +01:00
2011-04-17 21:25:24 +02:00
# this installs headers and such and should really be handled in a separate package by packagers
2011-11-02 13:13:23 +01:00
2012-01-05 22:40:01 +01:00
# IF( FALSE )
# IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules)
# EXECUTE_PROCESS(COMMAND git submodule init WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
# EXECUTE_PROCESS(COMMAND git submodule update WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
# ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules)
# ENDIF()
2011-05-21 04:38:55 +02:00
2011-11-02 13:13:23 +01:00
#### submodules end
2011-05-21 04:38:55 +02:00
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
2012-06-30 17:04:39 +02:00
macro_optional_find_package ( Threads )
macro_log_feature ( THREADS_FOUND "Threads" "Threading Library" "" TRUE "" "Platform specific library for threading" )
2011-08-08 14:05:51 +02:00
2011-08-09 22:46:50 -04:00
macro_optional_find_package ( KDE4 )
2011-08-08 14:05:51 +02:00
macro_optional_find_package ( KDE4Installed )
# this was used before we had FindKDE4Installed, just leaving it here to keep the flags
# for future kde integration
# macro_optional_find_package(KDE4)
2011-08-09 22:46:50 -04:00
IF ( KDE4_FOUND )
2011-09-06 23:45:09 +02:00
IF ( CMAKE_C_FLAGS )
# KDE4 adds and removes some compiler flags that we don't like
# (only for gcc not for clang e.g.)
STRING ( REPLACE "-std=iso9899:1990" "" CLEAN_C_FLAGS ${ CMAKE_C_FLAGS } )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions" )
ENDIF ( )
2011-08-09 22:46:50 -04:00
ELSE ( )
SET ( CLEAN_C_FLAGS ${ CMAKE_C_FLAGS } )
ENDIF ( )
2011-02-10 11:18:59 +01:00
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-05-25 03:44:33 +02:00
SET ( TOMAHAWK_LIBRARIES tomahawklib )
2012-11-19 11:51:06 +01:00
ADD_SUBDIRECTORY ( thirdparty )
2010-10-17 05:32:01 +02:00
ADD_SUBDIRECTORY ( src )
2012-11-19 11:51:06 +01:00
ADD_SUBDIRECTORY ( src/libtomahawk )
2011-03-21 03:01:54 +01:00
ADD_SUBDIRECTORY ( admin )