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.

Pick-to: 6.2 6.3
Change-Id: Ic4122600f02e6828d528ee4f00075f8c27f42e38
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tatiana Borisova 2022-03-24 15:09:25 +02:00
parent aa8bada10b
commit 8116fdde1c
6 changed files with 65 additions and 4 deletions

View File

@ -120,6 +120,10 @@ list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}") list(APPEND CMAKE_REQUIRED_INCLUDES "${EGL_INCLUDE_DIR}")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "${EGL_DEFINITIONS}") 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(" check_cxx_source_compiles("
#include <EGL/egl.h> #include <EGL/egl.h>

View File

@ -15,6 +15,9 @@ else()
if(EGL_LIBRARY) if(EGL_LIBRARY)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}") list(APPEND CMAKE_REQUIRED_LIBRARIES "${EGL_LIBRARY}")
endif() endif()
if(_qt_igy_gui_libs)
list(APPEND CMAKE_REQUIRED_LIBRARIES "${_qt_igy_gui_libs}")
endif()
set(_includes "${CMAKE_REQUIRED_INCLUDES}") set(_includes "${CMAKE_REQUIRED_INCLUDES}")
list(APPEND CMAKE_REQUIRED_INCLUDES "${GLESv2_INCLUDE_DIR}") list(APPEND CMAKE_REQUIRED_INCLUDES "${GLESv2_INCLUDE_DIR}")

View File

@ -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})

View File

@ -330,6 +330,13 @@ if(QT_FEATURE_opengl)
if(QT_FEATURE_opengles2) if(QT_FEATURE_opengles2)
find_package(GLESv2) find_package(GLESv2)
target_link_libraries(Gui PUBLIC GLESv2::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) elseif(NOT QT_FEATURE_opengl_dynamic)
target_link_libraries(Gui PUBLIC WrapOpenGL::WrapOpenGL) target_link_libraries(Gui PUBLIC WrapOpenGL::WrapOpenGL)
endif() endif()

View File

@ -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(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(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) 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) qt_find_package(WrapSystemFreetype 2.2.0 PROVIDED_TARGETS WrapSystemFreetype::WrapSystemFreetype MODULE_NAME gui QMAKE_LIB freetype)
set_package_properties(WrapFreetype PROPERTIES TYPE REQUIRED) set_package_properties(WrapFreetype PROPERTIES TYPE REQUIRED)
if(QT_FEATURE_system_zlib) if(QT_FEATURE_system_zlib)
@ -289,11 +294,16 @@ fbGetDisplayByIndex(0);
"# FIXME: qmake: ['DEFINES += EGL_API_FB=1', '!integrity: DEFINES += LINUX=1'] "# 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 # egl-openwfd
qt_config_compile_test(egl_openwfd qt_config_compile_test(egl_openwfd
LABEL "OpenWFD EGL" LABEL "OpenWFD EGL"
LIBRARIES LIBRARIES
EGL::EGL ${test_libs}
CODE CODE
"#include <wfd.h> "#include <wfd.h>
@ -397,10 +407,15 @@ if(WASM)
endif() endif()
# special case end # 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 qt_config_compile_test(opengles3
LABEL "OpenGL ES 3.0" LABEL "OpenGL ES 3.0"
LIBRARIES LIBRARIES
GLESv2::GLESv2 ${test_libs}
# special case begin # special case begin
COMPILE_OPTIONS ${extra_compiler_options} COMPILE_OPTIONS ${extra_compiler_options}
# special case end # special case end
@ -425,11 +440,12 @@ glMapBufferRange(GL_ARRAY_BUFFER, 0, 0, GL_MAP_READ_BIT);
} }
") ")
# opengles31 # opengles31
qt_config_compile_test(opengles31 qt_config_compile_test(opengles31
LABEL "OpenGL ES 3.1" LABEL "OpenGL ES 3.1"
LIBRARIES LIBRARIES
GLESv2::GLESv2 ${test_libs}
CODE CODE
"#include <GLES3/gl31.h> "#include <GLES3/gl31.h>
@ -447,7 +463,7 @@ glProgramUniform1i(0, 0, 0);
qt_config_compile_test(opengles32 qt_config_compile_test(opengles32
LABEL "OpenGL ES 3.2" LABEL "OpenGL ES 3.2"
LIBRARIES LIBRARIES
GLESv2::GLESv2 ${test_libs}
CODE CODE
"#include <GLES3/gl32.h> "#include <GLES3/gl32.h>

View File

@ -56,6 +56,11 @@ qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION TARGET Qt::Inp
Qt::InputSupportPrivate 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 qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION QT_FEATURE_opengl
SOURCES SOURCES
api/qeglfscontext.cpp api/qeglfscontext_p.h api/qeglfscontext.cpp api/qeglfscontext_p.h