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