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
# Needed to conditionally build tests and gui
30
if(CMAKE_BUILD_TYPE MATCHES debugfull)
31
   add_definitions(-DDEBUG)
32
endif(CMAKE_BUILD_TYPE MATCHES debugfull)
33
34
if( WITH_PLAYER )
35
#We depend on kde4.2 now.. I believe this is the easiest way to do it.
36
    set(KDE_MIN_VERSION "4.2.0")
37
    find_package( KDE4 REQUIRED )
38
    include (KDE4Defaults)
39
    include (MacroLibrary)
40
41
    include(MacroBoolTo01)
42
    include(MacroLogFeature)
43
44
    macro_log_feature( KDE4_FOUND "kdelibs" "The toolkit Amarok uses to build" "http://www.kde.org" TRUE "4.2.0" "" )
45
46
    find_package( QtScriptQtBindings REQUIRED )
47
    macro_log_feature( QTSCRIPTQTBINDINGS_FOUND "qtscript-qt" "QtScript Qt Bindings" "http://code.google.com/p/qtscriptgenerator/" TRUE "" "" )
48
49
    add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
50
51
    find_package(MySQLAmarok REQUIRED)
52
    macro_log_feature( MYSQL_EMBEDDED_FOUND "mysqld" "Embedded MySQL" "http://www.mysql.com" TRUE "" "" )
53
54
    # zlib is required for mysql embedded
55
    find_package(ZLIB REQUIRED)
56
    macro_log_feature( ZLIB_FOUND "zlib" "zlib" "" TRUE "" "" )
57
58
    macro_optional_find_package(Strigi)
59
    macro_log_feature( STRIGI_FOUND "strigi" "Index metadata of files" "http://strigi.sourceforge.net" TRUE "" "" )
60
61
    macro_optional_find_package(LibLastFm)
62
    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" "" )
63
    
64
    if (WITH_IPOD)
65
	FIND_PACKAGE(Ipod)
66
    else (WITH_IPOD)
67
	set(IPOD_FOUND)
68
	set(IPOD_INCLUDE_DIR)
69
	set(IPOD_INCLUDES)
70
	set(IPOD_LIBRARY)
71
	set(IPOD_LIBRARIES)
72
    endif (WITH_IPOD)
73
	    
74
    if(IPOD_FOUND)
75
	macro_ensure_version("0.7.0" ${IPOD_VERSION} IPOD_0_7)
76
    endif(IPOD_FOUND)
77
    macro_log_feature( IPOD_0_7 "libgpod" "Support Apple iPod audio devices" "http://sourceforge.net/projects/gtkpod/" FALSE "0.7.0" "" )
78
		
79
    if( WITH_Ipod )
80
	macro_optional_find_package(Gdk)
81
	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" "" )
82
    endif( WITH_Ipod )
83
 
84
    macro_optional_find_package(Mtp)
85
    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" "")
86
87
    if( WITH_MP3Tunes )
88
        find_package(CURL)
89
        macro_log_feature( CURL_FOUND "curl" "cURL provides the necessary network libraries required by mp3tunes." "http://curl.haxx.se" FALSE "" "" )
90
91
        find_package(LibXml2)
92
        macro_log_feature( LIBXML2_FOUND "libxml2" "LibXML2 is an XML parser required by mp3tunes." "http://www.xmlsoft.org" FALSE "" "" )
93
94
        macro_optional_find_package(OpenSSL)
95
        macro_optional_find_package(Libgcrypt)
96
        if ( OPENSSL_FOUND OR LIBGCRYPT_FOUND )
97
            set (_mp3tunes_crypto TRUE )
98
        else ( OPENSSL_FOUND OR LIBGCRYPT_FOUND )
99
            message( SEND_ERROR "Building with mp3tunes support REQUIRES either OpenSSL or GNU Libgcrypt" )
100
        endif ( OPENSSL_FOUND OR LIBGCRYPT_FOUND )
101
        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 "" "" )
102
103
        find_package(GObject)
104
        macro_log_feature( GOBJECT_FOUND "gobject" "Required by mp3tunes." "http://www.gtk.org" FALSE "2.x" "" )
105
106
        find_package(Loudmouth)
107
        macro_log_feature( LOUDMOUTH_FOUND "loudmouth" "Loudmouth is the communication backend needed by mp3tunes for syncing." "http://www.loudmouth-project.org" FALSE "" "" )
108
109
        include(CheckQtGlib)
110
        macro_log_feature(QT4_GLIB_SUPPORT "Qt4 Glib support" "Qt4 must be compiled with glib support for mp3tunes" "http://www.trolltech.com" FALSE "" "")
111
    endif( WITH_MP3Tunes )
112
113
    if( WITH_Ipod OR WITH_MP3Tunes )
114
	find_package(GLIB2)
115
	macro_log_feature( GLIB2_FOUND "glib2" "Required by libgpod and mp3tunes" "http://www.gtk.org" FALSE "2.x" "")
116
    endif( WITH_Ipod OR WITH_MP3Tunes )
117
118
    #These two are currently unused
119
    #macro_optional_find_package(Soprano)
120
    #macro_log_feature( Soprano_FOUND "soprano" "Soprano is a RDF framework required by Nepomuk Collection" "http://soprano.sourceforge.net" FALSE "2.1.0" "")
121
    #macro_optional_find_package(Nepomuk)
122
    #macro_log_feature( NEPOMUK_FOUND "nepomuk" "Nepomuk Libraries required by Nepomuk Collection (part of kdelibs)" "http://www.kde.org" FALSE "4.1" "")
123
124
    macro_bool_to_01(LIBVISUAL_FOUND HAVE_LIBVISUAL)
125
126
    include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${TAGLIB_INCLUDES})
127
128
if(CMAKE_BUILD_TYPE MATCHES debugfull)
129
    add_subdirectory( tests )
130
endif(CMAKE_BUILD_TYPE MATCHES debugfull)
131
132
    add_subdirectory( src )
133
134
    macro_display_feature_log()
135
136
    #Do not remove or modify these.  The release script substitutes in for these
137
    #comments with appropriate doc and translation directories.
138
    #PO_SUBDIR
139
    #DOC_SUBDIR
140
141
    add_executable( bindingstest cmake/modules/QtScriptBindingsTest.cpp )
142
    target_link_libraries( bindingstest ${QT_QTSCRIPT_LIBRARY} ${KDE4_KDEUI_LIBS} )
143
144
else( WITH_PLAYER )
145
146
    find_package( Qt4 REQUIRED )
147
    add_definitions(${QT_DEFINITIONS})
148
    include_directories (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${TAGLIB_INCLUDES})
149
150
endif( WITH_PLAYER )
151
152
if( WITH_UTILITIES )
153
    set(EXEC_INSTALL_PREFIX  ${CMAKE_INSTALL_PREFIX}       CACHE PATH  "Base directory for executables and libraries" FORCE)
154
    set(BIN_INSTALL_DIR          "${EXEC_INSTALL_PREFIX}/bin"    CACHE PATH "The subdirectory to the binaries prefix (default prefix/bin)" FORCE)
155
    add_subdirectory( utilities )
156
endif( WITH_UTILITIES )
157
158
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmessage-length=0")
159
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmessage-length=0")