1
project(Amarok)
2
3
cmake_minimum_required(VERSION 2.6.2)
4
5
set( CMAKE_MODULE_PATH    ${CMAKE_MODULE_PATH}
6
                          ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules )
7
8
option(WITH_UTILITIES "Enable building of utilities" ON)
9
option(WITH_PLAYER "Enable building of main Amarok player" ON)
10
option(WITH_MP3Tunes "Enable mp3tunes in the Amarok player, requires multiple extra dependencies" ON)
11
12
include(CheckLibraryExists)
13
check_library_exists(dl dlopen "" LIBDL_FOUND)
14
15
set(TAGLIB_MIN_VERSION "1.5")
16
find_package(Taglib REQUIRED)
17
18
find_package(Taglib-Extras 0.1 REQUIRED)
19
if( TAGLIB-EXTRAS_FOUND )
20
    add_definitions( -DTAGLIB_EXTRAS_FOUND )
21
endif( TAGLIB-EXTRAS_FOUND )
22
23
include(CheckTagLibFileName)
24
25
check_taglib_filename(COMPLEX_TAGLIB_FILENAME)
26
27
configure_file(config-amarok.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-amarok.h )
28
29
if( WITH_PLAYER )
30
#We depend on kde4.2 now.. I believe this is the easiest way to do it.
31
    set(KDE_MIN_VERSION "4.2.0")
32
    find_package( KDE4 REQUIRED )
33
    include (KDE4Defaults)
34
    include (MacroLibrary)
35
36
    include(MacroBoolTo01)
37
    include(MacroLogFeature)
38
39
    macro_log_feature( KDE4_FOUND "kdelibs" "The toolkit Amarok uses to build" "http://www.kde.org" TRUE "4.2.0" "" )
40
41
    find_package( QtScriptQtBindings REQUIRED )
42
    macro_log_feature( QTSCRIPTQTBINDINGS_FOUND "qtscript-qt" "QtScript Qt Bindings" "http://code.google.com/p/qtscriptgenerator/" TRUE "" "" )
43
44
    add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
45
46
    find_package(MySQLAmarok REQUIRED)
47
    macro_log_feature( MYSQL_EMBEDDED_FOUND "mysqld" "Embedded MySQL" "http://www.mysql.com" TRUE "" "" )
48
49
    # zlib is required for mysql embedded
50
    find_package(ZLIB REQUIRED)
51
    macro_log_feature( ZLIB_FOUND "zlib" "zlib" "" TRUE "" "" )
52
53
    macro_optional_find_package(Strigi)
54
    macro_log_feature( STRIGI_FOUND "strigi" "Index metadata of files" "http://strigi.sourceforge.net" TRUE "" "" )
55
56
    macro_optional_find_package(LibLastFm)
57
    if(LIBLASTFM_FOUND)
58
        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" "" )
59
    endif(LIBLASTFM_FOUND)
60
    
61
    macro_optional_find_package(Ipod)
62
    if(IPOD_FOUND)
63
        macro_ensure_version("0.7.0" ${IPOD_VERSION} IPOD_0_7)
64
    endif(IPOD_FOUND)
65
    macro_log_feature( IPOD_0_7 "libgpod" "Support Apple iPod audio devices" "http://sourceforge.net/projects/gtkpod/" FALSE "0.7.0" "" )
66
 
67
    if( WITH_Ipod )
68
        macro_optional_find_package(Gdk)
69
        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" "" )
70
    endif( WITH_Ipod )
71
72
    macro_optional_find_package(Mtp)
73
    macro_log_feature( MTP_FOUND "libmtp" "Enable Support for portable media devices that use the media transfer protocol" "http://libmtp.sourceforge.net/" FALSE "0.3.0" "")
74
75
    if( WITH_MP3Tunes )
76
        find_package(CURL)
77
        macro_log_feature( CURL_FOUND "curl" "cURL provides the necessary network libraries required by mp3tunes." "http://curl.haxx.se" FALSE "" "" )
