[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amarok
Subject:    [PATCH] Making lastfm optional
From:       Maciej Mrozowski <reavertm () gmail ! com>
Date:       2009-11-16 5:00:49
Message-ID: 200911160600.49956.reavertm () gmail ! com
[Download RAW message or body]

Changes:
- s/define/cmakedefine/ in config-amarok.h.cmake to conditionally set 
HAVE_LIBLASTFM
- move configure_file at the end to generate properly all HAVE_ definitions
- guard LASTFM related cmake variables - add proper target_link_libraries and 
include_directories only when LIBLASTFM_FOUND (fixes some cmake warnings)
- if editing this file already, make indentation more consistent in 
src/services/ampache/CMakeLists.txt

-- 
regards
MM

["0001-Make-liblastfm-optional.patch" (text/x-patch)]

From af8707f08598a28ff97408397f8ed6f6101614ba Mon Sep 17 00:00:00 2001
From: Maciej Mrozowski (reavertm) <reavertm@poczta.fm>
Date: Mon, 16 Nov 2009 05:26:14 +0100
Subject: [PATCH] Make liblastfm optional:
 - s/define/cmakedefine in config-amarok.h.cmake
 - move configure_file at the end to pick all HAVE_ definitions
 - guard LASTFM related cmake variables with if (LIBFASTFM_FOUND)

---
 .gitignore                          |    1 +
 config-amarok.h.cmake               |    2 +-
 src/CMakeLists.txt                  |   11 +++-
 src/meta/file/File.cpp              |    2 +-
 src/services/CMakeLists.txt         |    2 +-
 src/services/ampache/CMakeLists.txt |  100 +++++++++++++++++-----------------
 6 files changed, 62 insertions(+), 56 deletions(-)

diff --git a/.gitignore b/.gitignore
index 266d0c7..4854d08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ CMakeLists.txt.user
 *.patch
 Doxyfile
 .*
+build
diff --git a/config-amarok.h.cmake b/config-amarok.h.cmake
index f780ea8..bb9b853 100644
--- a/config-amarok.h.cmake
+++ b/config-amarok.h.cmake
@@ -37,4 +37,4 @@
 #cmakedefine CURRENT_GIT_VERSION ${CURRENT_GIT_VERSION}
 
 /* If liblastfm is found */
-#define HAVE_LIBLASTFM 1
+#cmakedefine HAVE_LIBLASTFM 1
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3efc993..12347de 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -70,14 +70,16 @@ include_directories(
     ${QT_INCLUDES}
     ${QT_QTSCRIPT_INCLUDE_DIR}
     ${QCA2_INCLUDE_DIR}
-    ${LIBLASTFM_INCLUDE_DIR}/..
-    ${LIBLASTFM_INCLUDE_DIR}
 )
 
 if ( KDEMULTIMEDIA_FOUND )
     include_directories( ${KDEMULTIMEDIA_INCLUDE_DIR} )
 endif ( KDEMULTIMEDIA_FOUND )
 
+if ( LIBLASTFM_FOUND )
+    include_directories( ${LIBLASTFM_INCLUDE_DIR} )
+endif ( LIBLASTFM_FOUND )
+
 #####################################################################
 # PLUGIN
 #####################################################################
@@ -732,7 +734,6 @@ target_link_libraries(amaroklib
     ${KDE4_PHONON_LIBRARY}
     ${KDE4_PLASMA_LIBS}
     ${KDE4_SOLID_LIBRARY}
-    ${LIBLASTFM_LIBRARY}
     ${TAGLIB_LIBRARIES}
     ${TAGLIB-EXTRAS_LIBRARIES}
     ${QT_QTSCRIPT_LIBRARY}
@@ -771,6 +772,10 @@ if(LIBDL_FOUND)
     target_link_libraries(amaroklib dl)
 endif(LIBDL_FOUND)
 
+if(LIBLASTFM_FOUND)
+    target_link_libraries(amaroklib ${LIBLASTFM_LIBRARY})
+endif(LIBLASTFM_FOUND)
+
 if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME MATCHES Linux)
     set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=iso9899:1999" )
 endif(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME MATCHES Linux)
diff --git a/src/meta/file/File.cpp b/src/meta/file/File.cpp
index 49bdf9d..3de015b 100644
--- a/src/meta/file/File.cpp
+++ b/src/meta/file/File.cpp
@@ -36,7 +36,7 @@
 #include <QPointer>
 #include <QString>
 
-#ifdef HAVE_LIBLASTFM
+#if HAVE_LIBLASTFM
   #include "LastfmReadLabelCapability.h"
 #endif
 using namespace MetaFile;
diff --git a/src/services/CMakeLists.txt b/src/services/CMakeLists.txt
index a9a7679..3243b78 100644
--- a/src/services/CMakeLists.txt
+++ b/src/services/CMakeLists.txt
@@ -5,6 +5,6 @@ add_subdirectory( jamendo )
 add_subdirectory( mp3tunes )
 add_subdirectory( ampache )
 if( LIBLASTFM_FOUND )
-	add_subdirectory( lastfm )
+    add_subdirectory( lastfm )
 endif( LIBLASTFM_FOUND )
 add_subdirectory( opmldirectory )
diff --git a/src/services/ampache/CMakeLists.txt \
b/src/services/ampache/CMakeLists.txt index 3c2c2ae..36880ba 100644
--- a/src/services/ampache/CMakeLists.txt
+++ b/src/services/ampache/CMakeLists.txt
@@ -1,65 +1,65 @@
-        include_directories(
-            ../
-            ../../
-            ../../plugin
-            ../../meta
-            ../../collection
-            ../../servicebrowser
-            ../../statusbar
-            ${CMAKE_CURRENT_BINARY_DIR}/../../..
-            ${KDE4_INCLUDE_DIR}
-            ${STRIGI_INCLUDE_DIR}
-            ${QT_INCLUDES}
-            ${LIBLASTFM_INCLUDE_DIR}/..
-            ${LIBLASTFM_INCLUDE_DIR}
-            )
+include_directories(
+    ../
+    ../../
+    ../../plugin
+    ../../meta
+    ../../collection
+    ../../servicebrowser
+    ../../statusbar
+    ${CMAKE_CURRENT_BINARY_DIR}/../../..
+    ${KDE4_INCLUDE_DIR}
+    ${STRIGI_INCLUDE_DIR}
+    ${QT_INCLUDES}
+)
 
 add_subdirectory( images )
 
 ########### next target ###############
 
-        set(amarok_service_ampache_PART_SRCS
-            AmpacheService.cpp
-            AmpacheServiceCollection.cpp
-            AmpacheServiceQueryMaker.cpp
-            AmpacheMeta.cpp
-            AmpacheConfig.cpp
-            LastfmInfoParser.cpp
-            sha256/sha256.cpp
-        )
-
-
-
-        kde4_add_plugin(amarok_service_ampache ${amarok_service_ampache_PART_SRCS})
-        target_link_libraries(amarok_service_ampache
-            amaroklib
-            ${KDE4_KDECORE_LIBS}
-            ${KDE4_KDEUI_LIBS}
-            ${KDE4_KIO_LIBS}
-            ${KDE4_THREADWEAVER_LIBRARIES}
-            ${LIBLASTFM_LIBRARY}
-        )
-
-
-        install(TARGETS amarok_service_ampache DESTINATION ${PLUGIN_INSTALL_DIR} )
-
+set(amarok_service_ampache_PART_SRCS
+    AmpacheService.cpp
+    AmpacheServiceCollection.cpp
+    AmpacheServiceQueryMaker.cpp
+    AmpacheMeta.cpp
+    AmpacheConfig.cpp
+    sha256/sha256.cpp
+)
+
+if( LIBLASTFM_FOUND )
+    set(amarok_service_ampache_PART_SRCS
+        ${amarok_service_ampache_PART_SRCS}
+        LastfmInfoParser.cpp
+    )
+endif( LIBLASTFM_FOUND )
+
+kde4_add_plugin(amarok_service_ampache ${amarok_service_ampache_PART_SRCS})
+target_link_libraries(amarok_service_ampache
+    amaroklib
+    ${KDE4_KDECORE_LIBS}
+    ${KDE4_KDEUI_LIBS}
+    ${KDE4_KIO_LIBS}
+    ${KDE4_THREADWEAVER_LIBRARIES}
+)
+
+if( LIBLASTFM_FOUND )
+    target_link_libraries(amarok_service_ampache ${LIBLASTFM_LIBRARY})
+endif( LIBLASTFM_FOUND )
+
+install(TARGETS amarok_service_ampache DESTINATION ${PLUGIN_INSTALL_DIR} )
 
 ########### next target ###############
 
-        set(kcm_amarok_service_ampache_PART_SRCSS AmpacheSettings.cpp \
                AmpacheConfig.cpp )
-
-        kde4_add_ui_files( kcm_amarok_service_ampache_PART_SRCSS \
                AmpacheConfigWidget.ui )
-
-
-        kde4_add_plugin( kcm_amarok_service_ampache \
${kcm_amarok_service_ampache_PART_SRCSS} ) +set(kcm_amarok_service_ampache_PART_SRCSS \
AmpacheSettings.cpp AmpacheConfig.cpp )  
+kde4_add_ui_files( kcm_amarok_service_ampache_PART_SRCSS AmpacheConfigWidget.ui )
 
-        target_link_libraries( kcm_amarok_service_ampache  ${KDE4_KUTILS_LIBS} \
${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBRARY} ${KDE4_KDEUI_LIBS} ) \
+kde4_add_plugin( kcm_amarok_service_ampache ${kcm_amarok_service_ampache_PART_SRCSS} \
)  
-        install(TARGETS kcm_amarok_service_ampache  DESTINATION \
${PLUGIN_INSTALL_DIR}) +target_link_libraries( kcm_amarok_service_ampache \
${KDE4_KUTILS_LIBS} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBRARY} \
${KDE4_KDEUI_LIBS} )  
+install(TARGETS kcm_amarok_service_ampache DESTINATION ${PLUGIN_INSTALL_DIR})
 
 ########### install files ###############
 
-        install( FILES amarok_service_ampache.desktop DESTINATION \
                ${SERVICES_INSTALL_DIR})
-        install( FILES amarok_service_ampache_config.desktop DESTINATION \
${SERVICES_INSTALL_DIR}) +install( FILES amarok_service_ampache.desktop DESTINATION \
${SERVICES_INSTALL_DIR}) +install( FILES amarok_service_ampache_config.desktop \
                DESTINATION ${SERVICES_INSTALL_DIR})
-- 
1.6.4.4



_______________________________________________
Amarok mailing list
Amarok@kde.org
https://mail.kde.org/mailman/listinfo/amarok


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic