diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2012-12-06 14:06:25 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2013-02-27 13:07:22 +0100 |
commit | 5b99d46b3985b435fbf4b786a4abaf77714711d0 (patch) | |
tree | 2a0d8ddbd4412ca0d63b97f1ccc2df74d48aa610 /mkspecs/features | |
parent | 77168c03ffb2d8eeef231766e4322601495778c9 (diff) |
iOS: Link to the platform plugin and iosmain plugin and define main
Ideally we'd only have to do QTPLUGIN += ios, but this doesn't work as
we need to link with the force_load linker option. Even trying to build
on QTPLUGIN and then replace the -l line with what we need will fail, as
the prl logic in qmake which runs after all the prf files does not know
about the force_load option and will then fail to resolve dependencies
from the prl file.
Since we load the platform plugin using -force_load, there's no need to
generate a cpp file that does the plugin import.
The main wrapper is not a real Qt plugin, and doesn't have an import
function that we can call, so we link it manually instead of relying
on QTPLUGIN.
Change-Id: I0381a3c9ed7f8d41a4121e1fc0b7c0e210a8b832
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'mkspecs/features')
-rw-r--r-- | mkspecs/features/ios/default_post.prf | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf index 3e9d12be3b..6c6d8d89ce 100644 --- a/mkspecs/features/ios/default_post.prf +++ b/mkspecs/features/ios/default_post.prf @@ -10,4 +10,26 @@ isEmpty(MAKEFILE_GENERATOR) { MAKEFILE_GENERATOR = UNIX } +gui_app { + # We have to do the link and dependency resolution for the platform plugin + # manually, since QTPLUGIN and the prl lookup logic does not support + # the -force_load link style. The -force_load option ensures that all + # symbols from the static library are included, not just the ones the + # linker have seen a use for so far. We need this because we load the platform + # plugin from the platform plugin itself, using Q_IMPORT_PLUGIN. + lib_path_and_base = $$[QT_INSTALL_PLUGINS/get]/platforms/libqios$$qtPlatformTargetSuffix() + LIBS += "-force_load $${lib_path_and_base}.$${QMAKE_EXTENSION_STATICLIB}" + LIBS += $$fromfile($${lib_path_and_base}.prl, QMAKE_PRL_LIBS) + + # Which means we don't want the auto-generated import for the platform plugin + CONFIG -= import_qpa_plugin + + # We link the iosmain library manually as well, since it's not really a plugin + lib_name = qiosmain + lib_path_and_base = $$[QT_INSTALL_PLUGINS/get]/platforms/lib$${lib_name}$$qtPlatformTargetSuffix() + LIBS += -L$$[QT_INSTALL_PLUGINS/get]/platforms -l$${lib_name}$$qtPlatformTargetSuffix() + LIBS += $$fromfile($${lib_path_and_base}.prl, QMAKE_PRL_LIBS) + DEFINES += main=qt_main +} + load(default_post) |