cmake: Give the egl_x11 test the necessary libs to compile

And add the eglfs_x11 plugin

We need to actually try to compile the test as the comment it it says
that having x11 and egl is not enough since sometimes they are actually
incompatible

Change-Id: If6bdc08c21b91fa9c41663f2fa653fd59e5ddd2e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Albert Astals Cid 2019-02-21 14:46:22 +01:00
parent e03596c2a7
commit 31e1dda94b
4 changed files with 49 additions and 7 deletions

View File

@ -137,8 +137,13 @@ drmModeAtomicReq *request;
)
# egl-x11
if (HAVE_EGL AND X11_XCB_FOUND AND X11_FOUND)
set(egl_x11_TEST_LIBRARIES EGL::EGL X11::X11 X11::XCB)
endif()
qt_config_compile_test(egl_x11
LABEL "EGL on X11"
LIBRARIES "${egl_x11_TEST_LIBRARIES}"
CODE
"// Check if EGL is compatible with X. Some EGL implementations, typically on
// embedded devices, are not intended to be used together with X. EGL support
// has to be disabled in plugins like xcb in this case since the native display,
@ -162,8 +167,7 @@ XCloseDisplay(dpy);
/* END TEST: */
return 0;
}
"# FIXME: use: egl xcb_xlib
)
")
# egl-brcm
qt_config_compile_test(egl_brcm

View File

@ -1,7 +1,7 @@
# Generated from deviceintegration.pro.
if(QT_FEATURE_egl_x11)
# TODO # TODO add_subdirectory(eglfs_x11)
add_subdirectory(eglfs_x11)
endif()
if(QT_FEATURE_eglfs_gbm OR QT_FEATURE_eglfs_egldevice)

View File

@ -0,0 +1,31 @@
# Generated from eglfs_x11.pro.
find_package(XCB)
find_package(X11)
find_package(X11_XCB)
#####################################################################
## qeglfs-x11-integration Plugin:
#####################################################################
add_qt_plugin(qeglfs-x11-integration
TYPE egldeviceintegrations
SOURCES
qeglfsx11integration.cpp qeglfsx11integration.h
qeglfsx11main.cpp
DEFINES
QT_EGL_NO_X11
INCLUDE_DIRECTORIES
../../api
LIBRARIES
Qt::CorePrivate
Qt::GuiPrivate
Qt::EglFSDeviceIntegrationPrivate
XCB::XCB
X11::X11
X11::XCB
# CONFIG = "egl"
# OTHER_FILES = "$$PWD/eglfs_x11.json"
# PLUGIN_CLASS_NAME = "QEglFSX11IntegrationPlugin"
# _LOADED = "qt_plugin"
)

View File

@ -616,12 +616,12 @@ def parseTest(ctx, test, data, cm_fh):
cm_fh.write("# {}\n".format(test))
if "qmake" in details: # We don't really have many so we can just enumerate them all
if details["qmake"] == "unix:LIBS += -lpthread":
librariesCmakeName = format(test) + "_TEST_LIBRARIES"
librariesCmakeName = format(featureName(test)) + "_TEST_LIBRARIES"
cm_fh.write("if (UNIX)\n")
cm_fh.write(" set(" + librariesCmakeName + " pthread)\n")
cm_fh.write("endif()\n")
elif details["qmake"] == "linux: LIBS += -lpthread -lrt":
librariesCmakeName = format(test) + "_TEST_LIBRARIES"
librariesCmakeName = format(featureName(test)) + "_TEST_LIBRARIES"
cm_fh.write("if (LINUX)\n")
cm_fh.write(" set(" + librariesCmakeName + " pthread rt)\n")
cm_fh.write("endif()\n")
@ -631,6 +631,15 @@ def parseTest(ctx, test, data, cm_fh):
else:
qmakeFixme = "# FIXME: qmake: {}\n".format(details["qmake"])
if "use" in data:
if data["use"] == "egl xcb_xlib":
librariesCmakeName = format(featureName(test)) + "_TEST_LIBRARIES"
cm_fh.write("if (HAVE_EGL AND X11_XCB_FOUND AND X11_FOUND)\n")
cm_fh.write(" set(" + librariesCmakeName + " EGL::EGL X11::X11 X11::XCB)\n")
cm_fh.write("endif()\n")
else:
qmakeFixme += "# FIXME: use: {}\n".format(data["use"])
cm_fh.write("qt_config_compile_test({}\n".format(featureName(test)))
cm_fh.write(lineify("LABEL", data.get("label", "")))
if librariesCmakeName != "":
@ -639,8 +648,6 @@ def parseTest(ctx, test, data, cm_fh):
cm_fh.write('"' + sourceCode + '"')
if qmakeFixme != "":
cm_fh.write(qmakeFixme)
if "use" in data:
cm_fh.write("# FIXME: use: {}\n".format(data["use"]))
cm_fh.write(")\n\n")
elif data["type"] == "x86Simd":