From 0133b59246a0daf88a0ba284a2cd9f65a5ece353 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 29 Mar 2017 20:49:08 -0700 Subject: [PATCH] Fix CoreText font database build on watchOS The font database uses UIKit symbols on all UIKit platforms and thus it must be linked to. Also, limit the missing CoreText.h workaround so that it is not applied for versions of Xcode where the bug is fixed. Change-Id: Ia2a94baba6b0df618604a0bc3092fbd2a48d5aea Reviewed-by: Jake Petroules --- mkspecs/features/uikit/watchos_coretext.prf | 15 +++++++++++++++ src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 16 +--------------- .../fontdatabases/mac/coretext.pri | 18 ++---------------- .../mac/qcoretextfontdatabase_p.h | 7 +------ 4 files changed, 19 insertions(+), 37 deletions(-) create mode 100644 mkspecs/features/uikit/watchos_coretext.prf diff --git a/mkspecs/features/uikit/watchos_coretext.prf b/mkspecs/features/uikit/watchos_coretext.prf new file mode 100644 index 0000000000..30e5af2e7e --- /dev/null +++ b/mkspecs/features/uikit/watchos_coretext.prf @@ -0,0 +1,15 @@ +# CoreText is documented to be available on watchOS, but the headers aren't present +# in the watchOS Simulator SDK like they are supposed to be. Work around the problem +# by adding the device SDK's headers to the search path as a fallback. +# rdar://25314492, rdar://27844864 +simulator_system_frameworks = $$xcodeSDKInfo(Path, $${simulator.sdk})/System/Library/Frameworks +watchos:simulator:!exists($$simulator_system_frameworks/CoreText.framework/Headers/CoreText.h) { + device_system_frameworks = $$xcodeSDKInfo(Path, $${device.sdk})/System/Library/Frameworks + for (arch, QMAKE_APPLE_SIMULATOR_ARCHS) { + QMAKE_CXXFLAGS += \ + -Xarch_$${arch} \ + -F$$simulator_system_frameworks \ + -Xarch_$${arch} \ + -F$$device_system_frameworks + } +} diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 3b7b11c8ee..e5746bf3eb 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -168,21 +168,7 @@ contains(SHAPERS, coretext) { # even in 10.8 where they were also made available stand-alone. LIBS_PRIVATE += -framework ApplicationServices - # CoreText is documented to be available on watchOS, but the headers aren't present - # in the watchOS Simulator SDK like they are supposed to be. Work around the problem - # by adding the device SDK's headers to the search path as a fallback. - # rdar://25314492, rdar://27844864 - watchos:simulator { - simulator_system_frameworks = $$xcodeSDKInfo(Path, $${simulator.sdk})/System/Library/Frameworks - device_system_frameworks = $$xcodeSDKInfo(Path, $${device.sdk})/System/Library/Frameworks - for (arch, QMAKE_APPLE_SIMULATOR_ARCHS) { - QMAKE_CXXFLAGS += \ - -Xarch_$${arch} \ - -F$$simulator_system_frameworks \ - -Xarch_$${arch} \ - -F$$device_system_frameworks - } - } + CONFIG += watchos_coretext } contains(SHAPERS, fallback)|isEmpty(SHAPERS) { diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri index f73e22eb1a..3d928d4e71 100644 --- a/src/platformsupport/fontdatabases/mac/coretext.pri +++ b/src/platformsupport/fontdatabases/mac/coretext.pri @@ -9,23 +9,9 @@ qtConfig(freetype) { uikit: \ # On iOS/tvOS/watchOS CoreText and CoreGraphics are stand-alone frameworks - LIBS_PRIVATE += -framework CoreText -framework CoreGraphics + LIBS_PRIVATE += -framework CoreText -framework CoreGraphics -framework UIKit else: \ # On macOS they are re-exported by the AppKit framework LIBS_PRIVATE += -framework AppKit -# CoreText is documented to be available on watchOS, but the headers aren't present -# in the watchOS Simulator SDK like they are supposed to be. Work around the problem -# by adding the device SDK's headers to the search path as a fallback. -# rdar://25314492, rdar://27844864 -watchos:simulator { - simulator_system_frameworks = $$xcodeSDKInfo(Path, $${simulator.sdk})/System/Library/Frameworks - device_system_frameworks = $$xcodeSDKInfo(Path, $${device.sdk})/System/Library/Frameworks - for (arch, QMAKE_APPLE_SIMULATOR_ARCHS) { - QMAKE_CXXFLAGS += \ - -Xarch_$${arch} \ - -F$$simulator_system_frameworks \ - -Xarch_$${arch} \ - -F$$device_system_frameworks - } -} +CONFIG += watchos_coretext diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index 3b1be2e6a1..344e235053 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -57,12 +57,7 @@ #include #include -#ifdef Q_OS_OSX -#include -#else -#include -#include -#endif +Q_FORWARD_DECLARE_CF_TYPE(CTFontDescriptor); Q_DECLARE_METATYPE(QCFType); Q_DECLARE_METATYPE(QCFType);