branches/KDE/4.4/kdebase/runtime/phonon

Maciej Mrozowski reavertm at gmail.com
Wed Mar 17 04:24:33 CET 2010


SVN commit 1104235 by mmrozowski:

(More) gracefully handle building runtime/phonon without alsa:
- move version checks to phonon toplevel directory (there were two copies, one commented out)
- guard linking with ALSA_FOUND
- move include_directories to phonon toplevel dir (used in multiple places)
- make building tests optional (they require OpenGL)

Still there's chicken-egg problem caused by FindAlsa.cmake, (macro_optional_find_package cannot be used because of alsa_configure_file invocation)

CCMAIL: kde-buildsystem at kde.org

 M  +26 -8     CMakeLists.txt  
 M  +8 -17     kded-module/CMakeLists.txt  
 M  +1 -15     libkaudiodevicelist/CMakeLists.txt  
 M  +17 -10    platform_kde/CMakeLists.txt  


--- branches/KDE/4.4/kdebase/runtime/phonon/CMakeLists.txt #1104234:1104235
@@ -4,7 +4,7 @@
 #
 
 include(UsePkgConfig)
-OPTION(KDE4_DISABLE_MULTIMEDIA "Disable multimedia support (default: off)" OFF)
+option(KDE4_DISABLE_MULTIMEDIA "Disable multimedia support (default: off)" OFF)
 
 if(KDE4_DISABLE_MULTIMEDIA)
    message(STATUS "NOTICE: Multimedia support DISABLED (KDE4_DISABLE_MULTIMEDIA == ON)")
@@ -13,16 +13,34 @@
    macro_ensure_version("${PHONON_MIN_VERSION}" "${PHONON_VERSION}" _phonon_version_ok)
    macro_log_feature(_phonon_version_ok "Phonon" "Phonon library" "svn.kde.org/home/kde/trunk/kdesupport/phonon" TRUE "${PHONON_MIN_VERSION}" "STRONGLY RECOMMENDED: Required for playing audio and video throughout KDE")
 
-   FIND_PACKAGE(Alsa)
-   ALSA_CONFIGURE_FILE(${CMAKE_CURRENT_BINARY_DIR}/config-alsa.h)
+   find_package(Alsa)
+   option(WITH_ALSA "Use ALSA, if found" ON)
+   if(NOT WITH_ALSA)
+      set(ALSA_FOUND FALSE)
+      set(ASOUND_LIBRARY NOTFOUND)
+      set(HAVE_LIBASOUND2 FALSE)
+      set(ALSA_INCLUDES NOTFOUND)
+   endif(NOT WITH_ALSA)
 
-   if(NOT ALSA_FOUND)
-      set(ALSA_INCLUDES "")
-      set(ASOUND_LIBRARY "")
-   endif(NOT ALSA_FOUND)
+   alsa_configure_file(${CMAKE_CURRENT_BINARY_DIR}/config-alsa.h)
 
+   set(HAVE_CURRENT_ALSA FALSE)
+   if(ALSA_FOUND)
+      include_directories(${ALSA_INCLUDES})
+      alsa_version_string(ALSA_VERSION_STR)
+      if(ALSA_VERSION_STR AND NOT WIN32)
+         if(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)")
+            add_definitions(-DHAS_LIBASOUND_DEVICE_NAME_HINT)
+            set(HAVE_CURRENT_ALSA TRUE)
+         endif(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)")
+      endif(ALSA_VERSION_STR AND NOT WIN32)
+   endif(ALSA_FOUND)
+   if(NOT WIN32)
+      macro_log_feature(HAVE_CURRENT_ALSA "ALSA" "The Advanced Linux Sound Architecture (ALSA) library" "http://www.alsa-project.org/" FALSE "1.0.14a" "A current ALSA library is needed for dmix and virtual device listing")
+   endif(NOT WIN32)
+
    add_subdirectory(kded-module)
    add_subdirectory(platform_kde)
-   add_subdirectory(tests)
+   macro_optional_add_subdirectory(tests)
    add_subdirectory(kcm)
 endif(KDE4_DISABLE_MULTIMEDIA)
--- branches/KDE/4.4/kdebase/runtime/phonon/kded-module/CMakeLists.txt #1104234:1104235
@@ -1,27 +1,18 @@
-alsa_version_string(ALSA_VERSION_STR)
-set(HAVE_CURRENT_ALSA FALSE)
-#if(ALSA_VERSION_STR AND NOT WIN32)
-#   if(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)")
-#      set(HAVE_CURRENT_ALSA TRUE)
-#   endif(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)")
-#endif(ALSA_VERSION_STR AND NOT WIN32)
-#if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-#   macro_log_feature(HAVE_CURRENT_ALSA "ALSA" "current alsa-lib is needed for dmix and virtual device listing" "http://www.alsa-project.org/" TRUE "1.0.14a")
-#endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
-
-include_directories(${ALSA_INCLUDES})
-
 set(kded_phonon_SRCS
    phononserver.cpp
    audiodevice.cpp
    audiodeviceaccess.cpp
    hardwaredatabase.cpp
-   )
+)
 
 kde4_add_plugin(kded_phononserver ${kded_phonon_SRCS})
