c937bbb4fe
With iOS 6.0 and above the LC_MAIN load command is available, which allows dyld to call the application entrypoint directly instead of going through _start in crt.o. By passing -e to the linker we can change this entrypoint to our wrapper that sets up the separate stack before entering the native iOS runloop through UIApplicationMain. As before, we call the user's main() from applicationDidFinishLaunching. By using LC_MAIN instead of messing with the object files we open up the possibility of generating Bitcode instead of object code, which can be useful for link-time optimizations, either locally or by Apple. Change-Id: If2153bc919581cd93dfa10fb6ff1c305b3e39a52 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
32 lines
1.4 KiB
Plaintext
32 lines
1.4 KiB
Plaintext
|
|
qt_depends = $$resolve_depends(QT, "QT.")
|
|
equals(TEMPLATE, app):contains(qt_depends, gui(-private)?) {
|
|
LIBS *= -L$$[QT_INSTALL_PLUGINS/get]/platforms
|
|
|
|
lib_name = qios
|
|
lib_path_and_base = $$[QT_INSTALL_PLUGINS/get]/platforms/lib$${lib_name}$$qtPlatformTargetSuffix()
|
|
LIBS += -l$${lib_name}$$qtPlatformTargetSuffix() $$fromfile($${lib_path_and_base}.prl, QMAKE_PRL_LIBS)
|
|
|
|
# By marking qt_registerPlatformPlugin as undefined, we ensure that
|
|
# the plugin.o translation unit is considered for inclusion in
|
|
# the final binary, which in turn ensures that the plugin's
|
|
# static initializer is included and run.
|
|
QMAKE_LFLAGS += -u _qt_registerPlatformPlugin
|
|
|
|
# We do link and dependency resolution for the platform plugin
|
|
# manually, since we know we always need the plugin, so we don't
|
|
# need to generate an import for it.
|
|
QTPLUGIN.platforms = -
|
|
|
|
!no_main_wrapper {
|
|
# The LC_MAIN load command available in iOS 6.0 and above allows dyld to
|
|
# directly call the entrypoint instead of going through _start in crt.o.
|
|
# Passing -e to the linker changes the entrypoint from _main to our custom
|
|
# wrapper that calls UIApplicationMain and dispatches back to main() once
|
|
# the application has started up and is ready to initialize QApplication.
|
|
QMAKE_LFLAGS += -Wl,-e,_qt_main_wrapper
|
|
}
|
|
}
|
|
|
|
load(qt)
|