Xcode: Use output directory as SYMROOT when shadow-building

Setting the CONFIGURATION_BUILD_DIR variable to tell Xcode where to
place the final application bundle confuses Xcode when archiving
a project, and the archive ends up without the dSYM files.

Unfortunately we can't leave it up to Xcode to place the build
artifacts wherever it wants, as Qt Creator's iOS support expects
to find the artifacts in a well-defined place. Until we've taught
Qt Creator to find the artifacts for deployment where Xcode placed
them we need to keep this logic.

We now avoid setting the CONFIGURATION_BUILD_DIR variable unless we
really need to due to in-source builds. As long as we're dealing with
a shadow-build it's okey to set SYMROOT.

Change-Id: I9661c1c57725dc8ba5a21f8467b8b61834f2e64d
Fixes: QTBUG-74841
Task-number: QTBUG-52474
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-12-05 16:08:11 +01:00
parent 1dca7087e9
commit f733c1c6e7

View File

@ -1629,17 +1629,24 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
}
}
// The symroot is marked by xcodebuild as excluded from Time Machine
// backups, as it's a temporary build dir, so we don't want it to be
// the same as the possibe in-source dir, as that would leave out
// sources from being backed up.
t << "\t\t\t\t" << writeSettings("SYMROOT",
Option::output_dir + Option::dir_sep + ".xcode") << ";\n";
if (Option::output_dir != qmake_getpwd()) {
// The SYMROOT is marked by Xcode as excluded from Time Machine
// backups, as it's a temporary build dir, but that's fine when
// we are shadow building.
t << "\t\t\t\t" << writeSettings("SYMROOT", "$(PROJECT_DIR)") << ";\n";
} else {
// For in-source builds we don't want to exclude the sources
// from being backed up, so we point SYMROOT to a temporary
// build directory.
t << "\t\t\t\t" << writeSettings("SYMROOT", ".xcode") << ";\n";
// The configuration build dir however is not treated as excluded,
// so we can safely point it to the root output dir.
// Then we set the configuration build dir instead, so that the
// final build artifacts end up in the place Qt Creator expects.
// The disadvantage of using this over SYMROOT is that Xcode will
// fail to archive projects that override this variable.
t << "\t\t\t\t" << writeSettings("CONFIGURATION_BUILD_DIR",
Option::output_dir + Option::dir_sep + "$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)") << ";\n";
"$(PROJECT_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)") << ";\n";
}
if (!project->isEmpty("DESTDIR")) {
ProString dir = project->first("DESTDIR");