From 5b99d46b3985b435fbf4b786a4abaf77714711d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 6 Dec 2012 14:06:25 +0100 Subject: 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 --- mkspecs/features/ios/default_post.prf | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'mkspecs') 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) -- cgit v1.2.3