From 77168c03ffb2d8eeef231766e4322601495778c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 23 Nov 2012 13:26:50 +0100 Subject: iOS: Make Xcode output the default for GUI applications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As long as Qt Creator does not provide any iOS integration, and the app bundle we create using the Makefile generator is not good enough to deploy to a device anyways, producing Xcode projects make the most sense. We base the decicion on whether or not the project depends on QtGui and has app_bundles enabled. This prevents configure tests and other tools from having Xcode projects, but allows examples and demos to build out of the box. Instead of setting the generator unconditionally we unset it in default_pre so that we can detect if the user set it manually. This means the user won't be able to inspect the MAKEFILE_GENERATOR variable from the pro file, but this is less of a use-case then overriding the generator from the command line or prooject file. Change-Id: I881cf3e29631445f83ea4ff0979f7a566e4810f5 Reviewed-by: Morten Johan Sørvig Reviewed-by: Richard Moe Gustavsen --- mkspecs/features/ios/default_post.prf | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 mkspecs/features/ios/default_post.prf (limited to 'mkspecs/features/ios/default_post.prf') diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf new file mode 100644 index 0000000000..3e9d12be3b --- /dev/null +++ b/mkspecs/features/ios/default_post.prf @@ -0,0 +1,13 @@ + +CONFIG(qt):contains(QT, gui):equals(TEMPLATE, app): CONFIG += gui_app + +isEmpty(MAKEFILE_GENERATOR) { + gui_app:app_bundle: \ + # For applications we want Xcode project files + MAKEFILE_GENERATOR = XCODE + else: \ + # For libs, etc we still want regular Makefiles + MAKEFILE_GENERATOR = UNIX +} + +load(default_post) -- cgit v1.2.3 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/features/ios/default_post.prf') 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 From e846edff33ecbd3fc5f4206febc01265ef916d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 26 Feb 2013 13:36:21 +0100 Subject: iOS: Allow projects to disable the main wrapper In case they provide their own main that calls UIApplicationMain. Change-Id: Ia050277ae5cbcbf01bc57b87ec37a74db9568059 Reviewed-by: Richard Moe Gustavsen --- mkspecs/features/ios/default_post.prf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'mkspecs/features/ios/default_post.prf') diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf index 6c6d8d89ce..e4221e4b65 100644 --- a/mkspecs/features/ios/default_post.prf +++ b/mkspecs/features/ios/default_post.prf @@ -24,12 +24,14 @@ gui_app { # 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 + !no_main_wrapper { + # 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 From 5da648043df5b2e8ccfa720ee56b04dea47c0601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 6 Dec 2012 15:29:05 +0100 Subject: iOS: Target both iPhone and iPad by default Change-Id: I3122b9391c6187da17389c889a456c58210dca09 Reviewed-by: Richard Moe Gustavsen --- mkspecs/features/ios/default_post.prf | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mkspecs/features/ios/default_post.prf') diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf index e4221e4b65..f5e7b3c02d 100644 --- a/mkspecs/features/ios/default_post.prf +++ b/mkspecs/features/ios/default_post.prf @@ -34,4 +34,10 @@ gui_app { } } +contains(MAKEFILE_GENERATOR, XCODE) { + ios_device_family.name = TARGETED_DEVICE_FAMILY + ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY + QMAKE_MAC_XCODE_SETTINGS += ios_device_family +} + load(default_post) -- cgit v1.2.3 From ae39a84603a91a7de8dbc23e677827bcdb12e996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Mar 2013 14:54:06 +0100 Subject: iOS: Move arch handling out of ios.prf now that we have default_post.prf Change-Id: Ifad6463414d4fb055007653d06f2c17ca5ee953e Reviewed-by: Richard Moe Gustavsen --- mkspecs/features/ios/default_post.prf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'mkspecs/features/ios/default_post.prf') diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf index f5e7b3c02d..e9d2149351 100644 --- a/mkspecs/features/ios/default_post.prf +++ b/mkspecs/features/ios/default_post.prf @@ -40,4 +40,30 @@ contains(MAKEFILE_GENERATOR, XCODE) { QMAKE_MAC_XCODE_SETTINGS += ios_device_family } +isEmpty(QT_ARCH) { + # The iPhoneOS and iPhoneSimulator targets share the same toolchain, + # so when configure runs the arch tests it passes the correct sysroot, + # but we fail to pick up the architecture since we're not passing -arch + # yet. Xcode does not seem to have a way to run the shared toolchain + # in a way that will automatically do this (for example xcrun -sdk). + contains(QMAKE_MAC_SDK, iphoneos.*): QT_ARCH = armv7 + else: QT_ARCH = i386 # Simulator +} else { + # Fix up the QT_ARCH to be more specific + equals(QT_ARCH, arm) { + # Samsung S5PC100, Apple A4, A5, A5X + QT_ARCH = armv7 + + # FIXME: How do we support armv7s when Qt can't do universal builds? + } +} + +!equals(MAKEFILE_GENERATOR, XCODE) { + arch_flag = -arch $$QT_ARCH + QMAKE_CFLAGS += $$arch_flag + QMAKE_CXXFLAGS += $$arch_flag + QMAKE_OBJECTIVE_CFLAGS += $$arch_flag + QMAKE_LFLAGS += $$arch_flag +} + load(default_post) -- cgit v1.2.3