summaryrefslogtreecommitdiff
path: root/elements
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2013-06-07 13:12:02 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2013-06-09 19:20:26 +0300
commit42015febada2f0122409db9a85c3948f6892b02f (patch)
treea4af717f525da8177963ce488a9a60d32e59f906 /elements
parent51687fe4408bd3aa6f7a88c7eebb0b6ffd2e98c7 (diff)
cmake: Replace QtHelpers by a better FindQt4or5 script
This script makes use of qt4_use_modules and qt5_use_modules, which allow us to get rid of QT_* variables in cmake code and also do things right by defining all the necessary include directories and required Qt defines as well as compiler flags. This also allows us to support both Qt4 and Qt5 in the examples when compiled standalone without much effort.
Diffstat (limited to 'elements')
-rw-r--r--elements/CMakeLists.txt2
-rw-r--r--elements/gstqtvideosink/CMakeLists.txt25
-rw-r--r--elements/gstqtvideosink/autotest.cpp2
3 files changed, 14 insertions, 15 deletions
diff --git a/elements/CMakeLists.txt b/elements/CMakeLists.txt
index f563d74..bfa7f65 100644
--- a/elements/CMakeLists.txt
+++ b/elements/CMakeLists.txt
@@ -8,7 +8,7 @@ add_definitions(-DPACKAGE="qt-gstreamer"
-DGST_DISABLE_XML
-DGST_DISABLE_LOADSAVE)
-include_directories(${QT_INCLUDE_DIR} ${GSTREAMER_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR})
+include_directories(${GSTREAMER_INCLUDE_DIR} ${GLIB2_INCLUDE_DIR})
if (GSTREAMER_BASE_LIBRARY_FOUND AND GSTREAMER_VIDEO_LIBRARY_FOUND)
include_directories(${GSTREAMER_BASE_INCLUDE_DIR} ${GSTREAMER_VIDEO_INCLUDE_DIR})
diff --git a/elements/gstqtvideosink/CMakeLists.txt b/elements/gstqtvideosink/CMakeLists.txt
index 49de034..1051fea 100644
--- a/elements/gstqtvideosink/CMakeLists.txt
+++ b/elements/gstqtvideosink/CMakeLists.txt
@@ -19,7 +19,7 @@ set(GstQtVideoSink_SRCS
${CMAKE_CURRENT_BINARY_DIR}/gstqtvideosinkmarshal.c
)
-if (QT_QTOPENGL_FOUND AND (OPENGL_FOUND OR OPENGLES2_FOUND))
+if (Qt4or5_OpenGL_FOUND AND (OPENGL_FOUND OR OPENGLES2_FOUND))
set(GstQtVideoSink_GL_SRCS
openglsurfacepainter.cpp
gstqtglvideosinkbase.cpp
@@ -30,11 +30,11 @@ if (QT_QTOPENGL_FOUND AND (OPENGL_FOUND OR OPENGLES2_FOUND))
)
if (OPENGLES2_FOUND)
- set(GstQtVideoSink_GL_LIBS ${OPENGLES2_LIBRARY} ${QT_QTOPENGL_LIBRARY})
- include_directories(${OPENGLES2_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR})
+ set(GstQtVideoSink_GL_LIBS ${OPENGLES2_LIBRARY})
+ include_directories(${OPENGLES2_INCLUDE_DIR})
else()
- set(GstQtVideoSink_GL_LIBS ${OPENGL_gl_LIBRARY} ${QT_QTOPENGL_LIBRARY})
- include_directories(${OPENGL_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR})
+ set(GstQtVideoSink_GL_LIBS ${OPENGL_gl_LIBRARY})
+ include_directories(${OPENGL_INCLUDE_DIR})
endif()
else()
add_definitions(-DGST_QT_VIDEO_SINK_NO_OPENGL)
@@ -42,8 +42,6 @@ endif()
add_library(gstqtvideosink MODULE ${GstQtVideoSink_SRCS} ${GstQtVideoSink_GL_SRCS})
target_link_libraries(gstqtvideosink
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
${GOBJECT_LIBRARIES}
${GSTREAMER_LIBRARY}
${GSTREAMER_BASE_LIBRARY}
@@ -51,9 +49,12 @@ target_link_libraries(gstqtvideosink
${GSTREAMER_INTERFACES_LIBRARY}
${GstQtVideoSink_GL_LIBS}
)
+qt4or5_use_modules(gstqtvideosink Core Gui Widgets)
+if (Qt4or5_OpenGL_FOUND AND (OPENGL_FOUND OR OPENGLES2_FOUND))
+ qt4or5_use_modules(gstqtvideosink OpenGL)
+endif()
install(TARGETS gstqtvideosink DESTINATION ${QTGSTREAMER_GST_PLUGINS_INSTALL_DIR})
-
if (QTGSTREAMER_TESTS)
add_executable(qtvideosink_autotest
autotest.cpp
@@ -63,9 +64,6 @@ if (QTGSTREAMER_TESTS)
${GstQtVideoSink_test_GL_SRCS}
)
target_link_libraries(qtvideosink_autotest
- ${QT_QTTEST_LIBRARY}
- ${QT_QTCORE_LIBRARY}
- ${QT_QTGUI_LIBRARY}
${GOBJECT_LIBRARIES}
${GSTREAMER_LIBRARY}
${GSTREAMER_BASE_LIBRARY}
@@ -73,5 +71,8 @@ if (QTGSTREAMER_TESTS)
${GSTREAMER_INTERFACES_LIBRARY}
${GstQtVideoSink_GL_LIBS}
)
- #add_test(NAME qtvideosink_autotest COMMAND qtvideosink_autotest)
+ qt4or5_use_modules(qtvideosink_autotest Core Gui Widgets Test)
+ if (Qt4or5_OpenGL_FOUND AND (OPENGL_FOUND OR OPENGLES2_FOUND))
+ qt4or5_use_modules(qtvideosink_autotest OpenGL)
+ endif()
endif()
diff --git a/elements/gstqtvideosink/autotest.cpp b/elements/gstqtvideosink/autotest.cpp
index 2bd2fbf..7c3f75b 100644
--- a/elements/gstqtvideosink/autotest.cpp
+++ b/elements/gstqtvideosink/autotest.cpp
@@ -15,8 +15,6 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define QT_GUI_LIB 1 //enable QtGui in QtTest
-
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/interfaces/colorbalance.h>