Make: improve detection of X11 with Qt 5

In collaboration with Scott Kostyshak:
With Qt 4 we could use Q_WS_X11, defined by FindQt4.cmake. In Qt 5,
there is no FindQt5.cmake. Instead we now define our own variable,
QT_USES_X11 by using class QX11Info available only on X11.
(http://qt-project.org/doc/qt-5/QX11Info.html)

The main consequence of this improved support is that now the keytests
can be run (ctest -R "keytest") when LyX is compiled with Qt 5.
Before, with Qt 5 we did not know if X11 was available, which is
needed by xvkbd, so the tests were not enabled. Note, however, that
many tests fail with Qt version 5.2.1 because there was a change in
the event handling mechanism in Qt that causes xvkbd to be unable to
pass capital letters (so case sensitive greps in the tests fail). This
needs to be investigated and reported.
This commit is contained in:
Kornel Benko 2014-05-25 13:50:18 +02:00
parent e716f1ef12
commit 046001e571
3 changed files with 32 additions and 1 deletions

View File

@ -512,6 +512,7 @@ endif()
find_package(Qt5Core QUIET)
if (Qt5Core_FOUND)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5X11Extras)
set(QTVERSION ${Qt5Core_VERSION})
macro (qt_use_modules)
qt5_use_modules(${ARGN})

View File

@ -8,7 +8,7 @@ set(LYX_HOME "out-home")
set(LOCALE_DIR "${CMAKE_CURRENT_BINARY_DIR}/locale")
file(MAKE_DIRECTORY "${LOCALE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${LYX_HOME}")
if(Q_WS_X11)
if(QT_USES_X11)
set(Missing)
set(XVFBDLIBS)
# Make sure, the needed programs are in PATH

View File

@ -112,3 +112,33 @@ check_cxx_source_compiles(
"
SIZEOF_WCHAR_T_IS_4)
if (Qt5X11Extras_FOUND)
get_target_property(_x11extra_prop Qt5::X11Extras IMPORTED_CONFIGURATIONS)
get_target_property(_x11extra_lib Qt5::X11Extras IMPORTED_SONAME_${_x11extra_prop})
set(CMAKE_REQUIRED_LIBRARIES ${_x11extra_lib})
set(CMAKE_REQUIRED_INCLUDES ${Qt5X11Extras_INCLUDE_DIRS})
set(CMAKE_REQUIRED_FLAGS ${Qt5X11Extras_EXECUTABLE_COMPILE_FLAGS})
check_cxx_source_compiles(
"
#include <QtX11Extras/QX11Info>
int main()
{
bool isX11 = QX11Info::isPlatformX11();
}
"
QT_USES_X11)
elseif(QT4_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${QT_QTGUI_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})
check_cxx_source_compiles(
"
#include <QtGui/QX11Info>
int main()
{
QX11Info *qxi = new QX11Info;
qxi->~QX11Info();
}
"
QT_USES_X11)
endif()