f4942c3cc1
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>
77 lines
2.7 KiB
Plaintext
77 lines
2.7 KiB
Plaintext
|
|
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
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
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 = arm
|
|
else: QT_ARCH = i386 # Simulator
|
|
}
|
|
|
|
# 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)
|