1
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
2
# Copyright (C) 2008 Matthias Kretz <kretz@kde.org>
3
#
4
# This library is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU Lesser General Public License as published by
6
# the Free Software Foundation, either version 2 or 3 of the License.
7
#
8
# This library is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU Lesser General Public License for more details.
12
#
13
# You should have received a copy of the GNU Lesser General Public License
14
# along with this library.  If not, see <http://www.gnu.org/licenses/>.
15
16
project(phonon-gstreamer)
17
include(ConfigureChecks.cmake)
18
19
if (BUILD_PHONON_GSTREAMER)
20
   include_directories(
21
	  ${CMAKE_CURRENT_BINARY_DIR}
22
	  ${GSTREAMER_INCLUDE_DIR}
23
	  ${GLIB2_INCLUDE_DIR}
24
      ${LIBXML2_INCLUDE_DIR}
25
	  ${X11_X11_INCLUDE_PATH})
26
   add_definitions(-DPHONON_BACKEND_VERSION_4_2)
27
28
   # configure plugin api
29
   if(USE_INSTALL_PLUGIN)
30
      set(PLUGIN_INSTALL_API TRUE)
31
   endif(USE_INSTALL_PLUGIN)
32
33
   configure_file(phonon-config-gstreamer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/phonon-config-gstreamer.h )
34
35
   set(phonon_gstreamer_SRCS
36
      audiooutput.cpp
37
      backend.cpp
38
      devicemanager.cpp
39
      effectmanager.cpp
40
      gsthelper.cpp
41
      mediaobject.cpp
42
      medianode.cpp
43
      effect.cpp
44
      medianodeevent.cpp
45
      videowidget.cpp
46
      qwidgetvideosink.cpp
47
      streamreader.cpp
48
      phononsrc.cpp
49
      message.cpp
50
      audioeffect.cpp
51
      abstractrenderer.cpp
52
      widgetrenderer.cpp
53
      glrenderer.cpp
54
      volumefadereffect.cpp
55
      audiodataoutput.cpp
56
      )
57
58
   if(NOT WIN32)
59
      set(phonon_gstreamer_SRCS
60
          ${phonon_gstreamer_SRCS}
61
          artssink.cpp
62
          x11renderer.cpp)
63
      macro_optional_find_package(Alsa)
64
      macro_ensure_version("0.10.22" ${GSTREAMER_VERSION} GSTREAMER_HAS_NONBLOCKING_ALSASINK)
65
   endif(NOT WIN32)
66
   if(ALSA_FOUND AND NOT GSTREAMER_HAS_NONBLOCKING_ALSASINK)
67
      add_definitions(-DUSE_ALSASINK2)
68
      include_directories(${ALSA_INCLUDES})
69
      set(phonon_gstreamer_SRCS
70
         ${phonon_gstreamer_SRCS}
71
         alsasink2.c
72
         )
73
   endif(ALSA_FOUND AND NOT GSTREAMER_HAS_NONBLOCKING_ALSASINK)
74
75
   automoc4_add_library(phonon_gstreamer MODULE ${phonon_gstreamer_SRCS})
76
   set_target_properties(phonon_gstreamer PROPERTIES PREFIX "")
77
   target_link_libraries(phonon_gstreamer
78
      ${QT_QTOPENGL_LIBRARY}
79
      ${PHONON_LIBS} ${OPENGL_gl_LIBRARY}
80
      ${GSTREAMER_LIBRARIES} ${GSTREAMER_BASE_LIBRARY} ${GSTREAMER_INTERFACE_LIBRARY}
81
      ${GSTREAMER_PLUGIN_VIDEO_LIBRARIES} ${GSTREAMER_PLUGIN_AUDIO_LIBRARIES}
82
      ${GLIB2_LIBRARIES} ${GOBJECT_LIBRARIES})
83
   if(ALSA_FOUND)
84
      target_link_libraries(phonon_gstreamer ${ASOUND_LIBRARY})
85
   endif(ALSA_FOUND)
86
   if(USE_INSTALL_PLUGIN)
87
       target_link_libraries(phonon_gstreamer ${GSTREAMER_PLUGIN_PBUTILS_LIBRARIES})
88
   endif(USE_INSTALL_PLUGIN)
89
90
   install(TARGETS phonon_gstreamer DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/phonon_backend)
91
   install(FILES gstreamer.desktop DESTINATION ${SERVICES_INSTALL_DIR}/phononbackends)
92
endif (BUILD_PHONON_GSTREAMER)