macx-clang: Opt-in xcb QPA support with XQuartz

Enable xcb QPA plugin when XQuartz is available. This is done
in a single build, alongside the Cocoa version.

We delegate part of the configuration stage to pkg-config, so
this becomes a requirement. Ensure that

    PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig

is in your environment, or pkg-config is properly set up.

Tested with the following configure options:

configure \
   -pkg-config \
   -fontconfig -system-freetype \
   -system-xcb -xkb -no-opengl \
   -qt-xkbcommon -qt-xkbcommon-x11

Change-Id: I2eb5a0491172368afc4c629c540cbef08580348d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Gabriel de Dietrich 2017-11-27 12:46:47 -08:00
parent 728c325a51
commit 32326a4b3b
7 changed files with 49 additions and 20 deletions

View File

@ -6,6 +6,25 @@ QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10
QMAKE_APPLE_DEVICE_ARCHS = x86_64 QMAKE_APPLE_DEVICE_ARCHS = x86_64
# Opt-in xcb QPA support with XQuartz:
#
# configure \
# -pkg-config \
# -fontconfig -system-freetype \
# -system-xcb -xkb -no-opengl \
# -qt-xkbcommon -qt-xkbcommon-x11
#
# Ensure that pkg-config is properly configured, or that
# PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/opt/X11/share/pkgconfig
# is set in your build environment.
#
# Due to irreconcilable differences between Cocoa
# and X11, OpenGL is currently not supported.
QMAKE_LIBS_X11 = -lX11 -lXext -lm
QMAKE_LIBDIR_X11 = /opt/X11/lib
QMAKE_INCDIR_X11 = /opt/X11/include
include(../common/macx.conf) include(../common/macx.conf)
include(../common/gcc-base-mac.conf) include(../common/gcc-base-mac.conf)
include(../common/clang.conf) include(../common/clang.conf)

View File

@ -928,7 +928,8 @@
}, },
"fontconfig": { "fontconfig": {
"label": "Fontconfig", "label": "Fontconfig",
"condition": "!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig", "autoDetect": "!config.darwin",
"condition": "!config.win32 && features.system-freetype && libs.fontconfig",
"output": [ "privateFeature", "feature" ] "output": [ "privateFeature", "feature" ]
}, },
"gbm": { "gbm": {
@ -1498,6 +1499,13 @@
"condition": "features.xcb && !features.xkbcommon-system && !features.xkb-config-root", "condition": "features.xcb && !features.xkbcommon-system && !features.xkb-config-root",
"message": "Could not find XKB config root, use -xkb-config-root to set a path to "message": "Could not find XKB config root, use -xkb-config-root to set a path to
XKB configuration data. This is required for keyboard input support." XKB configuration data. This is required for keyboard input support."
},
{
"type": "note",
"condition": "features.xcb && config.darwin",
"message": "XCB support on macOS is minimal and untested. Some features will
not work properly or at all (e.g. OpenGL, desktop services or accessibility),
or may depend on your system and XQuartz setup."
}, },
{ {
"type": "note", "type": "note",

View File

@ -9,7 +9,8 @@ PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
darwin { darwin {
include($$PWD/mac/coretext.pri) include($$PWD/mac/coretext.pri)
} else { }
qtConfig(freetype) { qtConfig(freetype) {
include($$PWD/freetype/freetype.pri) include($$PWD/freetype/freetype.pri)
} }
@ -28,6 +29,5 @@ darwin {
winrt { winrt {
include($$PWD/winrt/winrt.pri) include($$PWD/winrt/winrt.pri)
} }
}
load(qt_module) load(qt_module)

View File

@ -16,7 +16,7 @@ qtConfig(evdev)|qtConfig(tslib)|qtConfig(libinput)|qtConfig(integrityhid) {
input.depends += devicediscovery input.depends += devicediscovery
} }
unix:!darwin: \ if(unix:!darwin)|qtConfig(xcb): \
SUBDIRS += services SUBDIRS += services
qtConfig(opengl): \ qtConfig(opengl): \

View File

@ -6,7 +6,7 @@ CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII DEFINES += QT_NO_CAST_FROM_ASCII
unix:!darwin: \ if(unix:!darwin)|qtConfig(xcb): \
include($$PWD/genericunix/genericunix.pri) include($$PWD/genericunix/genericunix.pri)
HEADERS += \ HEADERS += \

View File

@ -4,6 +4,8 @@ QT += core-private gui-private xcb_qpa_lib-private
DEFINES += QT_NO_FOREACH DEFINES += QT_NO_FOREACH
macos: CONFIG += no_app_extension_api_only
SOURCES = \ SOURCES = \
qxcbmain.cpp qxcbmain.cpp
OTHER_FILES += xcb.json README OTHER_FILES += xcb.json README

View File

@ -1,4 +1,4 @@
!x11:osx { macos {
LIBS_PRIVATE += -framework AppKit -lz LIBS_PRIVATE += -framework AppKit -lz
*-mwerks:INCLUDEPATH += compat *-mwerks:INCLUDEPATH += compat
} }