diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-02-11 16:58:26 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-02-12 14:57:30 +0000 |
commit | 519ef817ffb4dbadb00ac958e7402cbfeaf135af (patch) | |
tree | 1a3dd3891011fb0b433a5b1f6c880e3751b36dde /src | |
parent | 6424e70bbef492f052d1aa6b7ce36d5326625e6e (diff) |
Fix Desktop GL/EGL/GLESv2 linkage
This change fixes a few things in one go:
* cmake's FindOpenGL cannot be used reliably to detect EGL. So use a
custom module for that.
* Added a custom module for GLESv2 detection, as cmake's FindOpenGL
does not support that.
* Map CONFIG += opengl to a WrapOpenGL target, which links against
either GLESv2 or libGL - just like mkspecs/features/*/opengl.prf
* cmake's FindOpenGL remains in use solely to detect the availability
of desktop gl.
Change-Id: I9315e5ad1fd88e1b7dc7e920053e98fb51fea7fc
Reviewed-by: Volker Krause <volker.krause@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/gui/configure.cmake | 12 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/plugins/platforms/minimalegl/CMakeLists.txt | 3 |
4 files changed, 24 insertions, 7 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index b2520f5e06..4ea528e7ae 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -317,6 +317,12 @@ extend_target(Gui CONDITION TEST_architecture STREQUAL arm64 AND NOT APPLE_UIKIT DEFINES ENABLE_PIXMAN_DRAWHELPERS ) +# With qmake, gui's opengl.pri used CONFIG += opengl, where opengl.prf +# acted like WrapOpenGL: direct linkage against either libGLESv2 or +# libGL, depending in the opengl _feature_. This is done by hand now +# here (where the feature is available). +find_package(WrapOpenGL) + extend_target(Gui CONDITION QT_FEATURE_opengl SOURCES opengl/qopengl.cpp opengl/qopengl.h opengl/qopengl_p.h @@ -347,7 +353,7 @@ extend_target(Gui CONDITION QT_FEATURE_opengl opengl/qopenglversionfunctionsfactory.cpp opengl/qopenglversionfunctionsfactory_p.h opengl/qopenglvertexarrayobject.cpp opengl/qopenglvertexarrayobject.h LIBRARIES - OpenGL::GL + WrapOpenGL ) extend_target(Gui CONDITION (QT_FEATURE_opengl) AND (NOT QT_FEATURE_opengles2) diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index e5888cc1d7..5e29a60463 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -38,8 +38,8 @@ find_package(ATSPI2) set_package_properties(ATSPI2 PROPERTIES TYPE OPTIONAL) find_package(Libdrm) set_package_properties(Libdrm PROPERTIES TYPE OPTIONAL) -find_package(OpenGL) -set_package_properties(OpenGL PROPERTIES TYPE OPTIONAL) +find_package(EGL) +set_package_properties(EGL PROPERTIES TYPE OPTIONAL) find_package(Freetype) set_package_properties(Freetype PROPERTIES TYPE OPTIONAL) find_package(Fontconfig) @@ -56,6 +56,10 @@ find_package(PNG) set_package_properties(PNG PROPERTIES TYPE OPTIONAL) find_package(Mtdev) set_package_properties(Mtdev PROPERTIES TYPE OPTIONAL) +find_package(OpenGL) +set_package_properties(OpenGL PROPERTIES TYPE OPTIONAL) +find_package(GLESv2) +set_package_properties(GLESv2 PROPERTIES TYPE OPTIONAL) find_package(Tslib) set_package_properties(Tslib PROPERTIES TYPE OPTIONAL) find_package(Vulkan) @@ -537,7 +541,7 @@ qt_feature("mtdev" PRIVATE ) qt_feature("opengles2" PUBLIC LABEL "OpenGL ES 2.0" - CONDITION WIN32 OR ( NOT APPLE_WATCHOS AND NOT QT_FEATURE_opengl_desktop AND libs.opengl_es2 ) OR FIXME + CONDITION WIN32 OR ( NOT APPLE_WATCHOS AND NOT QT_FEATURE_opengl_desktop AND GLESv2_FOUND ) ENABLE INPUT_opengl STREQUAL 'es2' DISABLE INPUT_opengl STREQUAL 'desktop' OR INPUT_opengl STREQUAL 'dynamic' OR INPUT_opengl STREQUAL 'no' ) @@ -586,7 +590,7 @@ qt_feature("openvg" PUBLIC ) qt_feature("egl" PUBLIC PRIVATE LABEL "EGL" - CONDITION ( QT_FEATURE_opengl OR QT_FEATURE_openvg ) AND ( QT_FEATURE_angle OR OpenGL_EGL_FOUND ) + CONDITION ( QT_FEATURE_opengl OR QT_FEATURE_openvg ) AND ( QT_FEATURE_angle OR EGL_FOUND ) ) qt_feature_definition("egl" "QT_NO_EGL" NEGATE VALUE "1") qt_feature("egl_x11" PRIVATE diff --git a/src/platformsupport/eglconvenience/CMakeLists.txt b/src/platformsupport/eglconvenience/CMakeLists.txt index 2b20a9cb35..af5d277f7a 100644 --- a/src/platformsupport/eglconvenience/CMakeLists.txt +++ b/src/platformsupport/eglconvenience/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from eglconvenience.pro. -find_package(OpenGL) +find_package(EGL) ##################################################################### ## EglSupport Module: @@ -18,8 +18,12 @@ add_qt_module(EglSupport LIBRARIES Qt::CorePrivate Qt::GuiPrivate - OpenGL::EGL + EGL::EGL ${CMAKE_DL_LIBS} + # CONFIG = "static" "internal_module" "egl" + # MODULE = "egl_support" + # PRECOMPILED_HEADER = "../../corelib/global/qt_pch.h" + # _LOADED = "qt_module" ) ## Scopes: diff --git a/src/plugins/platforms/minimalegl/CMakeLists.txt b/src/plugins/platforms/minimalegl/CMakeLists.txt index a038d07df9..f6d46c55a4 100644 --- a/src/plugins/platforms/minimalegl/CMakeLists.txt +++ b/src/plugins/platforms/minimalegl/CMakeLists.txt @@ -1,5 +1,7 @@ # Generated from minimalegl.pro. +find_package(FindWrapOpenGL) + ##################################################################### ## qminimalegl Plugin: ##################################################################### @@ -19,6 +21,7 @@ add_qt_plugin(qminimalegl Qt::EventDispatcherSupportPrivate Qt::FontDatabaseSupportPrivate Qt::EglSupportPrivate + WrapOpenGL # CONFIG = "egl" # OTHER_FILES = "minimalegl.json" # PLUGIN_CLASS_NAME = "QMinimalEglIntegrationPlugin" |