2013-06-26 14:47:20 +00:00
|
|
|
|
2013-08-12 11:19:25 +00:00
|
|
|
equals(TEMPLATE, app):contains(QT, gui(-private)?) {
|
2013-06-26 14:47:20 +00:00
|
|
|
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.
|
2014-04-29 12:21:46 +00:00
|
|
|
QTPLUGIN.platforms = -
|
2013-06-26 14:47:20 +00:00
|
|
|
|
iOS: Change main-wrapper logic to not require changing the user's main
Instead of using a define to rename the user's main() function during
compilation, we leave the user code alone, and inject our wrapper one
step earlier in the process, at the application entry point 'start'.
This entry point is provided by crt1.o, which is normally linked into
the application automatically. The start() function sets up some state
and then calls main(), but we change the start() function to instead
call our main wrapper.
Instead of shipping our own crt1 binary/sources, we make a copy of
the appropriate crt1.o at build time, and modify its symbol table in
place. This is unproblematic as long as we keep the same length for
the wrapper function name, as the symbol names are just entries in
the global string table of the object file.
The result is that for the regular Qt use-case the user won't see
any changes to their main function, and we have more control over
the startup sequence. For the hybrid use-case, we no longer rely
on the fragile solution of having our back-up 'main' symbol in
a single translation unit, which would break eg with --load_all,
and we don't need to provide a dummy 'qt_user_main' symbol.
OSX 10.8 and iOS 6.0 introduced a new load command called LC_MAIN,
which places the state setup in the shared dyld, and then just
calls main() directly. Once we bump the minimum deployment target
to iOS 6.0 we can start using this loader instead of LC_UNIXTHREAD,
but for now we force the classic loader using the -no_new_main flag.
There's also a bug in the ld64 linker provided by the current Xcode
toolchains that results in the -e linker flag (to set the entry
point) having no effect, but hopefully this bug has been fixed
(or Apple has switched to the LLVM lld linker) by the time we
bump our deployment target.
Change-Id: Ie0ba869c13ddc5277dc95c539aebaeb60e949dc2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-09-06 21:16:28 +00:00
|
|
|
!no_main_wrapper {
|
2013-10-16 17:06:47 +00:00
|
|
|
# We use ld to rename the _main symbol to _qt_main, so that we don't get a symbol clash
|
|
|
|
# with the _main we provide that calls UIApplicationMain. We need to make a copy of the
|
|
|
|
# original object file, as ld will not copy over DWARF debug information to the output
|
|
|
|
# file. Instead, it will inject a reference back to the original object file, so when
|
|
|
|
# Xcode runs dsymutil to make the final dSYM file it will still find the debug info
|
|
|
|
# for the object file that provided the original _main. This back-reference has the
|
|
|
|
# interesting side-effect of the debug information still referring to the original
|
|
|
|
# symbol name, so stack-traces will show both our wrapper main and the original
|
|
|
|
# user main as 'main', and adding a symbolic breakpoint for 'main' will break on
|
|
|
|
# both functions. Although a bit weird, it's a good thing, as the user will still be
|
|
|
|
# able to add symbolic breakpoints for 'main', not caring that the symbol is actually
|
|
|
|
# called 'qt_main' now.
|
|
|
|
|
2013-10-29 13:14:03 +00:00
|
|
|
macx-xcode {
|
2014-11-06 15:14:32 +00:00
|
|
|
objects_dir = "${OBJECT_FILE_DIR}-${CURRENT_VARIANT}"
|
|
|
|
archs = "${ARCHS}"
|
2013-10-29 13:14:03 +00:00
|
|
|
} else {
|
|
|
|
objects_dir = $$OBJECTS_DIR
|
|
|
|
isEmpty(objects_dir): \
|
|
|
|
objects_dir = .
|
2014-11-06 15:14:32 +00:00
|
|
|
archs = "$$QMAKE_IOS_DEVICE_ARCHS $$QMAKE_IOS_SIMULATOR_ARCHS"
|
2013-10-29 13:14:03 +00:00
|
|
|
}
|
2013-10-16 17:06:47 +00:00
|
|
|
|
|
|
|
!isEmpty(QMAKE_PRE_LINK): \
|
|
|
|
QMAKE_PRE_LINK += ";"
|
|
|
|
|
2014-11-06 15:14:32 +00:00
|
|
|
QMAKE_PRE_LINK += $$QMAKESPEC/rename_main.sh $${objects_dir} \"$${archs}\"
|
iOS: Change main-wrapper logic to not require changing the user's main
Instead of using a define to rename the user's main() function during
compilation, we leave the user code alone, and inject our wrapper one
step earlier in the process, at the application entry point 'start'.
This entry point is provided by crt1.o, which is normally linked into
the application automatically. The start() function sets up some state
and then calls main(), but we change the start() function to instead
call our main wrapper.
Instead of shipping our own crt1 binary/sources, we make a copy of
the appropriate crt1.o at build time, and modify its symbol table in
place. This is unproblematic as long as we keep the same length for
the wrapper function name, as the symbol names are just entries in
the global string table of the object file.
The result is that for the regular Qt use-case the user won't see
any changes to their main function, and we have more control over
the startup sequence. For the hybrid use-case, we no longer rely
on the fragile solution of having our back-up 'main' symbol in
a single translation unit, which would break eg with --load_all,
and we don't need to provide a dummy 'qt_user_main' symbol.
OSX 10.8 and iOS 6.0 introduced a new load command called LC_MAIN,
which places the state setup in the shared dyld, and then just
calls main() directly. Once we bump the minimum deployment target
to iOS 6.0 we can start using this loader instead of LC_UNIXTHREAD,
but for now we force the classic loader using the -no_new_main flag.
There's also a bug in the ld64 linker provided by the current Xcode
toolchains that results in the -e linker flag (to set the entry
point) having no effect, but hopefully this bug has been fixed
(or Apple has switched to the LLVM lld linker) by the time we
bump our deployment target.
Change-Id: Ie0ba869c13ddc5277dc95c539aebaeb60e949dc2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2013-09-06 21:16:28 +00:00
|
|
|
}
|
2013-06-26 14:47:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
load(qt)
|