Permalink
Browse files

Added some more finding stuff that finds the things I need better. Still

not working though
  • Loading branch information...
1 parent c906103 commit f429b86f31d1ea0281afa28b12ce1050b52deda6 Kurtis Nusbaum committed Jul 26, 2012
Showing with 67 additions and 14 deletions.
  1. +4 −0 cmake/modules/FindLIBVLC.cmake
  2. +61 −8 cmake/modules/FindPhonon.cmake
  3. +2 −6 src/CMakeLists.txt
@@ -69,6 +69,10 @@ endif (NOT LIBVLC_VERSION)
if (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
set(LIBVLC_FOUND TRUE)
+else (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
+ message(STATUS "LIBVLC INCLUDE DIR: ${LIBVLC_INCLUDE_DIR}")
+ message(STATUS "LIBVLC LIBRARY : ${LIBVLC_LIBRARY}")
+ message(STATUS "LIBVLC CORE LIBRARY : ${LIBVLCCORE_LIBRARY}")
endif (LIBVLC_INCLUDE_DIR AND LIBVLC_LIBRARY AND LIBVLCCORE_LIBRARY)
if (LIBVLC_VERSION STRLESS "${LIBVLC_MIN_VERSION}")
@@ -1,18 +1,71 @@
-# Find Phonon
+# Find libphonon
+# Once done this will define
+#
+# PHONON_FOUND - system has Phonon Library
+# PHONON_INCLUDES - the Phonon include directory
+# PHONON_LIBS - link these to use Phonon
+# PHONON_VERSION - the version of the Phonon Library
-# Copyright (c) 2010, Harald Sitter <sitter@kde.org>
-# Copyright (c) 2011, Alexander Neundorf <neundorf@kde.org>
+# Copyright (c) 2008, Matthias Kretz <kretz@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-find_package(Phonon NO_MODULE)
+macro(_phonon_find_version)
+ set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h")
+ if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
+ set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
+ endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
+ file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000)
+ string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}")
+ set(PHONON_VERSION "${CMAKE_MATCH_1}")
+ message(STATUS "Phonon Version: ${PHONON_VERSION}")
+endmacro(_phonon_find_version)
+
if(PHONON_FOUND)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PHONON_BUILDSYSTEM_DIR})
-endif()
+ # Already found, nothing more to do except figuring out the version
+ _phonon_find_version()
+else(PHONON_FOUND)
+ if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ set(PHONON_FIND_QUIETLY TRUE)
+ endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+
+ # As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir)
+ find_library(PHONON_LIBRARY NAMES phonon PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ # then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.)
+ find_library(PHONON_LIBRARY NAMES phonon HINTS "$ENV{PHONON_DIR}" "$ENV{PHONON_DIR}/lib" )
+
+ find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h)
-include(FindPackageHandleStandardArgs)
+ if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
+ set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
+ set(PHONON_FOUND TRUE)
+ _phonon_find_version()
+ else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
+ set(PHONON_FOUND FALSE)
+ endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
-find_package_handle_standard_args(Phonon DEFAULT_MSG Phonon_DIR )
+ if(PHONON_FOUND)
+ if(NOT PHONON_FIND_QUIETLY)
+ message(STATUS "Found Phonon: ${PHONON_LIBRARY}")
+ message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}")
+ endif(NOT PHONON_FIND_QUIETLY)
+ else(PHONON_FOUND)
+ if(Phonon_FIND_REQUIRED)
+ if(NOT PHONON_INCLUDE_DIR)
+ message(STATUS "Phonon includes NOT found!")
+ endif(NOT PHONON_INCLUDE_DIR)
+ if(NOT PHONON_LIBRARY)
+ message(STATUS "Phonon library NOT found!")
+ endif(NOT PHONON_LIBRARY)
+ message(FATAL_ERROR "Phonon library or includes NOT found!")
+ else(Phonon_FIND_REQUIRED)
+ message(STATUS "Unable to find Phonon")
+ endif(Phonon_FIND_REQUIRED)
+ endif(PHONON_FOUND)
+ mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES)
+endif(PHONON_FOUND)
View
@@ -104,7 +104,7 @@ endif()
set(UDJ_EXTRA_LIBS "")
if(WIN32)
list(APPEND UDJ_EXTRA_LIBS ${LIBVLC_LIBRARY})
- list(APPEND UDJ_EXTRA_LIBS ${PHONON_LIBRARY})
+ list(APPEND UDJ_EXTRA_LIBS ${PHONON_LIBS})
endif(WIN32)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
@@ -140,10 +140,6 @@ IF(WIN32)
#Do some fancy foot work to get phonon vlc working on widnows, this is so stupid and I hate it.
- #custom built phonon lib
- get_filename_component(PHONON_ROOT ${PHONON_INCLUDE_DIR} PATH)
- set(PHONON_LIB_DLLS "${PHONON_ROOT}/bin/phonon.dll")
- INSTALL(FILES ${PHONON_LIB_DLLS} DESTINATION ${BIN_INSTALL_DIR})
#vlc libs
@@ -152,7 +148,7 @@ IF(WIN32)
INSTALL(FILES ${VLC_LIB_DLLS} DESTINATION ${BIN_INSTALL_DIR})
- #And finally the friggen PHONON_VLC_DLL
+ #And the friggen PHONON_VLC_DLL
find_file(PHONON_VLC_DLL phonon_vlc.dll
HINT "$ENV{PHONON_VLC_ROOT_DIR}bin/phonon_backend"
)

0 comments on commit f429b86

Please sign in to comment.