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>
This commit is contained in:
parent
77168c03ff
commit
5b99d46b39
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user