diff options
Diffstat (limited to 'mkspecs/features/ios/default_post.prf')
-rw-r--r-- | mkspecs/features/ios/default_post.prf | 95 |
1 files changed, 51 insertions, 44 deletions
diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf index e9d2149351..654255eb1f 100644 --- a/mkspecs/features/ios/default_post.prf +++ b/mkspecs/features/ios/default_post.prf @@ -1,40 +1,44 @@ -CONFIG(qt):contains(QT, gui):equals(TEMPLATE, app): CONFIG += gui_app +equals(TEMPLATE, app) { + qt:app_bundle:!macx-xcode { + # For Qt applications we want Xcode project files as the generated output, + # but since qmake doesn't handle the transition between makefiles and Xcode + # project files (which happens when using subdirs), we create a wrapper + # makefile that takes care of generating the Xcode project, and allows + # building by calling out to xcodebuild. + TEMPLATE = aux -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 -} + CONFIG -= have_target qt staticlib dll + SOURCES = + RESOURCES = + INSTALLS = + + TARGET_XCODE_PROJECT_DIR = $${TARGET}.xcodeproj + + system("cd $$system_quote($$OUT_PWD) && $${QMAKE_QMAKE} $$system_quote($$_PRO_FILE_) -spec macx-xcode") -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) + # We use xcodebuild to do the actual build, but filter out the verbose + # output that shows all environment variables for each build step. + xcodebuild_build.commands = "@xcodebuild build | grep -v setenv" + QMAKE_EXTRA_TARGETS += xcodebuild_build + all.depends = xcodebuild_build + QMAKE_EXTRA_TARGETS += all - # Which means we don't want the auto-generated import for the platform plugin - CONFIG -= import_qpa_plugin + # We do the same for the clean action + xcodebuild_clean.commands = "@xcodebuild clean" + QMAKE_EXTRA_TARGETS += xcodebuild_clean + clean.depends = xcodebuild_clean + QMAKE_EXTRA_TARGETS += clean - !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 + # And distclean + xcodebuild_distclean.commands = "$(DEL_FILE) -R $$TARGET_XCODE_PROJECT_DIR" + QMAKE_EXTRA_TARGETS += xcodebuild_distclean + distclean.depends = xcodebuild_distclean + QMAKE_EXTRA_TARGETS += distclean } } -contains(MAKEFILE_GENERATOR, XCODE) { +macx-xcode { ios_device_family.name = TARGETED_DEVICE_FAMILY ios_device_family.value = $$QMAKE_IOS_TARGETED_DEVICE_FAMILY QMAKE_MAC_XCODE_SETTINGS += ios_device_family @@ -46,24 +50,27 @@ isEmpty(QT_ARCH) { # 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 + contains(QMAKE_MAC_SDK, iphoneos.*): QT_ARCH = arm 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 +# Be more specific about which architecture we're targeting +equals(QT_ARCH, arm): \ + actual_archs = armv7 +else: \ + actual_archs = $$QT_ARCH + +macx-xcode { + QMAKE_XCODE_ARCHS = $$actual_archs +} else { + for(arch, actual_archs): \ + arch_flags += -arch $$arch + + QMAKE_CFLAGS += $$arch_flags + QMAKE_CXXFLAGS += $$arch_flags + QMAKE_OBJECTIVE_CFLAGS += $$arch_flags + QMAKE_LFLAGS += $$arch_flags } +unset(actual_archs) load(default_post) |