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 )
2013-10-22 11:16:15 -04:00
2013-12-10 16:06:00 -05:00
IF ( CMAKE_VERSION VERSION_EQUAL 2.8.12 OR CMAKE_VERSION VERSION_GREATER 2.8.12 )
2013-10-22 10:53:44 -04:00
CMAKE_POLICY ( SET CMP0022 NEW )
# TODO:
# Update to NEW and fix things up when we can depend on 2.8.12
CMAKE_POLICY ( SET CMP0023 OLD )
2013-10-22 11:16:15 -04:00
ENDIF ( )
2013-10-22 10:53:44 -04:00
2013-09-21 13:46:18 +02:00
INCLUDE ( CMakeDependentOption )
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" )
2014-10-24 16:04:56 +02:00
IF ( APPLE )
SET ( TOMAHAWK_TARGET_NAME "Tomahawk" )
ELSE ( )
SET ( TOMAHAWK_TARGET_NAME "tomahawk" )
ENDIF ( )
2011-07-07 02:52:31 +02:00
2012-09-24 23:48:27 +02:00
IF ( WIN32 )
SET ( TOMAHAWK_SYSTEM "Windows" )
ELSEIF ( APPLE )
SET ( TOMAHAWK_SYSTEM "OS X" )
ELSEIF ( UNIX )
SET ( TOMAHAWK_SYSTEM "Linux" )
ELSE ( )
SET ( TOMAHAWK_SYSTEM "Uknown Platform, please let the Tomahawk team know, this actually happened" )
ENDIF ( )
2011-07-07 02:52:31 +02:00
SET ( TOMAHAWK_VERSION_MAJOR 0 )
2014-07-17 13:47:50 +01:00
SET ( TOMAHAWK_VERSION_MINOR 8 )
2014-10-21 21:48:21 +02:00
SET ( TOMAHAWK_VERSION_PATCH 99 )
SET ( TOMAHAWK_VERSION_RC 0 )
2011-07-07 03:18:12 +02:00
2014-11-19 14:30:58 +01:00
SET ( TOMAHAWK_TRANSLATION_LANGUAGES ar bg bn_IN ca cs da de en el es es_419 fi fr hi_IN hu gl id it ja lt nl pl pt_BR pt_PT ro ru sq sv th tr uk vi zh_CN zh_TW )
2012-12-21 03:47:50 +02:00
2014-06-30 01:47:42 +01:00
# add_definitions is only in the scope of this directory and all directories
# below it. Tomahawk Libraries and plugins that are built with Tomahawk are
# not included in out-of-source build so we need to re-add_definitions there.
macro ( tomahawk_add_definitions DEFINITION )
add_definitions ( ${ DEFINITION } )
2014-10-29 20:04:56 +01:00
set ( TOMAHAWK_DEFINITIONS "${TOMAHAWK_DEFINITIONS} ${DEFINITION}" )
endmacro ( )
macro ( tomahawk_add_cxx_flags FLAGS )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}" )
set ( TOMAHAWK_CXX_FLAGS "${TOMAHAWK_CXX_FLAGS} ${FLAGS}" )
endmacro ( )
macro ( tomahawk_add_c_flags FLAGS )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}" )
set ( TOMAHAWK_C_FLAGS "${TOMAHAWK_C_FLAGS} ${FLAGS}" )
2014-06-30 01:47:42 +01:00
endmacro ( )
2012-03-03 01:14:21 +01:00
# enforce proper symbol exporting on all platforms
2014-06-30 01:47:42 +01:00
tomahawk_add_definitions ( "-fvisibility=hidden" )
2012-11-15 13:05:21 +01:00
# enforce using constBegin, constEnd for const-iterators
2014-06-30 01:47:42 +01:00
tomahawk_add_definitions ( "-DQT_STRICT_ITERATORS" )
2011-08-08 14:05:51 +02:00
# build options
2011-08-13 22:42:08 +02:00
option ( BUILD_RELEASE "Generate TOMAHAWK_VERSION without GIT info" OFF )
2014-10-26 20:28:32 +01:00
if ( BUILD_RELEASE )
set ( BUILD_NO_RELEASE OFF )
else ( )
set ( BUILD_NO_RELEASE ON )
endif ( )
option ( BUILD_GUI "Build Tomahawk with GUI" ON )
option ( BUILD_TESTS "Build Tomahawk with unit tests" ${ BUILD_NO_RELEASE } )
option ( BUILD_TOOLS "Build Tomahawk helper tools" ${ BUILD_NO_RELEASE } )
2014-10-26 20:12:19 +01:00
option ( BUILD_HATCHET "Build the Hatchet plugin" ON )
2013-06-23 23:37:13 +02:00
option ( BUILD_WITH_QT4 "Build Tomahawk with Qt4 no matter if Qt5 was found" ON )
2013-01-17 21:21:42 +01:00
2015-01-29 06:10:35 +01:00
if ( UNIX AND NOT APPLE )
set ( CRASHREPORTER_ENABLED_BY_DEFAULT OFF )
else ( )
set ( CRASHREPORTER_ENABLED_BY_DEFAULT ON )
endif ( )
option ( WITH_CRASHREPORTER "Build with CrashReporter" ${ CRASHREPORTER_ENABLED_BY_DEFAULT } )
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 )
2013-07-23 17:09:29 +02:00
option ( WITH_KDE4 "Build with support for KDE specific stuff" ON )
2011-08-08 14:05:51 +02:00
2014-10-12 19:04:53 +01:00
# build options for development purposes
option ( SANITIZE_ADDRESS "Enable Address Sanitizer for memory error detection" OFF )
option ( TOMAHAWK_FINEGRAINED_MESSAGES "Enable even more verbose logging (will hurt performance significantly" OFF )
2013-09-21 13:46:18 +02:00
CMAKE_DEPENDENT_OPTION ( WITH_UPOWER "Build with support for UPower events" ON
" UNIX ; N O T APPLE " O F F )
CMAKE_DEPENDENT_OPTION ( WITH_GNOMESHORTCUTHANDLER "Build with shortcut handler for GNOME" ON
" UNIX ; N O T APPLE " O F F )
2014-04-18 15:11:43 +02:00
IF ( CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libcrashreporter-qt/CMakeLists.txt" )
2014-04-18 13:20:56 +02:00
message ( STATUS "Build of crashreporter disabled." )
2012-03-28 23:16:21 +02:00
SET ( WITH_CRASHREPORTER OFF )
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
2014-10-26 21:18:37 +01:00
SET ( TOMAHAWK_VERSION_TMP "${TOMAHAWK_VERSION_MAJOR}.${TOMAHAWK_VERSION_MINOR}.${TOMAHAWK_VERSION_PATCH}" )
SET ( TOMAHAWK_VERSION_SHORT "${TOMAHAWK_VERSION_TMP}" )
2011-07-07 03:18:12 +02:00
IF ( TOMAHAWK_VERSION_RC )
2014-10-28 20:11:22 +01:00
SET ( TOMAHAWK_VERSION_TMP "${TOMAHAWK_VERSION_TMP}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}" )
2013-06-05 03:56:23 +02:00
IF ( TOMAHAWK_VERSION_DATE GREATER 0 )
2014-10-28 20:11:22 +01:00
SET ( TOMAHAWK_VERSION_TMP ${ TOMAHAWK_VERSION_TMP } . ${ TOMAHAWK_VERSION_DATE } )
2011-08-13 22:42:08 +02:00
ENDIF ( )
INCLUDE ( CMakeVersionSource )
IF ( CMAKE_VERSION_SOURCE )
2014-10-26 21:18:37 +01:00
SET ( TOMAHAWK_VERSION_TMP ${ TOMAHAWK_VERSION_TMP } - ${ CMAKE_VERSION_SOURCE } )
2011-08-13 22:42:08 +02:00
ENDIF ( )
2011-07-07 03:18:12 +02:00
ENDIF ( )
2014-10-26 21:18:37 +01:00
# write Tomahawk version to cache
SET ( TOMAHAWK_VERSION "${TOMAHAWK_VERSION_TMP}" CACHE STRING "Tomahawk Version" )
2011-07-07 03:18:12 +02:00
2011-03-02 04:34:59 +01:00
# set paths
2014-09-25 11:21:44 +02: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
2013-01-06 03:52:20 +01:00
# deps
2011-08-08 14:05:51 +02:00
INCLUDE ( MacroOptionalFindPackage )
INCLUDE ( MacroLogFeature )
2014-07-21 09:30:38 +01:00
message ( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} ***" )
2010-10-17 05:32:01 +02:00
2013-06-05 03:56:23 +02:00
if ( NOT BUILD_WITH_QT4 )
2013-03-02 07:22:31 +01:00
find_package ( Qt5Core QUIET )
2013-06-05 03:56:23 +02:00
if ( Qt5Core_DIR )
2014-06-24 17:54:07 +01:00
# CMAKE 2.8.13+/3.0.0+ requires these for IMPORTed targets
find_package ( Qt5Concurrent REQUIRED )
2014-08-21 11:15:09 +01:00
find_package ( Qt5Svg REQUIRED )
2014-06-24 17:54:07 +01:00
find_package ( Qt5UiTools REQUIRED )
find_package ( Qt5WebKitWidgets REQUIRED )
find_package ( Qt5Widgets REQUIRED )
find_package ( Qt5Xml REQUIRED )
2015-02-04 18:40:08 +01:00
find_package ( Qt5X11Extras NO_MODULE )
if ( Qt5X11Extras_FOUND )
set ( HAVE_X11 TRUE )
else ( )
set ( HAVE_X11 FALSE )
2015-02-04 17:59:02 +01:00
endif ( )
2015-02-04 18:40:08 +01:00
2013-03-02 07:22:31 +01:00
message ( STATUS "Found Qt5! Be aware that Qt5-support is still experimental and not officially supported!" )
2013-01-06 03:52:20 +01:00
2013-09-21 13:46:18 +02:00
if ( UNIX AND NOT APPLE )
# We need this to find the paths to qdbusxml2cpp and co
find_package ( Qt5DBus REQUIRED )
endif ( )
2014-06-24 17:54:07 +01:00
2014-10-29 05:40:40 +01:00
if ( APPLE )
find_package ( Qt5MacExtras REQUIRED )
endif ( )
2014-03-31 16:54:48 +02:00
if ( WIN32 )
find_package ( Qt5WinExtras REQUIRED )
endif ( )
2013-07-26 19:44:40 +02:00
2013-03-02 07:22:31 +01:00
macro ( qt_wrap_ui )
qt5_wrap_ui ( ${ ARGN } )
endmacro ( )
2013-01-06 03:52:20 +01:00
2013-03-02 07:22:31 +01:00
macro ( qt_add_resources )
qt5_add_resources ( ${ ARGN } )
endmacro ( )
2013-01-06 03:52:20 +01:00
2013-03-02 07:22:31 +01:00
find_package ( Qt5LinguistTools REQUIRED )
macro ( qt_add_translation )
qt5_add_translation ( ${ ARGN } )
endmacro ( )
2013-01-06 03:52:20 +01:00
2014-10-29 05:40:40 +01:00
if ( UNIX AND NOT APPLE )
macro ( qt_add_dbus_interface )
qt5_add_dbus_interface ( ${ ARGN } )
endmacro ( )
2013-07-03 22:28:14 +02:00
2014-10-29 05:40:40 +01:00
macro ( qt_add_dbus_adaptor )
qt5_add_dbus_adaptor ( ${ ARGN } )
endmacro ( )
endif ( )
2013-07-03 22:28:14 +02:00
2013-03-02 07:22:31 +01:00
macro ( setup_qt )
endmacro ( )
2013-01-06 03:52:20 +01:00
2013-03-02 07:22:31 +01:00
set ( QT_RCC_EXECUTABLE "${Qt5Core_RCC_EXECUTABLE}" )
#FIXME: CrashReporter depends on deprecated QHttp
2013-07-23 17:09:29 +02:00
set ( WITH_KDE4 OFF )
2013-03-02 07:22:31 +01:00
endif ( )
endif ( )
2013-06-05 03:56:23 +02:00
if ( NOT Qt5Core_DIR )
2013-03-02 07:13:34 +01:00
message ( STATUS "Could not find Qt5, searching for Qt4 instead..." )
2013-01-06 03:52:20 +01:00
set ( NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork" )
2013-01-17 21:21:42 +01:00
if ( BUILD_GUI )
list ( APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" "QtSvg" )
endif ( )
if ( BUILD_TESTS )
list ( APPEND NEEDED_QT4_COMPONENTS "QtTest" )
2013-01-06 03:52:20 +01:00
endif ( )
macro_optional_find_package ( Qt4 4.7.0 COMPONENTS ${ NEEDED_QT4_COMPONENTS } )
2014-10-29 01:54:09 +01:00
macro_log_feature ( QT4_FOUND "Qt" "A cross-platform application and UI framework" "http://qt-project.org" TRUE "" "If you see this, although libqt4-devel is installed, check whether the \n qtwebkit-devel package and whatever contains QtUiTools is installed too" )
2013-01-06 03:52:20 +01:00
macro ( qt5_use_modules )
endmacro ( )
2013-01-06 04:58:31 +01:00
macro ( qt_wrap_ui )
qt4_wrap_ui ( ${ ARGN } )
endmacro ( )
macro ( qt_add_resources )
qt4_add_resources ( ${ ARGN } )
endmacro ( )
macro ( qt_add_translation )
qt4_add_translation ( ${ ARGN } )
endmacro ( )
2013-07-03 22:28:14 +02:00
macro ( qt_add_dbus_interface )
qt4_add_dbus_interface ( ${ ARGN } )
endmacro ( )
macro ( qt_add_dbus_adaptor )
qt4_add_dbus_adaptor ( ${ ARGN } )
endmacro ( )
2013-01-06 03:52:20 +01:00
macro ( setup_qt )
2013-06-05 03:56:23 +02:00
if ( NOT BUILD_GUI )
2013-01-06 03:52:20 +01:00
set ( QT_DONT_USE_QTGUI TRUE )
endif ( )
2013-06-05 03:56:23 +02:00
if ( UNIX AND NOT APPLE )
2013-01-06 03:52:20 +01:00
set ( QT_USE_QTDBUS TRUE )
endif ( )
set ( QT_USE_QTSQL TRUE )
set ( QT_USE_QTNETWORK TRUE )
set ( QT_USE_QTXML TRUE )
set ( QT_USE_QTWEBKIT TRUE )
include ( ${ QT_USE_FILE } )
endmacro ( )
2014-06-29 21:09:02 +01:00
# Qt5 C++11 Macros not defined within Qt4
# TODO: Add C++11 support
2014-06-30 01:47:42 +01:00
tomahawk_add_definitions ( "-DQ_DECL_FINAL=" )
tomahawk_add_definitions ( "-DQ_DECL_OVERRIDE=" )
2013-01-06 03:52:20 +01:00
endif ( )
2013-07-23 17:09:29 +02:00
if ( Qt5Core_DIR )
2015-01-29 06:11:11 +01:00
set ( TOMAHAWK_QT5_TMP TRUE )
2013-07-23 17:09:29 +02:00
else ( Qt5Core_DIR )
2015-01-29 06:11:11 +01:00
set ( TOMAHAWK_QT5_TMP FALSE )
2013-07-23 17:09:29 +02:00
endif ( Qt5Core_DIR )
2015-01-29 06:11:11 +01:00
set ( TOMAHAWK_QT5 ${ TOMAHAWK_QT5_TMP } CACHE BOOL "Build Tomahawk with Qt5" )
2013-07-23 17:09:29 +02:00
2013-06-05 03:56:23 +02:00
if ( BUILD_GUI AND UNIX AND NOT APPLE )
2014-10-23 15:04:08 +02:00
macro_optional_find_package ( X11 )
macro_log_feature ( X11_FOUND "X11" "The Xorg libraries" "http://www.x.org/wiki/" TRUE "" "Xorg libraries are used by libqnetwm to bring windows to front reliably" )
2013-01-06 03:52:20 +01:00
endif ( )
2011-02-21 18:00:02 +01:00
2014-09-17 20:50:27 +01:00
include ( CheckCXXCompilerFlag )
check_cxx_compiler_flag ( "-std=c++11" CXX11_FOUND )
check_cxx_compiler_flag ( "-std=c++0x" CXX0X_FOUND )
2014-10-19 12:22:58 +02:00
check_cxx_compiler_flag ( "-stdlib=libc++" LIBCPP_FOUND )
2014-09-17 20:50:27 +01:00
if ( CXX11_FOUND )
2014-10-29 20:04:56 +01:00
tomahawk_add_cxx_flags ( "-std=c++11" )
2014-09-17 20:50:27 +01:00
elseif ( CXX0X_FOUND )
2014-10-29 20:04:56 +01:00
tomahawk_add_cxx_flags ( "-std=c++0x" )
2014-09-17 20:50:27 +01:00
else ( )
message ( STATUS " ${ CMAKE_CXX_COMPILER } does not support C++11, please use a
d i f f e r e n t c o m p i l e r " )
endif ( )
2014-10-19 12:22:58 +02:00
if ( LIBCPP_FOUND AND APPLE )
2014-10-29 20:04:56 +01:00
tomahawk_add_cxx_flags ( "-stdlib=libc++" )
2014-10-19 12:22:58 +02:00
endif ( )
2014-09-17 20:50:27 +01:00
2014-10-29 20:04:56 +01:00
2014-02-14 19:54:13 +01:00
macro_optional_find_package ( Echonest 2.2.0 )
macro_log_feature ( ECHONEST_FOUND "Echonest" "Qt library for communicating with The Echo Nest" "http://projects.kde.org/libechonest" TRUE "" "libechonest 2.2.0 is needed for dynamic playlists and the infosystem" )
2011-02-21 18:00:02 +01:00
2014-09-16 12:15:35 +02:00
find_package ( Boost REQUIRED COMPONENTS system )
macro_log_feature ( Boost_FOUND "Boost" "Provides free peer-reviewed portable C++ source libraries" "http://www.boost.org" TRUE "" "" ) #FIXME: give useful explanation
2014-10-03 04:35:44 +02:00
macro_optional_find_package ( Lucene++ 3.0.0 )
macro_log_feature ( LUCENEPP_FOUND "Lucene++" "The open-source, C++ search engine" "https://github.com/luceneplusplus/LucenePlusPlus/" TRUE "" "Lucene++ is used for indexing the collection" )
2014-09-16 01:02:59 +02:00
2014-04-15 19:23:17 +01:00
if ( NOT TOMAHAWK_QT5 )
macro_optional_find_package ( QJSON 0.8.1 )
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" )
ENDIF ( )
2011-02-21 18:00:02 +01:00
2014-11-16 16:20:10 +01:00
macro_optional_find_package ( Taglib 1.8.0 )
2011-02-21 18:00:02 +01:00
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 )
2014-06-09 10:28:23 +01:00
macro_optional_find_package ( Sparsehash )
macro_log_feature ( SPARSEHASH_FOUND "Sparsehash"
2014-06-27 03:30:01 +01:00
" A n e x t r e m e l y m e m o r y - e f f i c i e n t h a s h _ m a p i m p l e m e n t a t i o n . "
" h t t p s : / / c o d e . g o o g l e . c o m / p / s p a r s e h a s h / " T R U E " "
2014-06-09 10:28:23 +01:00
" S p a r s e h a s h i s n e e d e d f o r r e a d i n g m e t a d a t a o f m e d i a s t r e a m s a n d f a s t
f o r w a r d / b a c k w a r d s e e k i n g i n H T T P s t r e a m s " )
2014-06-27 03:32:44 +01:00
macro_optional_find_package ( GnuTLS )
macro_log_feature ( GNUTLS_FOUND "GnuTLS"
" G n u T L S i s a s e c u r e c o m m u n i c a t i o n s l i b r a r y i m p l e m e n t i n g t h e S S L , T L S a n d D T L S p r o t o c o l s a n d t e c h n o l o g i e s a r o u n d t h e m . "
" h t t p : / / g n u t l s . o r g / " T R U E " "
" G n u T L S i s n e e d e d f o r s e r v i n g t h e P l a y d a r / H T T P A P I v i a T L S " )
2015-01-29 06:11:36 +01:00
if ( TOMAHAWK_QT5 )
macro_optional_find_package ( Qca-qt5 )
if ( Qca-qt5_DIR )
set ( QCA2_FOUND ON CACHE BOOL "QCA2 was found" )
set ( QCA2_LIBRARIES "qca-qt5" CACHE STRING "QCA2 Qt5 target" )
endif ( )
else ( )
macro_optional_find_package ( QCA2 )
endif ( )
2013-02-20 13:24:10 -05:00
macro_log_feature ( QCA2_FOUND "QCA2" "Provides encryption and signing functions necessary for some resolvers and accounts" "http://delta.affinix.com/qca/" TRUE "" "" )
2011-08-12 03:56:30 +02:00
2014-01-17 19:02:52 +00:00
if ( TOMAHAWK_QT5 )
macro_optional_find_package ( KF5Attica 1.0.0 )
set ( LIBATTICA_FOUND ${ KF5Attica_FOUND } )
else ( )
macro_optional_find_package ( LibAttica 0.4.0 )
endif ( )
2014-12-02 13:42:57 +01:00
macro_log_feature ( LIBATTICA_FOUND "libattica" "Provides support for installation of resolvers from the Tomahawk website" "http://download.kde.org/stable/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" )
2013-06-05 03:56:23 +02:00
if ( PC_JREEN_VERSION STREQUAL "1.1.0" )
2013-01-07 22:49:42 +01:00
message ( FATAL_ERROR "Jreen 1.1.0 has a very annoying bug that breaks accepting auth requests in Tomahawk. Please upgrade to 1.1.1 or downgrade to 1.0.5." )
endif ( )
2012-01-05 22:40:01 +01:00
2012-06-12 01:12:33 +02:00
macro_optional_find_package ( LibLastFm 1.0.0 )
2013-01-26 20:47:25 +01:00
macro_log_feature ( LIBLASTFM_FOUND "liblastfm" "Qt library for the Last.fm webservices" "https://github.com/lastfm/liblastfm" TRUE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork" )
2011-08-08 14:05:51 +02:00
2013-12-12 17:15:23 +01:00
if ( NOT APPLE )
2013-12-04 19:11:38 +00:00
if ( TOMAHAWK_QT5 )
macro_optional_find_package ( Qt5Keychain 0.1.0 )
else ( )
macro_optional_find_package ( QtKeychain 0.1.0 )
endif ( )
2013-05-12 12:36:47 +02:00
macro_log_feature ( QTKEYCHAIN_FOUND "QtKeychain" "Provides support for secure credentials storage" "https://github.com/frankosterfeld/qtkeychain" TRUE "" "" )
2013-12-12 17:15:23 +01:00
endif ( )
2013-05-12 12:36:47 +02:00
2013-06-10 19:08:51 +02:00
if ( UNIX AND NOT APPLE )
macro_optional_find_package ( TelepathyQt 0.9.3 )
2014-02-26 10:44:19 +00:00
if ( TOMAHAWK_QT5 )
macro_log_feature ( TelepathyQt5_FOUND "Telepathy-Qt" "Telepathy-Qt is a Qt high-level binding for Telepathy, a D-Bus framework for unifying real time communication." FALSE "" "Telepathy-Qt is needed for sharing Jabber/GTalk accounts with Telepathy.\n" )
else ( TOMAHAWK_QT5 )
macro_log_feature ( TelepathyQt4_FOUND "Telepathy-Qt" "Telepathy-Qt is a Qt high-level binding for Telepathy, a D-Bus framework for unifying real time communication." FALSE "" "Telepathy-Qt is needed for sharing Jabber/GTalk accounts with Telepathy.\n" )
endif ( )
2013-06-10 19:08:51 +02:00
endif ( )
2013-01-06 03:52:20 +01:00
# we need pthreads too
macro_optional_find_package ( Threads )
macro_log_feature ( THREADS_FOUND "Threads" "Threading Library" "" TRUE "" "Platform specific library for threading" )
2013-05-12 12:36:47 +02:00
### QtSparkle
if ( WIN32 )
2012-11-03 01:04:13 +01:00
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 "" "" )
2013-05-12 12:36:47 +02:00
endif ( WIN32 )
2012-11-03 01:04:13 +01:00
2014-07-23 21:53:44 +02:00
if ( WIN32 OR APPLE )
2014-04-04 10:55:08 +02:00
if ( TOMAHAWK_QT5 )
macro_optional_find_package ( LibsnoreQt5 QUIET )
else ( )
macro_optional_find_package ( Libsnore QUIET )
endif ( )
macro_log_feature ( LIBSNORE_FOUND "Libsnore" "Library for notifications" "https://github.com/TheOneRing/Snorenotify" FALSE "" "" )
2013-07-24 10:33:45 +02:00
endif ( )
2014-10-22 10:45:02 +02:00
find_package ( LIBVLC REQUIRED 2.1.0 )
2014-10-22 11:32:59 +02:00
macro_log_feature ( LIBVLC_FOUND "LibVLC" "Provides audio output" "https://www.videolan.org/vlc/" TRUE "" "" )
2014-09-29 23:22:39 +02:00
2013-01-05 21:54:39 +01:00
set ( QXTWEB_FOUND TRUE )
set ( QXTWEB_LIBRARIES qxtweb-standalone )
2013-04-09 10:35:08 +02:00
set ( QXTWEB_INCLUDE_DIRS ${ THIRDPARTY_DIR } /qxt/qxtweb-standalone/web ${ THIRDPARTY_DIR } /qxt/qxtweb-standalone/network ${ THIRDPARTY_DIR } /qxt/qxtweb-standalone/core ${ CMAKE_CURRENT_BINARY_DIR } )
2013-01-05 21:54:39 +01:00
2013-01-06 03:52:20 +01: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-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-08-08 14:05:51 +02:00
2013-07-23 17:09:29 +02:00
if ( WITH_KDE4 )
macro_optional_find_package ( KDE4 )
macro_optional_find_package ( KDE4Installed )
endif ( WITH_KDE4 )
2013-06-24 01:15:24 +02:00
macro_log_feature ( KDE4_FOUND "KDE4" "Provides support for configuring Telepathy Accounts from inside Tomahawk" "https://www.kde.org" FALSE "" "" )
2013-08-06 23:58:13 +02:00
2014-10-21 20:46:44 +02: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 )
2013-08-07 00:14:39 +02:00
# KDE4 defines an uninstall target for us automatically (and at least with Qt4 Phonon does as well no matter if kdelibs was found)
# 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
2014-09-28 10:38:52 +01:00
IF ( ( NOT APPLE ) AND ( NOT SANITIZE_ADDRESS ) )
2011-03-11 13:38:32 -05:00
# Make linking as strict on linux as it is on osx. Then we don't break linking on mac so often
2014-09-28 10:38:52 +01:00
#
# On using Address Sanitizer, we cannot link to the ASAN lib, so
# --no-undefined would break the build.
2014-07-19 07:11:53 +01:00
SET ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
SET ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined" )
2014-09-28 10:38:52 +01:00
ENDIF ( )
IF ( SANITIZE_ADDRESS )
SET ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer" )
SET ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" )
ENDIF ( )
2011-03-11 13:34:11 -05:00
2013-07-23 17:09:29 +02:00
# Early configure these files as we need them later on
configure_file ( TomahawkUse.cmake.in "${PROJECT_BINARY_DIR}/TomahawkUse.cmake" @ONLY )
file ( COPY TomahawkAddPlugin.cmake DESTINATION "${PROJECT_BINARY_DIR}" )
file ( COPY TomahawkAddLibrary.cmake DESTINATION "${PROJECT_BINARY_DIR}" )
2011-05-25 03:44:33 +02:00
SET ( TOMAHAWK_LIBRARIES tomahawklib )
2013-06-30 22:06:55 +02:00
SET ( TOMAHAWK_WIDGETS_LIBRARIES tomahawk-widgets )
2013-08-24 14:19:24 +02:00
SET ( TOMAHAWK_PLAYDARAPI_LIBRARIES tomahawk-playdarapi )
2012-11-19 11:51:06 +01:00
ADD_SUBDIRECTORY ( thirdparty )
2010-10-17 05:32:01 +02:00
ADD_SUBDIRECTORY ( src )
2011-03-21 03:01:54 +01:00
ADD_SUBDIRECTORY ( admin )
2013-01-17 21:21:42 +01:00
2014-08-21 12:10:48 +02:00
IF ( BUILD_TESTS )
enable_testing ( )
ADD_SUBDIRECTORY ( src/tests )
ENDIF ( )
2013-01-18 00:21:59 +01:00
# Add all targets to the build-tree export set
set ( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Tomahawk" CACHE PATH "Installation directory for CMake files" )
set ( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" )
2013-05-08 17:31:49 +02:00
export ( TARGETS tomahawklib
2013-01-18 00:21:59 +01:00
F I L E " $ { P R O J E C T _ B I N A R Y _ D I R } / T o m a h a w k L i b r a r y D e p e n d s . c m a k e " )
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export ( PACKAGE Tomahawk )
# Create a TomahawkBuildTreeSettings.cmake file for the use from the build tree
configure_file ( TomahawkBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/TomahawkBuildTreeSettings.cmake" @ONLY )
# Create the TomahawkConfig.cmake and TomahawkConfigVersion files
file ( RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_CMAKEDIR}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}" )
configure_file ( TomahawkConfig.cmake.in "${PROJECT_BINARY_DIR}/TomahawkConfig.cmake" @ONLY )
configure_file ( TomahawkConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/TomahawkConfigVersion.cmake" @ONLY )
2013-06-30 15:59:29 +02:00
2013-01-18 00:21:59 +01:00
# Install the cmake files
install (
F I L E S
" $ { P R O J E C T _ B I N A R Y _ D I R } / T o m a h a w k C o n f i g . c m a k e "
" $ { P R O J E C T _ B I N A R Y _ D I R } / T o m a h a w k C o n f i g V e r s i o n . c m a k e "
" $ { P R O J E C T _ B I N A R Y _ D I R } / T o m a h a w k U s e . c m a k e "
" $ { P R O J E C T _ B I N A R Y _ D I R } / T o m a h a w k A d d P l u g i n . c m a k e "
2013-06-30 15:59:29 +02:00
" $ { P R O J E C T _ B I N A R Y _ D I R } / T o m a h a w k A d d L i b r a r y . c m a k e "
2013-01-18 00:21:59 +01:00
D E S T I N A T I O N
" $ { C M A K E _ I N S T A L L _ C M A K E D I R } "
)
# Install the export set for use with the install-tree
install (
E X P O R T
T o m a h a w k L i b r a r y D e p e n d s
D E S T I N A T I O N
" $ { C M A K E _ I N S T A L L _ C M A K E D I R } "
)