summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2013-04-11 22:45:14 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-19 12:03:36 +0200
commita680fe609f9b8cbccee1acd7391a725cf4b7b523 (patch)
tree82a677238277d85d1efa37ec3c8fca027c09e90e
parent5aa349628e2d4913e5aeddd6557d578f34e31fc0 (diff)
Add the GL headers to cmake variables.
If building angle ourselves, that's just the basic Qt include dir, and if using an external gl, look for it in the places specified in the mkspec. As the qopengl.h header includes the gl header, this is a 'public include dependency' of QtGui, so it is added to the relevant variable and the INTERFACE_INCLUDE_DIRECTORIES of Qt5::Gui. Change-Id: I8c2c1782e0a2600032771175444b087da28433fc Reviewed-by: Volker Krause <volker.krause@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
-rw-r--r--mkspecs/features/cmake_functions.prf9
-rw-r--r--src/gui/Qt5GuiConfigExtras.cmake.in20
-rw-r--r--src/gui/gui.pro16
3 files changed, 45 insertions, 0 deletions
diff --git a/mkspecs/features/cmake_functions.prf b/mkspecs/features/cmake_functions.prf
index 5816dfe1d0..1285990206 100644
--- a/mkspecs/features/cmake_functions.prf
+++ b/mkspecs/features/cmake_functions.prf
@@ -31,3 +31,12 @@ defineReplace(cmakeTargetPath) {
else: path = $$1
return(/$$path)
}
+
+defineReplace(cmakeTargetPaths) {
+ variable = $$1
+ out =
+ for(v, variable) {
+ out += \"$$cmakeTargetPath($$v)\"
+ }
+ return ($$join(out, " "))
+}
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
new file mode 100644
index 0000000000..d9313d4364
--- /dev/null
+++ b/src/gui/Qt5GuiConfigExtras.cmake.in
@@ -0,0 +1,20 @@
+
+!!IF !contains(QT_CONFIG, angle)
+
+!!IF !isEmpty(CMAKE_GL_INCDIRS)
+
+find_path(_qt5gui_OPENGL_INCLUDE_DIR $$CMAKE_GL_HEADER_NAME
+ PATHS $$CMAKE_GL_INCDIRS
+ NO_DEFAULT_PATH)
+if (NOT _qt5gui_OPENGL_INCLUDE_DIR)
+ message(FATAL_ERROR \"Failed to find \\\"$$CMAKE_GL_HEADER_NAME\\\" in \\\"$$CMAKE_GL_INCDIRS\\\", using the CMAKE_FIND_ROOT_PATH \\\"${CMAKE_FIND_ROOT_PATH}\\\".\")
+endif()
+
+list(APPEND Qt5Gui_INCLUDE_DIRS ${_qt5gui_OPENGL_INCLUDE_DIR})
+set_property(TARGET Qt5::Gui APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5gui_OPENGL_INCLUDE_DIR})
+
+unset(_qt5gui_OPENGL_INCLUDE_DIR CACHE)
+
+!!ENDIF
+
+!!ENDIF
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 14c267df70..9238fd91a4 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -35,4 +35,20 @@ include(itemmodels/itemmodels.pri)
QMAKE_LIBS += $$QMAKE_LIBS_GUI
+load(cmake_functions)
+
+!contains(QT_CONFIG, angle) {
+ contains(QT_CONFIG, opengles1) {
+ CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES1)
+ CMAKE_GL_HEADER_NAME = GLES/gl.h
+ } else:contains(QT_CONFIG, opengles2) {
+ CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL_ES2)
+ CMAKE_GL_HEADER_NAME = GLES2/gl2.h
+ } else {
+ CMAKE_GL_INCDIRS = $$cmakeTargetPaths($$QMAKE_INCDIR_OPENGL)
+ CMAKE_GL_HEADER_NAME = GL/gl.h
+ mac: CMAKE_GL_HEADER_NAME = gl.h
+ }
+}
+
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtGui.dynlist