summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@digia.com>2014-10-22 17:37:02 +0200
committerFawzi Mohamed <fawzi.mohamed@digia.com>2014-10-30 14:03:50 +0100
commitaf5f6e35b6f17e06a85aee445d97e61b6b4bba3e (patch)
treee7dea03af1ae88b62430d2f2ab3853e5525b9abc
parent1487a93e46bafb4ee7beb63e59b90265f0ae1fd3 (diff)
xcodegenerator: use a copy resource phase if possible
Since commmit 0127962e4772d6c758b954b2fe1d4b676d366b4c the PBXResourcesBuildPhase is used only for ICONS, because the old behavior of using it when target path is not given differed from the documentation and behavior of the makefile generator by using Contents/Resources as target directory when targeting osx. The PBXResouceBuildPhase optimizes png, compiles xib or asset catalogs and copies the rest. The advantage is that it makes it easy to add resources to the bundle, the only problem is that the target directory is always the resource directory. The copy operation currently used does not compile resources, which makes adding .xib (for the Launch File required to support iphone 6) and asset catalogs difficult. So we restore the old 5.3 behavior for ios, and use the build resources phase when possible on osx (target Contents/Resources). On osx this still implies a difference between the makefile generator and the xcode generator: only the latter compiles resources. Change-Id: Id1853693e88fc46562b044efdea2bf5f9da2c98c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp40
1 files changed, 24 insertions, 16 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 3659621391..4624496e99 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -1107,9 +1107,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("shellScript", fixForOutput("cp -r $BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME " + escapeFilePath(destDir))) << ";\n"
<< "\t\t};\n";
}
+ bool copyBundleResources = project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app";
+ ProStringList bundle_resources_files;
// Copy Bundle Data
if (!project->isEmpty("QMAKE_BUNDLE_DATA")) {
ProStringList bundle_file_refs;
+ bool ios = project->isActiveConfig("ios");
//all bundle data
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
@@ -1137,21 +1140,27 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t};\n";
}
- QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]);
- if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) {
- //###
- }
+ if (copyBundleResources && ((ios && path.isEmpty())
+ || (!ios && path == QLatin1String("Contents/Resources")))) {
+ foreach (const ProString &s, bundle_files)
+ bundle_resources_files << s;
+ } else {
+ QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]);
+ if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) {
+ //###
+ }
- project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
- t << "\t\t" << phase_key << " = {\n"
- << "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";\n"
- << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
- << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";\n"
- << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";\n"
- << "\t\t\t" << writeSettings("files", bundle_files, SettingsAsList, 4) << ";\n"
- << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n"
- << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
- << "\t\t};\n";
+ project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
+ t << "\t\t" << phase_key << " = {\n"
+ << "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";\n"
+ << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
+ << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";\n"
+ << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";\n"
+ << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n"
+ << "\t\t\t" << writeSettings("files", bundle_files, SettingsAsList, 4) << ";\n"
+ << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
+ << "\t\t};\n";
+ }
}
QString bundle_data_key = keyFor("QMAKE_PBX_BUNDLE_DATA");
@@ -1166,8 +1175,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
// Copy bundle resources. Optimizes resources, and puts them into the Resources
// subdirectory on OSX, but doesn't support paths.
- if (project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app") {
- ProStringList bundle_resources_files;
+ if (copyBundleResources) {
if (!project->isEmpty("ICON")) {
ProString icon = project->first("ICON");
if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0)))