2010-02-28 18:28:56 +01:00
cmake_minimum_required ( VERSION 2.6 )
2010-08-28 19:25:54 +02:00
include ( CheckCXXCompilerFlag )
2010-02-28 18:28:56 +01:00
include ( FindPkgConfig )
2010-08-31 20:23:23 +02:00
include ( cmake/Summary.cmake )
2010-06-09 00:39:31 +02:00
include ( cmake/Version.cmake )
2010-09-05 00:33:31 +02:00
include ( cmake/Deb.cmake )
2010-09-04 20:55:29 +02:00
include ( cmake/Rpm.cmake )
2011-04-29 21:44:51 +02:00
include ( cmake/SpotifyVersion.cmake )
2011-10-29 19:37:30 +02:00
include ( cmake/OptionalSource.cmake )
2010-02-28 18:28:56 +01:00
2011-02-04 13:07:00 +01:00
if ( UNIX AND NOT APPLE )
set ( LINUX 1 )
endif ( UNIX AND NOT APPLE )
2011-05-21 21:08:38 +02:00
find_package ( Qt4 4.5.0 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml )
2011-02-04 13:07:00 +01:00
if ( LINUX )
2010-12-26 14:38:35 +01:00
option ( ENABLE_DBUS "Enable D-Bus, MPRIS and native notifications. Required for DeviceKit and Wii remote support" ON )
if ( ENABLE_DBUS )
find_package ( Qt4 REQUIRED QtDbus )
set ( HAVE_DBUS ON )
option ( ENABLE_DEVICEKIT "DeviceKit backend" ON )
if ( ENABLE_DEVICEKIT )
set ( HAVE_DEVICEKIT ON )
endif ( ENABLE_DEVICEKIT )
option ( ENABLE_WIIMOTEDEV "Enable Wii remote support in Clementine" ON )
endif ( ENABLE_DBUS )
2011-02-04 13:07:00 +01:00
endif ( LINUX )
2010-12-14 18:07:41 +01:00
if ( NOT APPLE )
2010-12-26 14:01:35 +01:00
find_package ( Qt4 COMPONENTS QtWebKit )
2010-12-14 18:07:41 +01:00
endif ( NOT APPLE )
2010-02-28 18:28:56 +01:00
2010-04-21 13:03:30 +02:00
# Find Qt's lconvert binary. Try qt's binary dir first, fall back to looking in PATH
find_program ( QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4 PATHS ${ QT_BINARY_DIR } NO_DEFAULT_PATH )
find_program ( QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4 )
2010-04-19 11:42:30 +02:00
if ( APPLE )
if ( NOT QT_MAC_USE_COCOA )
message ( FATAL_ERROR "Cocoa support is required" )
endif ( NOT QT_MAC_USE_COCOA )
endif ( APPLE )
2010-02-28 18:28:56 +01:00
find_package ( OpenGL REQUIRED )
find_package ( Boost REQUIRED )
2010-04-06 21:18:14 +02:00
find_package ( Gettext REQUIRED )
2010-11-21 16:13:26 +01:00
find_package ( PkgConfig REQUIRED )
2012-01-02 18:21:07 +01:00
find_package ( Protobuf REQUIRED )
2010-02-28 18:28:56 +01:00
2010-08-14 20:56:05 +02:00
pkg_check_modules ( TAGLIB REQUIRED taglib>=1.6 )
2011-09-20 10:07:55 +02:00
pkg_check_modules ( QJSON REQUIRED QJson )
2010-08-14 20:56:05 +02:00
pkg_check_modules ( GSTREAMER gstreamer-0.10 )
pkg_check_modules ( GSTREAMER_BASE gstreamer-base-0.10 )
2011-05-19 18:34:33 +02:00
pkg_check_modules ( GSTREAMER_APP gstreamer-app-0.10 )
2011-06-10 01:08:43 +02:00
pkg_check_modules ( GSTREAMER_CDDA gstreamer-cdda-0.10 )
2011-06-16 15:49:10 +02:00
pkg_check_modules ( GSTREAMER_TAG gstreamer-tag-0.10 )
2010-08-14 20:56:05 +02:00
pkg_check_modules ( GLIB glib-2.0 )
pkg_check_modules ( LIBXML libxml-2.0 )
pkg_check_modules ( GOBJECT gobject-2.0 )
2010-08-31 19:20:02 +02:00
pkg_check_modules ( LIBGPOD libgpod-1.0>=0.7.92 )
2010-08-14 20:56:05 +02:00
pkg_check_modules ( GIO gio-2.0 )
pkg_check_modules ( IMOBILEDEVICE libimobiledevice-1.0 )
pkg_check_modules ( PLIST libplist )
pkg_check_modules ( USBMUXD libusbmuxd )
2010-10-15 14:45:59 +02:00
pkg_check_modules ( LIBMTP libmtp>=1.0 )
2010-11-21 16:13:26 +01:00
pkg_check_modules ( INDICATEQT indicate-qt )
2011-11-27 19:47:02 +01:00
pkg_check_modules ( SPOTIFY libspotify>=10.1.16 )
2011-08-05 02:15:16 +02:00
pkg_check_modules ( CDIO libcdio )
2011-11-05 02:12:28 +01:00
pkg_check_modules ( QCA qca2 )
2012-01-07 16:25:39 +01:00
pkg_check_modules ( CHROMAPRINT libchromaprint )
2010-08-14 20:56:05 +02:00
if ( WIN32 )
find_package ( ZLIB REQUIRED )
2010-08-30 21:58:01 +02:00
find_library ( MSWMDM_LIBRARIES mswmdm )
2010-08-15 20:08:09 +02:00
find_library ( SAC_SHIM_LIBRARIES sac_shim )
2010-12-30 17:20:33 +01:00
find_library ( QTSPARKLE_LIBRARIES qtsparkle )
2010-08-14 20:56:05 +02:00
endif ( WIN32 )
2010-02-28 18:28:56 +01:00
2010-06-06 23:08:52 +02:00
find_library ( LASTFM_LIBRARIES lastfm )
2010-02-28 18:28:56 +01:00
find_path ( LASTFM_INCLUDE_DIRS lastfm/ws.h )
2010-03-01 13:13:11 +01:00
if ( APPLE )
find_library ( GROWL Growl )
2011-04-25 21:16:26 +02:00
2010-12-14 19:20:14 +01:00
option ( ENABLE_SPARKLE "Sparkle updating" ON )
2010-04-15 17:23:12 +02:00
find_library ( SPARKLE Sparkle )
2010-12-14 19:20:14 +01:00
if ( ENABLE_SPARKLE AND SPARKLE )
set ( HAVE_SPARKLE ON )
endif ( ENABLE_SPARKLE AND SPARKLE )
2011-04-25 21:16:26 +02:00
2011-04-27 00:20:11 +02:00
find_library ( SPOTIFY libspotify )
if ( SPOTIFY )
set ( SPOTIFY_FOUND ON )
set ( SPOTIFY_INCLUDE_DIRS ${ SPOTIFY } )
set ( SPOTIFY_LIBRARIES ${ SPOTIFY } )
endif ( SPOTIFY )
2011-05-30 12:09:34 +02:00
add_subdirectory ( 3rdparty/SPMediaKeyTap )
set ( SPMEDIAKEYTAP_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/SPMediaKeyTap )
set ( SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap )
2010-06-18 13:13:44 +02:00
# Uses Darwin kernel version.
# 9.8.0 -> 10.5/Leopard
# 10.4.0 -> 10.6/Snow Leopard
string ( REGEX MATCH "[0-9]+" DARWIN_VERSION ${ CMAKE_HOST_SYSTEM_VERSION } )
if ( DARWIN_VERSION GREATER 9 )
SET ( SNOW_LEOPARD 1 )
elseif ( DARWIN_VERSION GREATER 8 )
SET ( LEOPARD 1 )
endif ( DARWIN_VERSION GREATER 9 )
2010-03-01 13:13:11 +01:00
endif ( APPLE )
2010-11-03 22:11:43 +01:00
find_package ( Threads )
2010-02-28 18:28:56 +01:00
if ( ${ CMAKE_BUILD_TYPE } MATCHES "Release" )
add_definitions ( -DNDEBUG )
add_definitions ( -DQT_NO_DEBUG_OUTPUT )
endif ( ${ CMAKE_BUILD_TYPE } MATCHES "Release" )
2011-04-29 21:44:51 +02:00
# Use protobuf-lite if it's available
2011-08-29 03:00:59 +02:00
set ( USE_PROTOBUF_LITE ON CACHE BOOL "Use protobuf-lite instead of protobuf if available" )
2011-04-29 21:44:51 +02:00
find_library ( PROTOBUF_LITE_LIBRARY protobuf-lite )
2011-08-29 03:00:59 +02:00
2011-04-29 21:44:51 +02:00
if ( NOT PROTOBUF_LITE_LIBRARY )
# Lucid doesn't have a .so symlink
find_file ( PROTOBUF_LITE_LIBRARY
N A M E S l i b p r o t o b u f - l i t e . s o . 5
P A T H _ S U F F I X E S l i b
)
endif ( NOT PROTOBUF_LITE_LIBRARY )
2010-02-28 18:28:56 +01:00
# Set up definitions and paths
add_definitions ( ${ QT_DEFINITIONS } )
link_directories ( ${ TAGLIB_LIBRARY_DIRS } )
2011-09-20 10:07:55 +02:00
link_directories ( ${ QJSON_LIBRARY_DIRS } )
2010-04-06 18:57:02 +02:00
link_directories ( ${ GSTREAMER_LIBRARY_DIRS } )
2010-02-28 18:28:56 +01:00
2010-12-26 14:01:35 +01:00
# Don't try to use webkit if their include directories couldn't be found.
2010-09-26 17:10:08 +02:00
if ( NOT QT_QTWEBKIT_INCLUDE_DIR )
set ( QT_USE_QTWEBKIT 0 )
endif ( NOT QT_QTWEBKIT_INCLUDE_DIR )
2010-04-30 13:27:27 +02:00
2010-02-28 18:28:56 +01:00
include ( ${ QT_USE_FILE } )
include_directories ( ${ Boost_INCLUDE_DIRS } )
include_directories ( ${ TAGLIB_INCLUDE_DIRS } )
2011-09-20 10:07:55 +02:00
include_directories ( ${ QJSON_INCLUDE_DIRS } )
2010-04-06 18:57:02 +02:00
include_directories ( ${ GSTREAMER_INCLUDE_DIRS } )
include_directories ( ${ GLIB_INCLUDE_DIRS } )
include_directories ( ${ GLIBCONFIG_INCLUDE_DIRS } )
include_directories ( ${ LIBXML_INCLUDE_DIRS } )
2010-04-29 15:16:46 +02:00
include_directories ( "3rdparty/universalchardet" )
2010-02-28 18:28:56 +01:00
2010-03-02 21:46:46 +01:00
# Remove GLU and GL from the link line - they're not really required
# and don't exist on my mingw toolchain
list ( REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL" )
2010-03-02 23:02:43 +01:00
if ( WIN32 )
# RC compiler
string ( REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${ CMAKE_C_COMPILER } )
2010-03-04 17:50:27 +01:00
enable_language ( RC )
2012-01-15 18:19:02 +01:00
SET ( CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I ${CMAKE_SOURCE_DIR}/dist/windows" )
2010-03-02 23:02:43 +01:00
endif ( WIN32 )
2011-06-20 17:08:06 +02:00
add_definitions ( -DQT_NO_CAST_TO_ASCII -DQT_STRICT_ITERATORS )
2010-03-25 23:37:00 +01:00
2010-04-06 21:18:14 +02:00
# Translations stuff
2011-07-27 21:54:05 +02:00
find_program ( GETTEXT_XGETTEXT_EXECUTABLE xgettext PATHS /target/bin )
2010-05-07 15:10:21 +02:00
if ( NOT GETTEXT_XGETTEXT_EXECUTABLE )
message ( FATAL_ERROR "Could not find xgettext executable" )
endif ( NOT GETTEXT_XGETTEXT_EXECUTABLE )
2011-07-27 21:54:05 +02:00
find_program ( GETTEXT_MSGMERGE_EXECUTABLE msgmerge PATHS /target/bin )
if ( NOT GETTEXT_MSGMERGE_EXECUTABLE )
message ( FATAL_ERROR "Could not find msgmerge executable" )
endif ( NOT GETTEXT_MSGMERGE_EXECUTABLE )
find_program ( GETTEXT_MSGFMT_EXECUTABLE msgfmt PATHS /target/bin )
if ( NOT GETTEXT_MSGFMT_EXECUTABLE )
message ( FATAL_ERROR "Could not find msgfmt executable" )
endif ( NOT GETTEXT_MSGFMT_EXECUTABLE )
2010-04-06 21:18:14 +02:00
2010-06-11 00:48:23 +02:00
# Optional bits
2010-09-22 15:05:51 +02:00
option ( ENABLE_LIBGPOD "iPod classic support" ON )
option ( ENABLE_IMOBILEDEVICE "iPod Touch, iPhone, iPad support" ON )
option ( ENABLE_LIBMTP "MTP support" ON )
option ( ENABLE_GIO "GIO backend" ON )
2011-08-10 17:23:32 +02:00
option ( ENABLE_AUDIOCD "Audio CD support" ON )
2010-06-11 00:48:23 +02:00
option ( ENABLE_VISUALISATIONS "Use libprojectm visualisations" ON )
2010-06-11 01:01:22 +02:00
option ( BUNDLE_PROJECTM_PRESETS "Install Clementine's own copies of libprojectm presets - disable this if you want to use a system package instead" ON )
2010-11-21 16:13:26 +01:00
option ( ENABLE_SOUNDMENU "Add Clementine to the Gnome sound menu" ON )
2010-12-19 14:54:30 +01:00
option ( ENABLE_LIBLASTFM "Use liblastfm for fetching song info, scrobbling and radio streams" ON )
2011-03-04 22:10:00 +01:00
option ( ENABLE_REMOTE "Enable support for using remote controls with Clementine" OFF )
2011-03-26 17:28:58 +01:00
option ( ENABLE_BREAKPAD "Enable crash reporting" OFF )
2011-04-29 21:44:51 +02:00
option ( ENABLE_SPOTIFY_BLOB "Build the spotify non-GPL binary" ON )
option ( ENABLE_SPOTIFY "Enable spotify support" ON )
2011-10-30 16:10:02 +01:00
option ( ENABLE_PLASMARUNNER "Enable plasma krunner global search" OFF )
2010-08-24 21:57:43 +02:00
2011-04-24 19:02:26 +02:00
if ( WIN32 )
option ( ENABLE_WIN32_CONSOLE "Show the windows console even outside Debug mode" OFF )
2012-01-15 16:32:04 +01:00
if ( SAC_SHIM_LIBRARIES )
set ( HAVE_SAC ON )
endif ( SAC_SHIM_LIBRARIES )
2011-04-24 19:02:26 +02:00
endif ( WIN32 )
2010-09-22 15:05:51 +02:00
if ( ENABLE_LIBGPOD AND LIBGPOD_FOUND )
2010-08-31 20:23:23 +02:00
set ( HAVE_LIBGPOD ON )
2010-09-22 15:05:51 +02:00
endif ( ENABLE_LIBGPOD AND LIBGPOD_FOUND )
2010-08-31 20:23:23 +02:00
2010-12-14 18:07:41 +01:00
if ( ENABLE_GIO AND GIO_FOUND AND NOT APPLE )
2010-08-31 20:23:23 +02:00
set ( HAVE_GIO ON )
2010-12-14 18:07:41 +01:00
endif ( ENABLE_GIO AND GIO_FOUND AND NOT APPLE )
2010-08-31 20:23:23 +02:00
2011-08-10 17:23:32 +02:00
if ( ENABLE_AUDIOCD AND CDIO_FOUND )
set ( HAVE_AUDIOCD ON )
endif ( ENABLE_AUDIOCD AND CDIO_FOUND )
2010-09-22 15:05:51 +02:00
if ( ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_FOUND AND PLIST_FOUND AND HAVE_LIBGPOD AND USBMUXD_FOUND )
2010-08-31 20:23:23 +02:00
set ( HAVE_IMOBILEDEVICE ON )
2010-09-22 15:05:51 +02:00
endif ( ENABLE_IMOBILEDEVICE AND IMOBILEDEVICE_FOUND AND PLIST_FOUND AND HAVE_LIBGPOD AND USBMUXD_FOUND )
2010-08-31 20:23:23 +02:00
2010-09-22 15:05:51 +02:00
if ( ENABLE_LIBMTP AND LIBMTP_FOUND )
2010-08-31 20:23:23 +02:00
set ( HAVE_LIBMTP ON )
2010-09-22 15:05:51 +02:00
endif ( ENABLE_LIBMTP AND LIBMTP_FOUND )
2010-08-31 20:23:23 +02:00
2010-11-21 16:13:26 +01:00
if ( ENABLE_SOUNDMENU AND INDICATEQT_FOUND )
set ( HAVE_LIBINDICATE ON )
endif ( ENABLE_SOUNDMENU AND INDICATEQT_FOUND )
2010-12-19 16:10:26 +01:00
if ( ENABLE_LIBLASTFM AND LASTFM_LIBRARIES AND LASTFM_INCLUDE_DIRS )
set ( HAVE_LIBLASTFM ON )
endif ( ENABLE_LIBLASTFM AND LASTFM_LIBRARIES AND LASTFM_INCLUDE_DIRS )
2011-03-12 22:19:32 +01:00
if ( ENABLE_WIIMOTEDEV AND HAVE_DBUS )
set ( HAVE_WIIMOTEDEV ON )
endif ( ENABLE_WIIMOTEDEV AND HAVE_DBUS )
2011-03-25 12:38:03 +01:00
if ( ENABLE_BREAKPAD )
2011-03-23 22:53:24 +01:00
set ( HAVE_BREAKPAD ON )
2011-03-25 12:38:03 +01:00
endif ( ENABLE_BREAKPAD )
2011-03-23 22:53:24 +01:00
2011-11-05 16:31:29 +01:00
if ( ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE )
2011-04-25 21:16:26 +02:00
set ( HAVE_SPOTIFY ON )
2011-11-05 16:31:29 +01:00
endif ( ENABLE_SPOTIFY AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE )
2011-04-29 21:44:51 +02:00
2011-11-05 16:31:29 +01:00
if ( ENABLE_SPOTIFY_BLOB AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND SPOTIFY_FOUND )
2011-04-29 21:44:51 +02:00
set ( HAVE_SPOTIFY_BLOB ON )
2011-11-05 16:31:29 +01:00
endif ( ENABLE_SPOTIFY_BLOB AND PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE AND SPOTIFY_FOUND )
if ( ( NOT HAVE_SPOTIFY_BLOB ) AND ( NOT QCA_FOUND ) )
# If we're not bundling the spotify blob then we must ensure QCA is available
# so we can verify the blob we download at runtime.
unset ( HAVE_SPOTIFY )
endif ( ( NOT HAVE_SPOTIFY_BLOB ) AND ( NOT QCA_FOUND ) )
2011-11-07 13:05:31 +01:00
if ( QCA_FOUND AND HAVE_SPOTIFY )
2011-11-05 16:31:29 +01:00
set ( HAVE_QCA ON )
2011-11-07 13:05:31 +01:00
endif ( QCA_FOUND AND HAVE_SPOTIFY )
2011-04-25 21:16:26 +02:00
2010-06-11 00:48:23 +02:00
if ( ENABLE_VISUALISATIONS )
2010-07-10 22:21:06 +02:00
# When/if upstream accepts our patches then these options can be used to link
2010-07-10 22:33:28 +02:00
# to system installed projectM instead.
2010-07-10 22:21:06 +02:00
option ( USE_SYSTEM_PROJECTM "Don't set this option unless your system projectM library has been compiled with the Clementine patches in 3rdparty" OFF )
if ( USE_SYSTEM_PROJECTM )
2010-07-17 13:56:33 +02:00
pkg_check_modules ( LIBPROJECTM libprojectM )
2010-07-10 22:21:06 +02:00
else ( USE_SYSTEM_PROJECTM )
add_subdirectory ( 3rdparty/libprojectm )
set ( LIBPROJECTM_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/libprojectm )
set ( LIBPROJECTM_LIBRARIES projectM )
endif ( USE_SYSTEM_PROJECTM )
2010-06-11 00:48:23 +02:00
endif ( ENABLE_VISUALISATIONS )
2010-09-10 22:04:52 +02:00
# We compile our own qsqlite3 by default now, because in Qt 4.7 the symbols we
# need from it are private.
option ( STATIC_SQLITE "Compile and use a static sqlite3 library" ON )
2010-06-30 21:55:46 +02:00
2011-03-01 13:52:53 +01:00
pkg_check_modules ( GNUTLS gnutls )
2011-04-07 15:38:27 +02:00
if ( GNUTLS_LIBRARIES )
2011-03-01 13:52:53 +01:00
set ( HAVE_GNUTLS 1 )
2011-04-07 15:38:27 +02:00
endif ( GNUTLS_LIBRARIES )
2011-03-01 13:52:53 +01:00
2011-11-28 16:12:23 +01:00
if ( ENABLE_REMOTE AND HAVE_GNUTLS )
2011-01-06 17:00:40 +01:00
set ( HAVE_REMOTE ON )
2011-03-01 13:52:53 +01:00
add_subdirectory ( 3rdparty/gloox )
2011-02-19 19:24:11 +01:00
add_subdirectory ( 3rdparty/libxrme )
2011-03-08 17:34:20 +01:00
add_subdirectory ( 3rdparty/libportfwd )
2011-03-01 17:03:04 +01:00
include_directories ( 3rdparty )
include_directories ( 3rdparty/libxrme )
2011-03-08 17:34:20 +01:00
include_directories ( 3rdparty/libportfwd/include )
2011-11-28 16:12:23 +01:00
endif ( ENABLE_REMOTE AND HAVE_GNUTLS )
2011-01-06 17:00:40 +01:00
2010-06-30 21:55:46 +02:00
set ( HAVE_STATIC_SQLITE ${ STATIC_SQLITE } )
if ( STATIC_SQLITE )
message ( STATUS "Building static qsqlite plugin" )
add_subdirectory ( 3rdparty/qsqlite )
2010-12-18 19:19:18 +01:00
include_directories ( "3rdparty/qsqlite" )
2010-06-30 21:55:46 +02:00
endif ( STATIC_SQLITE )
2010-07-10 22:33:28 +02:00
# When/if upstream accepts our patches then these options can be used to link
# to system installed qtsingleapplication instead.
option ( USE_SYSTEM_QTSINGLEAPPLICATION "Don't set this option unless your system QtSingleApplication library has been compiled with the Clementine patches in 3rdparty" OFF )
if ( USE_SYSTEM_QTSINGLEAPPLICATION )
find_path ( QTSINGLEAPPLICATION_INCLUDE_DIRS qtsingleapplication.h PATH_SUFFIXES QtSolutions )
find_library ( QTSINGLEAPPLICATION_LIBRARIES QtSolutions_SingleApplication-2.6 )
2010-09-11 23:12:46 +02:00
find_library ( QTSINGLECOREAPPLICATION_LIBRARIES QtSolutions_SingleCoreApplication-2.6 )
2010-07-10 22:33:28 +02:00
else ( USE_SYSTEM_QTSINGLEAPPLICATION )
add_subdirectory ( 3rdparty/qtsingleapplication )
set ( QTSINGLEAPPLICATION_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/qtsingleapplication )
set ( QTSINGLEAPPLICATION_LIBRARIES qtsingleapplication )
endif ( USE_SYSTEM_QTSINGLEAPPLICATION )
2010-07-11 14:02:30 +02:00
# QtIoCompressor isn't patched, so we can use a system version if it's
# available
find_path ( QTIOCOMPRESSOR_INCLUDE_DIRS qtiocompressor.h PATH_SUFFIXES QtSolutions )
find_library ( QTIOCOMPRESSOR_LIBRARIES QtSolutions_IOCompressor-2.3 )
if ( NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES )
add_subdirectory ( 3rdparty/qtiocompressor )
set ( QTIOCOMPRESSOR_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/qtiocompressor )
set ( QTIOCOMPRESSOR_LIBRARIES qtiocompressor )
endif ( NOT QTIOCOMPRESSOR_INCLUDE_DIRS OR NOT QTIOCOMPRESSOR_LIBRARIES )
2010-07-10 22:33:28 +02:00
2010-07-24 14:35:21 +02:00
# When/if upstream accepts our or reimplement our patches then these options can be
# used to link to system installed qxt instead.
option ( USE_SYSTEM_QXT "Don't set this option unless your system Qxt library has been compiled with the Clementine patches in 3rdparty" OFF )
if ( USE_SYSTEM_QXT )
find_path ( QXTCORE_INCLUDE_DIRS qxtglobal.h PATH_SUFFIXES QxtCore )
find_path ( QXTGUI_INCLUDE_DIRS qxtglobalshortcut.h PATH_SUFFIXES QxtGui )
set ( QXT_INCLUDE_DIRS ${ QXTCORE_INCLUDE_DIRS } ${ QXTGUI_INCLUDE_DIRS } )
# We only need its header. We don't need to link to QxtCore.
find_library ( QXT_LIBRARIES QxtGui )
else ( USE_SYSTEM_QXT )
2010-07-24 14:46:48 +02:00
add_definitions ( -DQXT_STATIC -DBUILD_QXT_GUI -DBUILD_QXT_CORE )
2010-07-24 17:22:15 +02:00
set ( QXT_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/qxt )
set ( QXT_LIBRARIES qxt )
2010-07-24 14:35:21 +02:00
if ( NOT APPLE )
add_subdirectory ( 3rdparty/qxt )
endif ( NOT APPLE )
endif ( USE_SYSTEM_QXT )
2010-12-18 19:36:56 +01:00
# Use system libechonest if it's available
find_path ( ECHONEST_INCLUDE_DIRS echonest/echonest_export.h )
find_library ( ECHONEST_LIBRARIES echonest )
if ( NOT ECHONEST_INCLUDE_DIRS OR NOT ECHONEST_LIBRARIES )
add_subdirectory ( 3rdparty/libechonest )
set ( ECHONEST_INCLUDE_DIRS ${ CMAKE_BINARY_DIR } /3rdparty/libechonest )
set ( ECHONEST_LIBRARIES echonest )
endif ( NOT ECHONEST_INCLUDE_DIRS OR NOT ECHONEST_LIBRARIES )
2011-03-29 21:05:13 +02:00
# Use system gmock if it's available
# We need to look for both gmock and gtest
find_path ( GMOCK_INCLUDE_DIRS gmock/gmock.h )
find_library ( GMOCK_LIBRARIES gmock )
if ( GMOCK_INCLUDE_DIRS )
find_path ( GTEST_INCLUDE_DIRS gtest/gtest.h )
find_library ( GTEST_LIBRARIES gtest )
if ( GTEST_INCLUDE_DIRS )
set ( USE_SYSTEM_GMOCK 1 )
set ( GMOCK_LIBRARIES ${ GMOCK_LIBRARIES } ${ GTEST_LIBRARIES } )
endif ( GTEST_INCLUDE_DIRS )
endif ( GMOCK_INCLUDE_DIRS )
2010-10-02 18:23:33 +02:00
2012-01-17 23:01:01 +01:00
# Use system sha2 if it's available
find_path ( SHA2_INCLUDE_DIRS sha2.h )
find_library ( SHA2_LIBRARIES sha2 )
if ( NOT SHA2_INCLUDE_DIRS OR NOT SHA2_LIBRARIES )
add_subdirectory ( 3rdparty/sha2 )
set ( SHA2_INCLUDE_DIRS ${ CMAKE_CURRENT_SOURCE_DIR } /3rdparty/sha2 )
set ( SHA2_LIBRARIES sha2 )
endif ( NOT SHA2_INCLUDE_DIRS OR NOT SHA2_LIBRARIES )
2012-01-07 16:25:39 +01:00
# Use our 3rdparty chromaprint if a system one wasn't found
if ( NOT CHROMAPRINT_FOUND )
add_subdirectory ( 3rdparty/chromaprint )
set ( CHROMAPRINT_LIBRARIES chromaprint_p )
set ( CHROMAPRINT_INCLUDE_DIRS ${ CMAKE_SOURCE_DIR } /3rdparty/chromaprint/src )
2012-01-07 18:29:35 +01:00
if ( WIN32 )
add_definitions ( -DCHROMAPRINT_NODLL )
endif ( WIN32 )
2012-01-07 16:25:39 +01:00
endif ( NOT CHROMAPRINT_FOUND )
2010-07-11 14:02:30 +02:00
# Subdirectories
2010-02-28 18:28:56 +01:00
add_subdirectory ( src )
2010-09-25 16:55:36 +02:00
if ( WIN32 )
add_subdirectory ( 3rdparty/qtwin )
endif ( WIN32 )
2010-04-29 15:16:46 +02:00
add_subdirectory ( 3rdparty/universalchardet )
2010-03-01 02:47:50 +01:00
add_subdirectory ( tests )
2010-05-03 15:58:41 +02:00
add_subdirectory ( dist )
2010-09-26 16:21:23 +02:00
add_subdirectory ( tools/ultimate_lyrics_parser )
2012-01-06 00:22:51 +01:00
add_subdirectory ( ext/libclementine-common )
add_subdirectory ( ext/libclementine-tagreader )
add_subdirectory ( ext/clementine-tagreader )
2011-02-15 22:08:28 +01:00
2010-09-04 22:01:51 +02:00
option ( WITH_DEBIAN OFF )
if ( WITH_DEBIAN )
add_subdirectory ( debian )
endif ( WITH_DEBIAN )
2010-03-04 17:41:14 +01:00
2010-08-01 18:37:38 +02:00
if ( IMOBILEDEVICE_FOUND AND PLIST_FOUND )
2011-09-25 20:24:44 +02:00
add_subdirectory ( gst/afcsrc )
2010-08-01 18:37:38 +02:00
endif ( IMOBILEDEVICE_FOUND AND PLIST_FOUND )
2011-03-23 22:53:24 +01:00
if ( HAVE_BREAKPAD )
add_subdirectory ( 3rdparty/google-breakpad )
endif ( HAVE_BREAKPAD )
2011-04-25 21:16:26 +02:00
if ( HAVE_SPOTIFY )
2012-01-06 00:22:51 +01:00
add_subdirectory ( ext/libclementine-spotifyblob )
2011-04-25 21:16:26 +02:00
endif ( HAVE_SPOTIFY )
2011-04-29 21:44:51 +02:00
if ( HAVE_SPOTIFY_BLOB )
2012-01-06 00:22:51 +01:00
add_subdirectory ( ext/clementine-spotifyblob )
2011-04-29 21:44:51 +02:00
endif ( HAVE_SPOTIFY_BLOB )
2011-10-16 22:57:53 +02:00
# This goes after everything else because KDE fucks everything else up with its
# cmake includes.
find_package ( KDE4 4.3.60 )
2011-10-30 16:10:02 +01:00
if ( KDE4_PLASMA_LIBS AND ENABLE_PLASMARUNNER )
set ( HAVE_PLASMARUNNER ON )
endif ( KDE4_PLASMA_LIBS AND ENABLE_PLASMARUNNER )
if ( HAVE_PLASMARUNNER )
2011-10-16 22:57:53 +02:00
add_subdirectory ( plasmarunner )
2011-10-30 16:10:02 +01:00
endif ( HAVE_PLASMARUNNER )
2011-10-16 22:57:53 +02:00
2010-03-04 17:41:14 +01:00
# Uninstall support
2010-03-04 17:50:27 +01:00
configure_file (
2010-03-04 17:41:14 +01:00
" $ { 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 )
2010-03-04 17:50:27 +01:00
add_custom_target ( uninstall
2010-03-04 17:41:14 +01:00
" $ { C M A K E _ C O M M A N D } " - P " $ { 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 " )
2010-08-31 20:23:23 +02:00
# Show a summary of what we have enabled
2011-04-29 21:44:51 +02:00
summary_add ( "Crash reporting" HAVE_BREAKPAD )
2010-12-26 14:38:35 +01:00
summary_add ( "D-Bus support" HAVE_DBUS )
2011-08-10 17:23:32 +02:00
summary_add ( "Devices: Audio CD support" HAVE_AUDIOCD )
2011-04-29 21:44:51 +02:00
summary_add ( "Devices: DeviceKit backend" HAVE_DEVICEKIT )
summary_add ( "Devices: iPod classic support" HAVE_LIBGPOD )
summary_add ( "Devices: iPod Touch, iPhone, iPad support" HAVE_IMOBILEDEVICE )
summary_add ( "Devices: MTP support" HAVE_LIBMTP )
summary_add ( "Devices: GIO backend" HAVE_GIO )
2010-11-21 16:13:26 +01:00
summary_add ( "Gnome sound menu integration" HAVE_LIBINDICATE )
2010-12-18 18:28:02 +01:00
summary_add ( "Last.fm support" HAVE_LIBLASTFM )
2011-04-29 21:44:51 +02:00
summary_add ( "Spotify support: core code" HAVE_SPOTIFY )
summary_add ( "Spotify support: non-GPL binary helper" HAVE_SPOTIFY_BLOB )
summary_add ( "Visualisations" ENABLE_VISUALISATIONS )
summary_add ( "Wiimote support" HAVE_WIIMOTEDEV )
2011-10-30 16:10:02 +01:00
summary_add ( "(KDE) Plasma global search" HAVE_PLASMARUNNER )
2011-03-04 22:10:00 +01:00
summary_add ( "(Mac OS X) Sparkle integration" HAVE_SPARKLE )
summary_add ( "(unstable) Remote control support" HAVE_REMOTE )
2010-08-31 20:23:23 +02:00
summary_show ( )