Build Qt libraries with -fapplication-extension
This ensures at compile-time that Qt libraries do not use any APIs that are not safe for use in application extensions, and fixes warning messages that appear when linking to Qt libraries that are not built with this flag, when used in an application extension. This is especially important on watchOS where *all* "applications" are actually application extensions, and on other Apple platforms if application extensions are developed using Qt. Task-number: QTBUG-40101 Change-Id: I022046f2584e0222253d33052b0abc221d7c93d6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
af7cefd272
commit
944110089d
@ -38,6 +38,13 @@ qt {
|
||||
|
||||
!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
|
||||
|
||||
app_extension_api_only {
|
||||
QMAKE_CFLAGS += -fapplication-extension
|
||||
QMAKE_CXXFLAGS += -fapplication-extension
|
||||
QMAKE_CXXFLAGS_PRECOMPILE += -fapplication-extension
|
||||
QMAKE_LFLAGS += -fapplication-extension
|
||||
}
|
||||
|
||||
macx-xcode {
|
||||
!isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
|
||||
debug_information_format.name = DEBUG_INFORMATION_FORMAT
|
||||
|
@ -21,6 +21,9 @@ if(win32|mac):!macx-xcode {
|
||||
|
||||
CONFIG += relative_qt_rpath # Qt's QML plugins should be relocatable
|
||||
|
||||
# Qt libraries should only use Application Extension safe APIs
|
||||
darwin:!no_app_extension_api_only: CONFIG += app_extension_api_only
|
||||
|
||||
!no_cxx_module:isEmpty(CXX_MODULE) {
|
||||
CXX_MODULE = $$TARGET
|
||||
TARGET = declarative_$${TARGET}
|
||||
|
@ -46,6 +46,9 @@ CONFIG(shared, static|shared):qtConfig(framework): \
|
||||
|
||||
CONFIG += relative_qt_rpath # Qt libraries should be relocatable
|
||||
|
||||
# Qt libraries should only use Application Extension safe APIs
|
||||
darwin:!no_app_extension_api_only: CONFIG += app_extension_api_only
|
||||
|
||||
ucmodule = $$upper($$MODULE)
|
||||
|
||||
isEmpty(MODULE_INCNAME): MODULE_INCNAME = $$TARGET
|
||||
|
@ -32,6 +32,9 @@ tool_plugin {
|
||||
|
||||
CONFIG += relative_qt_rpath # Qt's plugins should be relocatable
|
||||
|
||||
# Qt libraries should only use Application Extension safe APIs
|
||||
darwin:!no_app_extension_api_only: CONFIG += app_extension_api_only
|
||||
|
||||
CONFIG(static, static|shared)|prefix_build {
|
||||
isEmpty(MODULE): MODULE = $$basename(TARGET)
|
||||
|
||||
|
@ -1485,6 +1485,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
}
|
||||
}
|
||||
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
|
||||
settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO");
|
||||
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
|
||||
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
|
||||
settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES");
|
||||
|
@ -80,7 +80,8 @@ QT_USE_NAMESPACE
|
||||
#elif defined(Q_OS_WATCHOS)
|
||||
object:[WKExtension sharedExtension]];
|
||||
#else
|
||||
object:[UIApplication sharedApplication]];
|
||||
// Use performSelector so this can work in an App Extension
|
||||
object:[[UIApplication class] performSelector:@selector(sharedApplication)]];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,8 @@ QT += \
|
||||
accessibility_support-private clipboard_support-private theme_support-private \
|
||||
fontdatabase_support-private graphics_support-private cgl_support-private
|
||||
|
||||
CONFIG += no_app_extension_api_only
|
||||
|
||||
qtHaveModule(widgets) {
|
||||
OBJECTIVE_SOURCES += \
|
||||
qpaintengine_mac.mm \
|
||||
|
@ -5,6 +5,8 @@ TARGET = qios
|
||||
# application's main() when the plugin is a shared library.
|
||||
qtConfig(shared): CONFIG += static
|
||||
|
||||
CONFIG += no_app_extension_api_only
|
||||
|
||||
QT += \
|
||||
core-private gui-private \
|
||||
clipboard_support-private fontdatabase_support-private graphics_support-private
|
||||
|
Loading…
x
Reference in New Issue
Block a user