summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2013-06-09 13:40:17 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2013-06-09 19:20:26 +0300
commit4fc2b07457a40f4c69c41deeedcd76111d601502 (patch)
treeb41d11581a853623fa2ef23418e9f976eb47263d
parentecbf5480d6fb49cb5fb3d6edebcdda8ed03bd28c (diff)
cmake: Determine whether to use OpenGLES based on what Qt is using on the target system
This is needed since recent linux distributions sometimes ship both desktop GL and GLES on desktops and QtGStreamer fails to compile because it tries to use GLES although Qt is using GL.
-rw-r--r--CMakeLists.txt30
1 files changed, 21 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7db3650..f15c88e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,15 +95,27 @@ macro_log_feature(GLIB2_FOUND "GLib" "Required to build QtGLib" "http://www.gtk.
find_package(GObject)
macro_log_feature(GOBJECT_FOUND "GObject" "Required to build QtGLib" "http://www.gtk.org/" TRUE)
-find_package(OpenGL)
-macro_log_feature(OPENGL_FOUND "OpenGL"
- "Required for OpenGL rendering support in ${QTVIDEOSINK_NAME} (desktop only)"
- "http://www.opengl.org" FALSE)
-
-find_package(OpenGLES2)
-macro_log_feature(OPENGLES2_FOUND "OpenGLES"
- "Required for OpenGLES rendering support in ${QTVIDEOSINK_NAME} (embedded only)"
- "http://www.opengl.org" FALSE "2.0")
+set(CMAKE_REQUIRED_INCLUDES ${QTGSTREAMER_INCLUDES})
+include(CheckCXXSourceCompiles)
+check_cxx_source_compiles("
+#include <QtCore/QtGlobal>
+#if !defined(QT_OPENGL_ES)
+#error \"No OpenGLES\"
+#endif
+int main() {}
+" USE_OPENGLES)
+
+if (USE_OPENGLES)
+ find_package(OpenGLES2)
+ macro_log_feature(OPENGLES2_FOUND "OpenGLES"
+ "Required for OpenGLES rendering support in ${QTVIDEOSINK_NAME}"
+ "http://www.opengl.org" FALSE "2.0")
+else()
+ find_package(OpenGL)
+ macro_log_feature(OPENGL_FOUND "OpenGL"
+ "Required for OpenGL rendering support in ${QTVIDEOSINK_NAME}"
+ "http://www.opengl.org" FALSE)
+endif()
if (QTGSTREAMER_CODEGEN AND CMAKE_CROSSCOMPILING)
message(WARNING "Codegen use requested, but we are crosscompiling. Disabling...")