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 <jake.petroules@qt.io>
This commit is contained in:
Jake Petroules 2017-03-29 20:49:08 -07:00 committed by Tor Arne Vestbø
parent 0c8b5446d4
commit 0133b59246
4 changed files with 19 additions and 37 deletions

View File

@ -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
}
}

View File

@ -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) {

View File

@ -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

View File

@ -57,12 +57,7 @@
#include <qpa/qplatformtheme.h>
#include <private/qcore_mac_p.h>
#ifdef Q_OS_OSX
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreText/CoreText.h>
#include <CoreGraphics/CoreGraphics.h>
#endif
Q_FORWARD_DECLARE_CF_TYPE(CTFontDescriptor);
Q_DECLARE_METATYPE(QCFType<CGFontRef>);
Q_DECLARE_METATYPE(QCFType<CFURLRef>);