-target_link_libraries(kded_phononserver ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_SOLID_LIBS} ${ASOUND_LIBRARY})
-install(TARGETS kded_phononserver  DESTINATION ${PLUGIN_INSTALL_DIR})
 
-install(FILES phononserver.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
+target_link_libraries(kded_phononserver ${KDE4_KDEUI_LIBS} ${KDE4_PHONON_LIBS} ${KDE4_SOLID_LIBS})
 
+if(ALSA_FOUND)
+   target_link_libraries(kded_phononserver ${ASOUND_LIBRARY})
+endif(ALSA_FOUND)
+
+install(TARGETS kded_phononserver  DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES phononserver.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
 install(FILES hardwaredatabase DESTINATION ${DATA_INSTALL_DIR}/libphonon)
--- branches/KDE/4.4/kdebase/runtime/phonon/libkaudiodevicelist/CMakeLists.txt #1104234:1104235
@@ -1,22 +1,8 @@
-ALSA_VERSION_STRING(ALSA_VERSION_STR)
-SET(HAVE_CURRENT_ALSA FALSE)
-IF(ALSA_VERSION_STR AND NOT WIN32)
-   IF(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)")
-      ADD_DEFINITIONS(-DHAS_LIBASOUND_DEVICE_NAME_HINT)
-      SET(HAVE_CURRENT_ALSA TRUE)
-   ENDIF(ALSA_VERSION_STR MATCHES "^1\\.(0\\.(1[4-9]|[2-9][0-9]+)|[1-9][0-9]*\\.)")
-ENDIF(ALSA_VERSION_STR AND NOT WIN32)
-if(NOT WIN32)
-   macro_log_feature(HAVE_CURRENT_ALSA "ALSA" "The Advanced Linux Sound Architecture (ALSA) library" "http://www.alsa-project.org/" FALSE "1.0.14a" "A current ALSA library is needed for dmix and virtual device listing")
-endif(NOT WIN32)
-
-include_directories(${ALSA_INCLUDES})
-
 set(kaudiodevicelist_LIB_SRCS
     audiodevice.cpp
     audiodeviceenumerator.cpp
     hardwaredatabase.cpp
-   )
+)
 
 if(ALSA_FOUND)
    qt4_add_resources(kaudiodevicelist_LIB_SRCS resources.qrc)
--- branches/KDE/4.4/kdebase/runtime/phonon/platform_kde/CMakeLists.txt #1104234:1104235
@@ -1,24 +1,31 @@
-include_directories(${KDE4_KIO_INCLUDES} ${ALSA_INCLUDES})
+include_directories(${KDE4_KIO_INCLUDES})
+
 set(kde_PART_SRCS
 	kdeplatformplugin.cpp
 	kiomediastream.cpp
-   devicelisting.cpp
-	)
+	devicelisting.cpp
+)
 
 if(ALSA_FOUND)
    qt4_add_resources(kde_PART_SRCS resources.qrc)
 endif(ALSA_FOUND)
 
 kde4_add_plugin(kde ${kde_PART_SRCS})
-target_link_libraries(kde ${KDE4_PHONON_LIBS} ${KDE4_KIO_LIBS} ${ASOUND_LIBRARY})
+target_link_libraries(kde ${KDE4_PHONON_LIBS} ${KDE4_KIO_LIBS})
+
+if(ALSA_FOUND)
+   target_link_libraries(kde ${ASOUND_LIBRARY})
+endif(ALSA_FOUND)
+
 if(NOT WIN32)
-  set_target_properties(kde PROPERTIES
-                            INSTALL_RPATH_USE_LINK_PATH TRUE
-                            SKIP_BUILD_RPATH TRUE
-                            BUILD_WITH_INSTALL_RPATH TRUE
-                            INSTALL_RPATH ${LIB_INSTALL_DIR}
-                        )
+   set_target_properties(kde PROPERTIES
+                             INSTALL_RPATH_USE_LINK_PATH TRUE
+                             SKIP_BUILD_RPATH TRUE
+                             BUILD_WITH_INSTALL_RPATH TRUE
+                             INSTALL_RPATH ${LIB_INSTALL_DIR}
+   )
 endif(NOT WIN32)
+
 install(TARGETS kde DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/phonon_platform)
 install(FILES phonon.notifyrc DESTINATION ${DATA_INSTALL_DIR}/phonon)
 install(FILES phononbackend.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})


More information about the Kde-buildsystem mailing list