From 31e1dda94b66581580dd92a3664d5f5773b81065 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 21 Feb 2019 14:46:22 +0100 Subject: [PATCH] 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 --- src/gui/configure.cmake | 8 +++-- .../eglfs/deviceintegration/CMakeLists.txt | 2 +- .../eglfs_x11/CMakeLists.txt | 31 +++++++++++++++++++ util/cmake/configurejson2cmake.py | 15 ++++++--- 4 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt diff --git a/src/gui/configure.cmake b/src/gui/configure.cmake index 5e29a60463b..271c8a182e9 100644 --- a/src/gui/configure.cmake +++ b/src/gui/configure.cmake @@ -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 diff --git a/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt index f3aa856379c..396964a5e71 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt +++ b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt @@ -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) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt new file mode 100644 index 00000000000..aaa4da9cb38 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt @@ -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" +) diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index 840ffefd059..0997608ed93 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -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":