summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-06-27 12:02:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-13 01:38:54 +0200
commitf4942c3cc17e7d68724cc43fc1519898bcaee87c (patch)
tree65869a99b621dc7efc2d30bc451ce72698aa5bb6
parent8abeda08dd1701dc591ab6fa972d8dd406cbdb8b (diff)
iOS: Wrap Xcode projects in Makefile for convenience and subdirs support
qmake expects the generator to be the same for each node in the tree of subdirs, including the leaf projects, which caused failures when qmake tried to recurse out to the leaf projects and run 'make', when the leaf project was an Xcode project. We now wrap the Xcode project in a meta-makefile that just calls out to xcodebuild to do the actual work. This allows us to get rid of the hacky generator detection, and use the macx-xcode mkspec instead of setting the generator, which is much cleaner. Change-Id: I2fed6a4dd6343b6a320eb459ecae824553bff459 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
-rw-r--r--mkspecs/features/configure.prf3
-rw-r--r--mkspecs/features/ios/default_post.prf50
-rw-r--r--mkspecs/features/ios/default_pre.prf2
3 files changed, 39 insertions, 16 deletions
diff --git a/mkspecs/features/configure.prf b/mkspecs/features/configure.prf
index b4569df6d5..39144e7216 100644
--- a/mkspecs/features/configure.prf
+++ b/mkspecs/features/configure.prf
@@ -7,9 +7,6 @@ equals(MAKEFILE_GENERATOR, UNIX) {
QMAKE_MAKE = mingw32-make
} else:if(equals(MAKEFILE_GENERATOR, MSVC.NET)|equals(MAKEFILE_GENERATOR, MSBUILD)) {
QMAKE_MAKE = nmake
-} else:ios {
- # iOS unsets MAKEFILE_GENERATOR in its default_pre.prf
- QMAKE_MAKE = make
} else {
error("Configure tests are not supported with the $$MAKEFILE_GENERATOR Makefile generator.")
}
diff --git a/mkspecs/features/ios/default_post.prf b/mkspecs/features/ios/default_post.prf
index abd82b955a..654255eb1f 100644
--- a/mkspecs/features/ios/default_post.prf
+++ b/mkspecs/features/ios/default_post.prf
@@ -1,16 +1,44 @@
-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
+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
+
+ 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")
+
+ # 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
+
+ # 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
+
+ # 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
@@ -32,7 +60,7 @@ equals(QT_ARCH, arm): \
else: \
actual_archs = $$QT_ARCH
-equals(MAKEFILE_GENERATOR, XCODE) {
+macx-xcode {
QMAKE_XCODE_ARCHS = $$actual_archs
} else {
for(arch, actual_archs): \
diff --git a/mkspecs/features/ios/default_pre.prf b/mkspecs/features/ios/default_pre.prf
index 7cfbc03eb5..5db8d98d6c 100644
--- a/mkspecs/features/ios/default_pre.prf
+++ b/mkspecs/features/ios/default_pre.prf
@@ -1,5 +1,3 @@
-# Unset makefile generator, so we can auto-detect value in default_post
-!macx-xcode: unset(MAKEFILE_GENERATOR)
load(default_pre)