| 1 |
project(Amarok) |
| 2 |
|
| 3 |
cmake_minimum_required(VERSION 2.6.2) |
| 4 |
|
| 5 |
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ) |
| 6 |
|
| 7 |
option(WITH_UTILITIES "Enable building of utilities" ON) |
| 8 |
option(WITH_PLAYER "Enable building of main Amarok player" ON) |
| 9 |
option(WITH_MP3Tunes "Enable mp3tunes in the Amarok player, requires multiple extra dependencies" ON) |
| 10 |
option(WITH_IPOD "Enable iPod support in Amarok" ON) |
| 11 |
option(WITH_MYSQL_EMBEDDED "Build the embedded database library -- highly recommended" ON) |
| 12 |
|
| 13 |
include(CheckLibraryExists) |
| 14 |
check_library_exists(dl dlopen "" LIBDL_FOUND) |
| 15 |
|
| 16 |
set(TAGLIB_MIN_VERSION "1.6") |
| 17 |
find_package(Taglib REQUIRED) |
| 18 |
|
| 19 |
# Check if TagLib is built with ASF and MP4 support |
| 20 |
include(CheckCXXSourceCompiles) |
| 21 |
set(CMAKE_REQUIRED_INCLUDES "${TAGLIB_INCLUDES}") |
| 22 |
set(CMAKE_REQUIRED_LIBRARIES "${TAGLIB_LIBRARIES}") |
| 23 |
|
| 24 |
check_cxx_source_compiles("#include <asftag.h> |
| 25 |
int main() { TagLib::ASF::Tag tag; return 0;}" TAGLIB_ASF_FOUND) |
| 26 |
if( NOT TAGLIB_ASF_FOUND ) |
| 27 |
message(FATAL_ERROR "TagLib does not have ASF support compiled in.") |
| 28 |
endif( NOT TAGLIB_ASF_FOUND ) |
| 29 |
|
| 30 |
check_cxx_source_compiles("#include <mp4tag.h> |
| 31 |
int main() { TagLib::MP4::Tag tag(0, 0); return 0;}" TAGLIB_MP4_FOUND) |
| 32 |
if( NOT TAGLIB_MP4_FOUND ) |
| 33 |
message(FATAL_ERROR "TagLib does not have MP4 support compiled in.") |
| 34 |
endif( NOT TAGLIB_MP4_FOUND ) |
| 35 |
|
| 36 |
set(CMAKE_REQUIRED_INCLUDES) |
| 37 |
set(CMAKE_REQUIRED_LIBRARIES) |
| 38 |
|
| 39 |
set(TAGLIB-EXTRAS_MIN_VERSION "1.0") |
| 40 |
find_package(Taglib-Extras REQUIRED) |
| 41 |
|
| 42 |
include(CheckTagLibFileName) |
| 43 |
|
| 44 |
check_taglib_filename(COMPLEX_TAGLIB_FILENAME) |
| 45 |
|
| 46 |
# Figure out problems inside KAboutData before re-enabling |
| 47 |
#execute_process( COMMAND "git" "describe" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE GIT_OUTPUT_VALUE OUTPUT_VARIABLE CURRENT_GIT_VERSION ) |
| 48 |
#if(GIT_OUTPUT_VALUE EQUAL 0) |
| 49 |
# message(STATUS "Building git version ${CURRENT_GIT_VERSION}") |
| 50 |
#endif(GIT_OUTPUT_VALUE EQUAL 0) |
| 51 |
|
| 52 |
|
| 53 |
# Needed to conditionally build tests and gui |
| 54 |
if(KDE4_BUILD_TESTS) |
| 55 |
add_definitions(-DDEBUG) |
| 56 |
endif() |
| 57 |
|
| 58 |
if(WITH_DESKTOP_UI) |
| 59 |
add_definitions(-DDESKTOP_UI) |
| 60 |
endif() |
| 61 |
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0") |
| 62 |
if (CMAKE_COMPILER_IS_GNUCXX) |
| 63 |
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0") |
| 64 |
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
| 65 |
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--as-needed") |
| 66 |
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
| 67 |
endif (CMAKE_COMPILER_IS_GNUCXX) |
| 68 |
|
| 69 |
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/shared ) |
| 70 |
|
| 71 |
if( WITH_PLAYER ) |
| 72 |
set(KDE_MIN_VERSION "4.3.0") |
| 73 |
find_package( KDE4 REQUIRED ) |
| 74 |
include (KDE4Defaults) |
| 75 |
include (MacroLibrary) |
| 76 |
|
| 77 |
include(MacroBoolTo01) |
| 78 |
include(MacroLogFeature) |
| 79 |
|
| 80 |
macro_log_feature( KDE4_FOUND "kdelibs" "The toolkit Amarok uses to build" "http://www.kde.org" TRUE "4.3.0" "" ) |
| 81 |
|
| 82 |
find_package( QtScriptQtBindings REQUIRED ) |
| 83 |
macro_log_feature( QTSCRIPTQTBINDINGS_FOUND "qtscript-qt" "QtScript Qt Bindings" "http://code.google.com/p/qtscriptgenerator/" TRUE "" "" ) |
| 84 |
|
| 85 |
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) |
| 86 |
|
| 87 |
find_package(MySQLAmarok REQUIRED) |
| 88 |
if( WITH_MYSQL_EMBEDDED ) |
| 89 |
set( BUILD_MYSQLE_COLLECTION TRUE ) |
| 90 |
macro_log_feature( MYSQL_EMBEDDED_FOUND "mysqld" "Embedded MySQL Libraries" "http://www.mysql.com" TRUE "" "" ) |
| 91 |
else( WITH_MYSQL_EMBEDDED ) |
| 92 |
add_definitions( "-DNO_MYSQL_EMBEDDED" ) |
| 93 |
endif( WITH_MYSQL_EMBEDDED ) |
| 94 |
macro_log_feature( MYSQL_FOUND "mysql" "MySQL Server Libraries" "http://www.mysql.com" TRUE "" "" ) |
| 95 |
|
| 96 |
# zlib is required for mysql embedded |
| 97 |
find_package(ZLIB REQUIRED) |
| 98 |
macro_log_feature( ZLIB_FOUND "zlib" "zlib" "" TRUE "" "" ) |
| 99 |
|
| 100 |
# QCA2 is required for the Script Updater |
| 101 |
find_package(QCA2 REQUIRED) |
| 102 |
macro_log_feature( QCA2_FOUND "qca2" "Qt Cryptographic Architecture" "http://delta.affinix.com/qca/" TRUE "" "" ) |
| 103 |
|
| 104 |
macro_optional_find_package(Strigi) |
| 105 |
macro_log_feature( STRIGI_FOUND "strigi" "Index metadata of files" "http://strigi.sourceforge.net" TRUE "" "" ) |
| 106 |
|
| 107 |
macro_optional_find_package(LibLastFm) |
| 108 |
macro_log_feature( LIBLASTFM_FOUND "liblastfm" "Enable Last.Fm service, including scrobbling, song submissions, and suggested song dynamic playlists" "http://cdn.last.fm/src/liblastfm-0.3.0.tar.bz2" FALSE "0.3" "" ) |
| 109 |
macro_bool_to_01( LIBLASTFM_FOUND HAVE_LIBLASTFM ) |
| 110 |
|
| 111 |
|
| 112 |
if( WITH_IPOD ) |
| 113 |
find_package(Ipod) |
| 114 |
if( IPOD_FOUND AND NOT WIN32 ) |
| 115 |
macro_ensure_version("0.7.0" ${IPOD_VERSION} IPOD_FOUND) |
| 116 |
endif( IPOD_FOUND AND NOT WIN32 ) |
| 117 |
macro_log_feature( IPOD_FOUND "libgpod" "Support Apple iPod audio devices" "http://sourceforge.net/projects/gtkpod/" FALSE "0.7.0" "" ) |
| 118 |
macro_optional_find_package(Gdk) |
| 119 |
macro_log_feature( GDK_FOUND "Gdk" "Support for artwork on iPod audio devices via GdkPixbuf" "http://developer.gnome.org/arch/imaging/gdkpixbuf.html" FALSE "2.0.x" "" ) |
| 120 |
endif( WITH_IPOD ) |
| 121 |
|
| 122 |
macro_optional_find_package(Mtp) |
| 123 |
macro_log_feature( MTP_FOUND "libmtp" "Enable Support for portable media devices that use the media transfer protocol" "http://libmtp.sourceforge.net/" FALSE "1.0.0" "") |
| 124 |
|
| 125 |
if( WITH_MP3Tunes ) |
| 126 |
find_package(CURL) |
| 127 |
macro_log_feature( CURL_FOUND "curl" "cURL provides the necessary network libraries required by mp3tunes." "http://curl.haxx.se" FALSE "" "" ) |
| 128 |
|
| 129 |
find_package(LibXml2) |
| 130 |
macro_log_feature( LIBXML2_FOUND "libxml2" "LibXML2 is an XML parser required by mp3tunes." "http://www.xmlsoft.org" FALSE "" "" ) |
| 131 |
|
| 132 |
macro_optional_find_package(OpenSSL) |
| 133 |
macro_optional_find_package(Libgcrypt) |
| 134 |
if ( OPENSSL_FOUND OR LIBGCRYPT_FOUND ) |
| 135 |
set (_mp3tunes_crypto TRUE ) |
| 136 |
else ( OPENSSL_FOUND OR LIBGCRYPT_FOUND ) |
| 137 |
message( SEND_ERROR "Building with mp3tunes support REQUIRES either OpenSSL or GNU Libgcrypt" ) |
| 138 |
endif ( OPENSSL_FOUND OR LIBGCRYPT_FOUND ) |
| 139 |
macro_log_feature( _mp3tunes_crypto "openssl or libgcrypt" "OpenSSL or GNU Libgcrypt provides cryptographic functions required by mp3tunes." "http://www.openssl.org/ or http://www.gnupg.org/download/#libgcrypt" FALSE "" "" ) |
| 140 |
|
| 141 |
find_package(Loudmouth) |
| 142 |
macro_log_feature( LOUDMOUTH_FOUND "loudmouth" "Loudmouth is the communication backend needed by mp3tunes for syncing." "http://www.loudmouth-project.org" FALSE "" "" ) |
| 143 |
|
| 144 |
include(CheckQtGlib) |
| 145 |
macro_log_feature(QT4_GLIB_SUPPORT "Qt4 Glib support" "Qt4 must be compiled with glib support for mp3tunes" "http://www.trolltech.com" FALSE "" "") |
| 146 |
endif( WITH_MP3Tunes ) |
| 147 |
|
| 148 |
if( WITH_IPOD OR WITH_MP3Tunes ) |
| 149 |
find_package(GObject) |
| 150 |
macro_log_feature( GOBJECT_FOUND "gobject" "Required by libgpod and mp3tunes." "http://www.gtk.org" FALSE "2.x" "" ) |
| 151 |
find_package(GLIB2) |
| 152 |
macro_log_feature( GLIB2_FOUND "glib2" "Required by libgpod and mp3tunes" "http://www.gtk.org" FALSE "2.x" "") |
| 153 |
endif( WITH_IPOD OR WITH_MP3Tunes ) |
| 154 |
|
| 155 |
#These two are currently unused |
| 156 |
#macro_optional_find_package(Soprano) |
| 157 |
#macro_log_feature( Soprano_FOUND "soprano" "Soprano is a RDF framework required by Nepomuk Collection" "http://soprano.sourceforge.net" FALSE "2.1.0" "") |
| 158 |
#macro_optional_find_package(Nepomuk) |
| 159 |
#macro_log_feature( NEPOMUK_FOUND "nepomuk" "Nepomuk Libraries required by Nepomuk Collection (part of kdelibs)" "http://www.kde.org" FALSE "4.1" "") |
| 160 |
|
| 161 |
macro_bool_to_01(LIBVISUAL_FOUND HAVE_LIBVISUAL) |
| 162 |
|
| 163 |
macro_ensure_version("4.3.80" ${KDE_VERSION} KSTATUSNOTIFIERITEM_FOUND) |
| 164 |
macro_bool_to_01(KSTATUSNOTIFIERITEM_FOUND HAVE_KSTATUSNOTIFIERITEM) |
| 165 |
|
| 166 |
string( TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_TOLOWER ) |
| 167 |
if( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug ) |
| 168 |
set( DEBUG_BUILD_TYPE ON ) |
| 169 |
endif( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug ) |
| 170 |
|
| 171 |
configure_file(config-amarok.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-amarok.h ) |
| 172 |
|
| 173 |
include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${TAGLIB_INCLUDES}) |
| 174 |
|
| 175 |
if( KDE4_BUILD_TESTS AND NOT WIN32 ) |
| 176 |
ENABLE_TESTING() |
| 177 |
add_subdirectory( tests ) |
| 178 |
endif( KDE4_BUILD_TESTS AND NOT WIN32 ) |
| 179 |
|
| 180 |
add_subdirectory( src ) |
| 181 |
|
| 182 |
macro_display_feature_log() |
| 183 |
|
| 184 |
#Do not remove or modify these. The release script substitutes in for these |
| 185 |
#comments with appropriate doc and translation directories. |
| 186 |
#PO_SUBDIR |
| 187 |
#DOC_SUBDIR |
| 188 |
|
| 189 |
else( WITH_PLAYER ) |
| 190 |
|
| 191 |
find_package( Qt4 REQUIRED ) |
| 192 |
set( CMAKE_INCLUDE_CURRENT_DIR ON ) |
| 193 |
add_definitions(${QT_DEFINITIONS}) |
| 194 |
include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${TAGLIB_INCLUDES}) |
| 195 |
|
| 196 |
endif( WITH_PLAYER ) |
| 197 |
|
| 198 |
if( WITH_UTILITIES ) |
| 199 |
set(EXEC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Base directory for executables and libraries" FORCE) |
| 200 |
set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The subdirectory to the binaries prefix (default prefix/bin)" FORCE) |
| 201 |
add_subdirectory( utilities ) |
| 202 |
endif( WITH_UTILITIES ) |
| 203 |
|
| 204 |
include(CTest) |