summaryrefslogtreecommitdiffstats
path: root/src/gui/Qt5GuiConfigExtras.cmake.in
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2013-04-16 13:38:19 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-22 18:35:52 +0200
commitbc4fbcd215b72951d37db57103365963f3849fbc (patch)
treee60940386226ca4f2fed2a006b5ad1fa06f608fd /src/gui/Qt5GuiConfigExtras.cmake.in
parentd257e69a791b97a0646eb7c5a798dc3fe3db456f (diff)
Add IMPORTED targets for the GL libraries used by Qt.
There may be multiple libraries specified in the mkspec, such as EGL and Mali, as used in devices/linux-sh4-stmicro-ST7108-g++, so create an imported target for each one. Also populate the Qt5Gui_EGL_LIBS variable with all created imported targets. Similar variables are created for the used OPENGL implementation. In the case of using the packaged ANGLE library, we already know the exact locations of the binaries. This makes it possible for third parties to use the same GL implementation as used by the Qt build itself. As these are used only privately by QtGui, they are also added to the DEPENDENT_LIBRARIES of that target so that they are found for rpath-link usage. On some platforms (eg Raspberry Pi), multiple include directories must be set to include egl.h, as the headers it includes for vcos are a bit scattered. Task-number: QTBUG-29132 Change-Id: I1126da3d37cd51c88d3670347c8b6405b285efb5 Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/gui/Qt5GuiConfigExtras.cmake.in')
-rw-r--r--src/gui/Qt5GuiConfigExtras.cmake.in109
1 files changed, 108 insertions, 1 deletions
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
index d9313d4364..03b98ed273 100644
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ b/src/gui/Qt5GuiConfigExtras.cmake.in
@@ -1,5 +1,50 @@
-!!IF !contains(QT_CONFIG, angle)
+!!IF !mac
+
+!!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+
+!!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\")
+!!ELSE
+set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR\")
+!!ENDIF
+
+set(Qt5Gui_OPENGL_INCLUDE_DIRS ${Qt5Gui_EGL_INCLUDE_DIRS})
+
+macro(_populate_qt5gui_gl_target_properties TargetName Configuration LIB_LOCATION IMPLIB_LOCATION)
+ set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+ set_target_properties(Qt5::${TargetName} PROPERTIES
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ \"IMPORTED_LOCATION_${Configuration}\" \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${LIB_LOCATION}\"
+!!ELSE
+ \"IMPORTED_LOCATION_${Configuration}\" \"$${CMAKE_LIB_DIR}${LIB_LOCATION}\"
+!!ENDIF
+!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+ \"IMPORTED_IMPLIB_${Configuration}\" \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\"
+!!ELSE
+ \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\"
+!!ENDIF
+ )
+endmacro()
+
+add_library(Qt5::Gui_EGL SHARED IMPORTED)
+_populate_qt5gui_gl_target_properties(Gui_EGL RELEASE $${CMAKE_ANGLE_EGL_DLL_RELEASE} $${CMAKE_ANGLE_EGL_IMPLIB_RELEASE})
+add_library(Qt5::Gui_GLESv2 SHARED IMPORTED)
+_populate_qt5gui_gl_target_properties(Gui_GLESv2 RELEASE $${CMAKE_ANGLE_GLES2_DLL_RELEASE} $${CMAKE_ANGLE_GLES2_IMPLIB_RELEASE})
+
+set_property(TARGET Qt5::Gui_EGL APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_EGL_INCLUDE_DIRS})
+set_property(TARGET Qt5::Gui_GLESv2 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Qt5Gui_OPENGL_INCLUDE_DIRS})
+
+!!IF !isEmpty(CMAKE_DEBUG_TYPE)
+_populate_qt5gui_gl_target_properties(Gui_EGL DEBUG $${CMAKE_ANGLE_EGL_DLL_DEBUG} $${CMAKE_ANGLE_EGL_IMPLIB_DEBUG})
+_populate_qt5gui_gl_target_properties(Gui_GLESv2 DEBUG $${CMAKE_ANGLE_GLES2_DLL_DEBUG} $${CMAKE_ANGLE_GLES2_IMPLIB_DEBUG})
+!!ENDIF
+
+set(Qt5Gui_EGL_LIBRARIES Qt5::Gui_EGL)
+set(Qt5Gui_OPENGL_LIBRARIES Qt5::Gui_GLESv2)
+
+!!ELSE
!!IF !isEmpty(CMAKE_GL_INCDIRS)
@@ -17,4 +62,66 @@ unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)
!!ENDIF
+macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs)
+ set(Qt5Gui_${Name}_LIBRARIES)
+ set(Qt5Gui_EGL_INCLUDE_DIRS ${IncDirs})
+ foreach(_lib ${Libs})
+ string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib})
+ if (NOT TARGET Qt5::Gui_${_cmake_lib_name})
+ find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}
+!!IF !isEmpty(CROSS_COMPILE)
+ PATHS \"${LibDir}\" NO_DEFAULT_PATH
+!!ENDIF
+ )
+ if (NOT Qt5Gui_${_cmake_lib_name}_LIBRARY)
+ message(FATAL_ERROR \"Failed to find \\\"${_lib}\\\" in \\\"${LibDir}\\\", using the CMAKE_FIND_ROOT_PATH \\\"${CMAKE_FIND_ROOT_PATH}\\\".\")
+ endif()
+ add_library(Qt5::Gui_${_cmake_lib_name} SHARED IMPORTED)
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${IncDirs})
+
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
+!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_RELEASE \"${Qt5Gui_${_cmake_lib_name}_LIBRARY}\")
+!!ENDIF
+ unset(Qt5Gui_${_cmake_lib_name}_LIBRARY CACHE)
+
+ find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG ${_lib}d
+ PATHS \"${LibDir}\" NO_DEFAULT_PATH)
+ if (Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG)
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_LOCATION_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
+!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+ set_property(TARGET Qt5::Gui_${_cmake_lib_name} PROPERTY IMPORTED_IMPLIB_DEBUG \"${Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG}\")
+!!ENDIF
+ endif()
+ unset(Qt5Gui_${_cmake_lib_name}_LIBRARY_DEBUG CACHE)
+ endif()
+ list(APPEND Qt5Gui_${Name}_LIBRARIES Qt5::Gui_${_cmake_lib_name})
+ endforeach()
+endmacro()
+
+
+!!IF !isEmpty(CMAKE_EGL_LIBS)
+_qt5gui_find_extra_libs(EGL \"$$CMAKE_EGL_LIBS\" \"$$CMAKE_EGL_LIBDIR\" \"$$CMAKE_EGL_INCDIRS\")
+!!ENDIF
+
+!!IF !isEmpty(CMAKE_OPENGL_LIBS)
+_qt5gui_find_extra_libs(OPENGL \"$$CMAKE_OPENGL_LIBS\" \"$$CMAKE_OPENGL_LIBDIR\" \"$$CMAKE_OPENGL_INCDIRS\")
+
+!!ENDIF
+
+!!ENDIF
+
+set(Qt5Gui_OPENGL_IMPLEMENTATION $$CMAKE_QT_OPENGL_IMPLEMENTATION)
+
+get_target_property(_configs Qt5::Gui IMPORTED_CONFIGURATIONS)
+foreach(_config ${_configs})
+ set_property(TARGET Qt5::Gui APPEND PROPERTY
+ IMPORTED_LINK_DEPENDENT_LIBRARIES_${_config}
+ ${Qt5Gui_EGL_LIBRARIES} ${Qt5Gui_OPENGL_LIBRARIES}
+ )
+endforeach()
+unset(_configs)
+
!!ENDIF