diff options
author | Tatiana Borisova <tatiana.borisova@qt.io> | 2022-03-24 15:09:25 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-04-05 16:56:05 +0000 |
commit | b96267fe1a2c493aa958deb4774879e831045302 (patch) | |
tree | b26e7386f7395a2218a0c8def000592879a6d46c | |
parent | 94f81129d08e7c36cefb0a967a9a8fb3a7fb8808 (diff) |
Reorganize work with graphical libraries on INTEGRITY
- Currently we manually unpack all platform libraries,
that are required for GUI apps, and pack it into single eglmegapack.a library.
It could be better do not execute such additional step,
but have possibility to add required graphical libs
to cmake interface lib via toolchain file list variable.
Change-Id: Ic4122600f02e6828d528ee4f00075f8c27f42e38
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8116fdde1c13fe00fb03414b56da2d66e215f279)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake | 4 | ||||
-rw-r--r-- | cmake/FindGLESv2.cmake | 3 | ||||
-rw-r--r-- | cmake/platforms/FindIntegrityPlatformGraphics.cmake | 26 | ||||
-rw-r--r-- | src/gui/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/gui/configure.cmake | 24 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/CMakeLists.txt | 5 |
6 files changed, 65 insertions, 4 deletions
diff --git a/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake b/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake index a3573bacd4..0733f1f702 100644 --- a/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake +++ b/cmake/3rdparty/extra-cmake-modules/find-modules/FindEGL.cmake @@ -120,6 +120,10 @@ list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}") list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}") list(APPEND CMAKE_REQUIRED_DEFINITIONS "${EGL_DEFINITIONS}") +if(_qt_igy_gui_libs) + list(APPEND CMAKE_REQUIRED_LIBRARIES "${_qt_igy_gui_libs}") +endif() + check_cxx_source_compiles(" #include <EGL/egl.h> diff --git a/cmake/FindGLESv2.cmake b/cmake/FindGLESv2.cmake index 25b9044bb2..6d7147f563 100644 --- a/cmake/FindGLESv2.cmake +++ b/cmake/FindGLESv2.cmake @@ -15,6 +15,9 @@ else() if(EGL_LIBRARY) list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}") endif() + if(_qt_igy_gui_libs) + list(APPEND CMAKE_REQUIRED_LIBRARIES "${_qt_igy_gui_libs}") + endif() set(_includes "${CMAKE_REQUIRED_INCLUDES}") list(APPEND CMAKE_REQUIRED_INCLUDES "${GLESv2_INCLUDE_DIR}") diff --git a/cmake/platforms/FindIntegrityPlatformGraphics.cmake b/cmake/platforms/FindIntegrityPlatformGraphics.cmake new file mode 100644 index 0000000000..cfcd260740 --- /dev/null +++ b/cmake/platforms/FindIntegrityPlatformGraphics.cmake @@ -0,0 +1,26 @@ +#.rst: +# IntegrityPlatformGraphics +# --------- +find_package_handle_standard_args(IntegrityPlatformGraphics + FOUND_VAR + IntegrityPlatformGraphics_FOUND + REQUIRED_VARS + IntegrityPlatformGraphics_LIBRARY + IntegrityPlatformGraphics_INCLUDE_DIR +) + +if(IntegrityPlatformGraphics_FOUND + AND NOT TARGET IntegrityPlatformGraphics::IntegrityPlatformGraphics) + add_library(IntegrityPlatformGraphics::IntegrityPlatformGraphics STATIC IMPORTED) + set_target_properties(IntegrityPlatformGraphics::IntegrityPlatformGraphics PROPERTIES + IMPORTED_LOCATION "${IntegrityPlatformGraphics_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${IntegrityPlatformGraphics_INCLUDE_DIR}" + ) + target_link_libraries(IntegrityPlatformGraphics::IntegrityPlatformGraphics + INTERFACE ${IntegrityPlatformGraphics_LIBRARIES_PACK}) +endif() + +mark_as_advanced(IntegrityPlatformGraphics_LIBRARY) + +# compatibility variables +set(IntegrityPlatformGraphics_LIBRARIES ${IntegrityPlatformGraphics_LIBRARY}) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index e3062561df..9901938445 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -321,6 +321,13 @@ if(QT_FEATURE_opengl) if(QT_FEATURE_opengles2) find_package(GLESv2) target_link_libraries(Gui PUBLIC GLESv2::GLESv2) + + if(INTEGRITY AND _qt_igy_gui_libs) + find_package(IntegrityPlatformGraphics) + target_link_libraries(Gui + INTERFACE $<LINK_ONLY:IntegrityPlatformGraphics::IntegrityPlatformGraphics>) + endif() + elseif(NOT QT_FEATURE_opengl_dynamic) target_link_libraries(Gui PUBLIC WrapOpenGL::WrapOpenGL) endif() diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index 7f644c978a..6255bd4b1b 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -30,6 +30,11 @@ qt_find_package(ATSPI2 PROVIDED_TARGETS PkgConfig::ATSPI2 MODULE_NAME gui QMAKE_ qt_find_package(DirectFB PROVIDED_TARGETS PkgConfig::DirectFB MODULE_NAME gui QMAKE_LIB directfb) qt_find_package(Libdrm PROVIDED_TARGETS Libdrm::Libdrm MODULE_NAME gui QMAKE_LIB drm) qt_find_package(EGL PROVIDED_TARGETS EGL::EGL MODULE_NAME gui QMAKE_LIB egl) +if(INTEGRITY AND _qt_igy_gui_libs) + qt_find_package(IntegrityPlatformGraphics + PROVIDED_TARGETS IntegrityPlatformGraphics::IntegrityPlatformGraphics + MODULE_NAME gui QMAKE_LIB integrity_platform_graphics) +endif() qt_find_package(WrapSystemFreetype 2.2.0 PROVIDED_TARGETS WrapSystemFreetype::WrapSystemFreetype MODULE_NAME gui QMAKE_LIB freetype) set_package_properties(WrapFreetype PROPERTIES TYPE REQUIRED) if(QT_FEATURE_system_zlib) @@ -289,11 +294,16 @@ fbGetDisplayByIndex(0); "# FIXME: qmake: ['DEFINES += EGL_API_FB=1', '!integrity: DEFINES += LINUX=1'] ) +set(test_libs EGL::EGL) +if(INTEGRITY AND _qt_igy_gui_libs) + set(test_libs ${test_libs} IntegrityPlatformGraphics::IntegrityPlatformGraphics) +endif() + # egl-openwfd qt_config_compile_test(egl_openwfd LABEL "OpenWFD EGL" LIBRARIES - EGL::EGL + ${test_libs} CODE "#include <wfd.h> @@ -397,10 +407,15 @@ if(WASM) endif() # special case end +set(test_libs GLESv2::GLESv2) +if(INTEGRITY AND _qt_igy_gui_libs) + set(test_libs ${test_libs} IntegrityPlatformGraphics::IntegrityPlatformGraphics) +endif() + qt_config_compile_test(opengles3 LABEL "OpenGL ES 3.0" LIBRARIES - GLESv2::GLESv2 + ${test_libs} # special case begin COMPILE_OPTIONS ${extra_compiler_options} # special case end @@ -425,11 +440,12 @@ glMapBufferRange(GL_ARRAY_BUFFER, 0, 0, GL_MAP_READ_BIT); } ") + # opengles31 qt_config_compile_test(opengles31 LABEL "OpenGL ES 3.1" LIBRARIES - GLESv2::GLESv2 + ${test_libs} CODE "#include <GLES3/gl31.h> @@ -447,7 +463,7 @@ glProgramUniform1i(0, 0, 0); qt_config_compile_test(opengles32 LABEL "OpenGL ES 3.2" LIBRARIES - GLESv2::GLESv2 + ${test_libs} CODE "#include <GLES3/gl32.h> diff --git a/src/plugins/platforms/eglfs/CMakeLists.txt b/src/plugins/platforms/eglfs/CMakeLists.txt index 61adb94778..c8b398e7a2 100644 --- a/src/plugins/platforms/eglfs/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/CMakeLists.txt @@ -56,6 +56,11 @@ qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION TARGET Qt::Inp Qt::InputSupportPrivate ) +qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION INTEGRITY AND TARGET IntegrityPlatformGraphics::IntegrityPlatformGraphics + LIBRARIES + IntegrityPlatformGraphics::IntegrityPlatformGraphics +) + qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION QT_FEATURE_opengl SOURCES api/qeglfscontext.cpp api/qeglfscontext_p.h |