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>
This commit is contained in:
parent
5aa349628e
commit
a680fe609f
@ -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, " "))
|
||||
}
|
||||
|
20
src/gui/Qt5GuiConfigExtras.cmake.in
Normal file
20
src/gui/Qt5GuiConfigExtras.cmake.in
Normal file
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user