QT5 cmake and libGlesv2



  • Hi guys I'm back again with another issue.

    I want to link libEGL and libGLESv2 on the windows build of qt into my project.

    I've had a look at the cmake modules you use but QT5Openglconfig.cmake doesn't link them.
    Also it doesn't add the lib path to link_directories either to make the process easier.

    Has anyone come across this or am I missing something?

    Many thanks
    Martell



  • I had a go at creating a QT cmake config file for it but no joy

    @

    if (CMAKE_VERSION VERSION_LESS 2.8.3)
    message(FATAL_ERROR "Qt 5 requires at least CMake version 2.8.3")
    endif()

    get_filename_component(_qt5Angle_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

    set(Qt5Angle_VERSION_MAJOR 5)
    set(Qt5Angle_VERSION_MINOR 0)
    set(Qt5Angle_VERSION_PATCH 0)
    set(Qt5Angle_VERSION_STRING 5.0.0)

    set(Qt5Angle_LIBRARIES Qt5::Angle)

    set(Qt5Angle_INCLUDE_DIRS "${_qt5Angle_install_prefix}/include/")

    set(_Qt5Angle_MODULE_DEPENDENCIES "OpenGL")

    set(_Qt5Angle_FIND_DEPENDENCIES_REQUIRED)
    if (Qt5Angle_FIND_REQUIRED)
    set(_Qt5Angle_FIND_DEPENDENCIES_REQUIRED REQUIRED)
    endif()
    set(_Qt5Angle_FIND_DEPENDENCIES_QUIET)
    if (Qt5Angle_FIND_QUIETLY)
    set(_Qt5Angle_DEPENDENCIES_FIND_QUIET QUIET)
    endif()

    foreach(_module_dep ${_Qt5Angle_MODULE_DEPENDENCIES})
    if (NOT Qt5${_module_dep}_FOUND)
    find_package(Qt5${_module_dep}
    ${_Qt5Angle_DEPENDENCIES_FIND_QUIET}
    ${_Qt5Angle_FIND_DEPENDENCIES_REQUIRED}
    PATHS "${_qt5Angle_install_prefix}" NO_DEFAULT_PATH
    )
    endif()

    if (NOT Qt5${_module_dep}_FOUND)
        set(Qt5Angle_FOUND False)
        return()
    endif()
    
    list(APPEND Qt5Angle_INCLUDE_DIRS "${Qt5${_module_dep}_INCLUDE_DIRS}")
    list(APPEND Qt5Angle_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS})
    

    endforeach()
    list(REMOVE_DUPLICATES Qt5Angle_INCLUDE_DIRS)
    if (Qt5Angle_EXECUTABLE_COMPILE_FLAGS)
    list(REMOVE_DUPLICATES Qt5Angle_EXECUTABLE_COMPILE_FLAGS)
    endif()

    set(_Qt5Angle_LIB_DEPENDENCIES "Qt5::OpenGL")

    macro(_populate_imported_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
    set_property(TARGET Qt5::Angle APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})

    set_target_properties(Qt5::Angle PROPERTIES
        "IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}" "${_Qt5Angle_LIB_DEPENDENCIES}"
        "IMPORTED_LOCATION_${Configuration}" "${_qt5Angle_install_prefix}/lib/${LIB_LOCATION}"
    )
    if(NOT "${IMPLIB_LOCATION}" STREQUAL "")
        set_target_properties(Qt5::Angle PROPERTIES
            "IMPORTED_IMPLIB_${Configuration}" "${_qt5Angle_install_prefix}/lib/${IMPLIB_LOCATION}"
        )
    endif()
    

    endmacro()

    if (NOT TARGET Qt5::Angle)
    add_library(Qt5::Angle SHARED IMPORTED)

    _populate_imported_target_properties(DEBUG "libGLESv2d.dll" "libGLESv2d.lib" )
    

    _populate_imported_target_properties(DEBUG "libEGLd.dll" "libEGLd.lib" )

    _populate_imported_target_properties(RELEASE "libGLESv2.dll" "libGLESv2.lib" )
    _populate_imported_target_properties(RELEASE "libEGL.dll" "libEGL.lib" )
    

    endif()

    @



  • The dependency should be in the QtGui cmake file if anywhere.

    Is there a separate cmake file for EGL or GLES2 by any chance?



  • Sorry for the late reply ZapB.

    Its not in the QtGui cmakefile and there is no seperate cmake file for EGL or GLES2.

    I have linked it manually but this isn't exactly the best solution.

    The reason I need to link it is because I'm accessing the opengles functions directly, otherwise you wouldn't usually have to.

    Perhaps due to the fact that most qt users wouldn't need to do that is why there is no cmake file?



  • Hi,

    I would expect Qt to link to thos libraries as dependencies. Calling OpenGL ES 2 functions directly is a valid thing to do and since Qt itself uses those and allows you to use them with nothing but QtGui I would expect all GUI Qt apps to link to them.

    Could you file a bug report at bugreports.qt-project.org about this stating that you are using cmake please? Please post the link on here when done and I will keep an eye on it.

    Thanks.



  • Hi zap I created the bug report, hope my description is good enough :)

    https://bugreports.qt-project.org/browse/QTBUG-29132

    I explained what I'm doing in cmake and
    I also tagged it as QTGUI::OpenGL

    Many thanks
    Martell


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.