[PATCH 3/3] Fix build without OpenGL.

Jon Severinsson jon at severinsson.net
Sat Oct 6 19:12:08 BST 2012


---
 CMakeLists.txt                              |    3 --
 phonon/CMakeLists.txt                       |   42 ++++++++++++++++++---------
 phonon/graphicsview/CMakeLists.txt          |   23 ---------------
 phonon/graphicsview/videographicsobject.cpp |   11 ++++++-
 4 filer ändrade, 39 tillägg(+), 40 borttagningar(-)
 delete mode 100644 phonon/graphicsview/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea709f2..2000d74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,9 +36,6 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 
 include(cmake/FindPhononInternal.cmake)
 
-find_package(OpenGL)
-macro_log_feature(OPENGL_FOUND "OpenGL" "" "" FALSE)
-
 # The following variables directly influence the library's soname version.
 # It is highly advised to think twice before changing those.
 # If you are unsure about the this: http://plan99.net/~mike/writing-shared-libraries.html
diff --git a/phonon/CMakeLists.txt b/phonon/CMakeLists.txt
index 8e2198b..0a33388 100644
--- a/phonon/CMakeLists.txt
+++ b/phonon/CMakeLists.txt
@@ -1,8 +1,14 @@
-add_subdirectory(graphicsview)
-
-if (PHONON_BUILD_EXPERIMENTAL)
-    add_subdirectory(experimental)
-endif (PHONON_BUILD_EXPERIMENTAL)
+macro_optional_find_package(OpenGL)
+macro_log_feature(OPENGL_FOUND "OpenGL" "A cross-platform graphics programming language." "http://www.opengl.org" FALSE)
+macro_log_feature(QT_QTOPENGL_FOUND "QtOpenGL" "Qt Bindngs for OpenGL." "http://www.qt-project.org" FALSE)
+if (OPENGL_FOUND AND QT_QTOPENGL_FOUND)
+    set(PHONON_OPENGLSUPPORT TRUE CACHE BOOL "Has Phonon OpenGL support ?")
+    if(PHONON_OPENGLSUPPORT)
+        add_definitions(-DHAVE_OPENGL)
+    endif(PHONON_OPENGLSUPPORT)
+else (OPENGL_FOUND AND QT_QTOPENGL_FOUND)
+    set(PHONON_OPENGLSUPPORT FALSE CACHE BOOL "Has Phonon OpenGL support ?")
+endif (OPENGL_FOUND AND QT_QTOPENGL_FOUND)
 
 macro_optional_find_package(PulseAudio 0.9.15)
 macro_log_feature(PULSEAUDIO_FOUND "PulseAudio" "A cross-platform, networked sound server." "http://www.pulseaudio.org" FALSE "" "Allows audio playback via the PulseAudio soundserver when it is running")
@@ -13,13 +19,10 @@ if (GLIB2_FOUND AND PULSEAUDIO_FOUND)
    set(PHONON_PULSESUPPORT TRUE CACHE BOOL "Has Phonon pulseaudio support ?")
    if(PHONON_PULSESUPPORT)
        add_definitions(-DHAVE_PULSEAUDIO)
+       include_directories(${GLIB2_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR})
    endif(PHONON_PULSESUPPORT)
-   include_directories(${GLIB2_INCLUDE_DIR} ${PULSEAUDIO_INCLUDE_DIR})
 else(GLIB2_FOUND AND PULSEAUDIO_FOUND)
    set(PHONON_PULSESUPPORT FALSE CACHE BOOL "Has Phonon pulseaudio support ?")
-   set(PULSEAUDIO_INCLUDE_DIR "")
-   set(PULSEAUDIO_LIBRARY "")
-   set(PULSEAUDIO_MAINLOOP_LIBRARY "")
 endif(GLIB2_FOUND AND PULSEAUDIO_FOUND)
 
 macro_optional_find_package(QZeitgeist 0.8)
@@ -31,6 +34,10 @@ endif(QZEITGEIST_FOUND)
 
 include_directories(${CMAKE_BINARY_DIR}/includes/phonon)
 