78
79
        find_package(LibXml2)
80
        macro_log_feature( LIBXML2_FOUND "libxml2" "LibXML2 is an XML parser required by mp3tunes." "http://www.xmlsoft.org" FALSE "" "" )
81
82
        macro_optional_find_package(OpenSSL)
83
        macro_optional_find_package(Libgcrypt)
84
        if ( OPENSSL_FOUND OR LIBGCRYPT_FOUND )
85
            set (_mp3tunes_crypto TRUE )
86
        else ( OPENSSL_FOUND OR LIBGCRYPT_FOUND )
87
            message( SEND_ERROR "Building with mp3tunes support REQUIRES either OpenSSL or GNU Libgcrypt" )
88
        endif ( OPENSSL_FOUND OR LIBGCRYPT_FOUND )
89
        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 "" "" )
90
91
        find_package(GObject)
92
        macro_log_feature( GOBJECT_FOUND "gobject" "Required by mp3tunes." "http://www.gtk.org" FALSE "2.x" "" )
93
94
        find_package(Loudmouth)
95
        macro_log_feature( LOUDMOUTH_FOUND "loudmouth" "Loudmouth is the communication backend needed by mp3tunes for syncing." "http://www.loudmouth-project.org" FALSE "" "" )
96
97
        include(CheckQtGlib)
98
        macro_log_feature(QT4_GLIB_SUPPORT "Qt4 Glib support" "Qt4 must be compiled with glib support for mp3tunes" "http://www.trolltech.com" FALSE "" "")
99
    endif( WITH_MP3Tunes )
100
101
    if( WITH_Ipod OR WITH_MP3Tunes )
102
        find_package(GLIB2)
103
        macro_log_feature( GLIB2_FOUND "glib2" "Required by libgpod and mp3tunes" "http://www.gtk.org" FALSE "2.x" "")
104
    endif( WITH_Ipod OR WITH_MP3Tunes )
105
106
    #These two are currently unused
107
    #macro_optional_find_package(Soprano)
108
    #macro_log_feature( Soprano_FOUND "soprano" "Soprano is a RDF framework required by Nepomuk Collection" "http://soprano.sourceforge.net" FALSE "2.1.0" "")
109
    #macro_optional_find_package(Nepomuk)
110
    #macro_log_feature( NEPOMUK_FOUND "nepomuk" "Nepomuk Libraries required by Nepomuk Collection (part of kdelibs)" "http://www.kde.org" FALSE "4.1" "")
111
112
    macro_bool_to_01(LIBVISUAL_FOUND HAVE_LIBVISUAL)
113
114
    include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${TAGLIB_INCLUDES})
115
116
    add_subdirectory( src )
117
    add_subdirectory( tests )
118
119
    macro_display_feature_log()
120
121
    #Do not remove or modify these.  The release script substitutes in for these
122
    #comments with appropriate doc and translation directories.
123
    #PO_SUBDIR
124
    #DOC_SUBDIR
125
126
    add_executable( bindingstest cmake/modules/QtScriptBindingsTest.cpp )
127
    target_link_libraries( bindingstest ${QT_QTSCRIPT_LIBRARY} ${KDE4_KDEUI_LIBS} )
128
129
else( WITH_PLAYER )
130
131
    find_package( Qt4 REQUIRED )
132
    add_definitions(${QT_DEFINITIONS})
133
    include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${TAGLIB_INCLUDES})
134
135
endif( WITH_PLAYER )
136
137
if( WITH_UTILITIES )
138
    set(EXEC_INSTALL_PREFIX  ${CMAKE_INSTALL_PREFIX}       CACHE PATH  "Base directory for executables and libraries" FORCE)
139
    set(BIN_INSTALL_DIR          "${EXEC_INSTALL_PREFIX}/bin"    CACHE PATH "The subdirectory to the binaries prefix (default prefix/bin)" FORCE)
140
    add_subdirectory( utilities )
141
endif( WITH_UTILITIES )
142
143
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
144
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")