+if (PHONON_BUILD_EXPERIMENTAL)
+    add_subdirectory(experimental)
+endif (PHONON_BUILD_EXPERIMENTAL)
+
 set(phonon_LIB_SRCS
    abstractaudiooutput.cpp
    abstractaudiooutput_p.cpp
@@ -66,8 +73,16 @@ set(phonon_LIB_SRCS
    volumeslider.cpp
    videoplayer.cpp
    videowidget.cpp
-   ${phonon_VGO_SRCS}
+   graphicsview/qpainterpainter.cpp
+   graphicsview/videographicsobject.cpp
+   )
+
+if (PHONON_OPENGLSUPPORT)
+   list(APPEND phonon_LIB_SRCS
+      graphicsview/glpainter.cpp
+      graphicsview/glslpainter.cpp
    )
+endif (PHONON_OPENGLSUPPORT)
 
 if (PHONON_PULSESUPPORT)
    list(APPEND phonon_LIB_SRCS
@@ -95,9 +110,9 @@ if (PHONON_PULSESUPPORT)
     target_link_libraries(phonon ${GOBJECT_LIBRARIES} ${PULSEAUDIO_LIBRARY} ${PULSEAUDIO_MAINLOOP_LIBRARY})
 endif (PHONON_PULSESUPPORT)
 
-if (QT_QTOPENGL_LIBRARY AND OPENGL_FOUND)
+if (PHONON_OPENGLSUPPORT)
     target_link_libraries(phonon ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY})
-endif (QT_QTOPENGL_LIBRARY AND OPENGL_FOUND)
+endif (PHONON_OPENGLSUPPORT)
 
 if (QZEITGEIST_FOUND)
     target_link_libraries(phonon ${QZEITGEIST_LIBRARY})
@@ -170,7 +185,8 @@ install(FILES
    volumefadereffect.h
    volumefaderinterface.h
    volumeslider.h
-   ${phonon_VGO_HDRS}
+   graphicsview/videoframe.h
+   graphicsview/videographicsobjectinterface.h
    ${CMAKE_CURRENT_BINARY_DIR}/phononnamespace.h
    DESTINATION ${INCLUDE_INSTALL_DIR}/phonon COMPONENT Devel)
 
diff --git a/phonon/graphicsview/CMakeLists.txt b/phonon/graphicsview/CMakeLists.txt
deleted file mode 100644
index 8ddaf8c..0000000
--- a/phonon/graphicsview/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-set(phonon_VGO_SRCS
-    graphicsview/glpainter.cpp
-    graphicsview/glslpainter.cpp
-    graphicsview/qpainterpainter.cpp
-    graphicsview/videographicsobject.cpp
-
-    # Work around QtCreator not displaying random headers.
-    graphicsview/abstractvideographicspainter.h
-    graphicsview/glpainter.h
-    graphicsview/videoframe.h
-    graphicsview/videographicsobjectinterface.h
-
-    PARENT_SCOPE
-)
-
-set(phonon_VGO_HDRS
-    graphicsview/videoframe.h
-    # VGO does not need to be public, as there is only pull but no push behavior.
-    #graphicsview/videographicsobject.h
-    graphicsview/videographicsobjectinterface.h
-
-    PARENT_SCOPE
-)
diff --git a/phonon/graphicsview/videographicsobject.cpp b/phonon/graphicsview/videographicsobject.cpp
index f1e70fd..ef9c4a6 100644
--- a/phonon/graphicsview/videographicsobject.cpp
+++ b/phonon/graphicsview/videographicsobject.cpp
@@ -21,15 +21,20 @@
 
 #include "videographicsobject.h"
 
+#include <QtGui/QPainter>
+
 #include "abstractvideographicspainter.h"
 #include "factory_p.h"
-#include "glslpainter.h"
 #include "medianode_p.h"
 #include "phonondefs_p.h"
 #include "qpainterpainter.h"
 #include "videoframe.h"
 #include "videographicsobjectinterface.h"
 
+#ifdef HAVE_OPENGL
+# include "glslpainter.h"
+#endif
+
 #define PHONON_INTERFACENAME VideoGraphicsObjectInterface
 
 namespace Phonon {
@@ -37,7 +42,9 @@ namespace Phonon {
 QMap<GraphicsPainterType, QList<VideoFrame::Format> > VideoGraphicsPainterMetaFactory::detectTypes()
 {
     QMap<GraphicsPainterType, QList<VideoFrame::Format> > map;
+#ifdef HAVE_OPENGL
     map.insert(GraphicsPainterGlsl, GlslPainter().supportedFormats());
+#endif
     map.insert(GraphicsPainterQPainter, QPainterPainter().supportedFormats());
     return map;
 }
@@ -73,8 +80,10 @@ public:
         case GraphicsPainterNone:
             // TODO: what to do what to do? :(
             Q_ASSERT(painterType != GraphicsPainterNone);
+#ifdef HAVE_OPENGL
         case GraphicsPainterGlsl:
             return new GlslPainter;
+#endif
         case GraphicsPainterQPainter:
             return new QPainterPainter;
         }
-- 
1.7.10.4

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel at kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
_______________________________________________
kde-multimedia mailing list
kde-multimedia at kde.org
https://mail.kde.org/mailman/listinfo/kde-multimedia


More information about the kde-multimedia mailing list