summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-02-18 01:01:38 -0800
committerJake Petroules <jake.petroules@qt.io>2016-08-26 03:53:16 +0000
commit2e3a58501395ef3812ca987bec093ff286cb63f1 (patch)
tree5268685899ca949a8bcb94b81def0ed2d298f917 /qmake
parentf607233c7ce899c27034eca01c23b0da2895bf93 (diff)
qmake: Use correct CFBundleExecutable in framework bundles
This fixes a bug where joined device and simulator builds would get for example, QtCore_iphonesimulator as the CFBundleExecutable. According to Apple: "For frameworks, the value of this key is REQUIRED to be the same as the framework name, minus the .framework extension." This does not affect the ability to load a framework whose executable name differs from the bundle name (as is the case for simulator builds), as the application will be linked to the correct framework executable at link time by specifying (for example) the linker flag: -framework QtCore,_iphonesimulator Change-Id: Ib7614670d0620e0235cd7e2606d42dd034a90c68 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp10
-rw-r--r--qmake/generators/unix/unixmake2.cpp18
2 files changed, 23 insertions, 5 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index b53b862b87..09581879ef 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -1480,9 +1480,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
plist_in_text.replace(QLatin1String("@ICON@"),
(project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1)));
if (project->first("TEMPLATE") == "app") {
- plist_in_text.replace(QLatin1String("@EXECUTABLE@"), project->first("QMAKE_ORIG_TARGET").toQString());
+ ProString app_bundle_name = project->first("QMAKE_APPLICATION_BUNDLE_NAME");
+ if (app_bundle_name.isEmpty())
+ app_bundle_name = project->first("QMAKE_ORIG_TARGET");
+ plist_in_text.replace(QLatin1String("@EXECUTABLE@"), app_bundle_name.toQString());
} else {
- plist_in_text.replace(QLatin1String("@LIBRARY@"), project->first("QMAKE_ORIG_TARGET").toQString());
+ ProString lib_bundle_name = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
+ if (lib_bundle_name.isEmpty())
+ lib_bundle_name = project->first("QMAKE_ORIG_TARGET");
+ plist_in_text.replace(QLatin1String("@LIBRARY@"), lib_bundle_name.toQString());
}
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
if (bundlePrefix.isEmpty())
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 5d9bcf4ec2..2d6885076d 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -822,14 +822,22 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
commonSedArgs << "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" ";
if (!isFramework) {
+ ProString app_bundle_name = var("QMAKE_APPLICATION_BUNDLE_NAME");
+ if (app_bundle_name.isEmpty())
+ app_bundle_name = var("QMAKE_ORIG_TARGET");
+
+ ProString plugin_bundle_name = var("QMAKE_PLUGIN_BUNDLE_NAME");
+ if (plugin_bundle_name.isEmpty())
+ plugin_bundle_name = var("QMAKE_ORIG_TARGET");
+
QString icon = fileFixify(var("ICON"));
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
<< "@sed ";
for (const ProString &arg : qAsConst(commonSedArgs))
t << arg;
t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
- << "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
- << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
+ << "-e \"s,@EXECUTABLE@," << app_bundle_name << ",g\" "
+ << "-e \"s,@LIBRARY@," << plugin_bundle_name << ",g\" "
<< "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
<< "" << info_plist << " >" << info_plist_out << endl;
@@ -846,13 +854,17 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "@$(COPY_FILE) " << escapeFilePath(icon) << ' ' << icon_path_f << endl;
}
} else {
+ ProString lib_bundle_name = var("QMAKE_FRAMEWORK_BUNDLE_NAME");
+ if (lib_bundle_name.isEmpty())
+ lib_bundle_name = var("QMAKE_ORIG_TARGET");
+
if (!isShallowBundle)
symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources";
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
<< "@sed ";
for (const ProString &arg : qAsConst(commonSedArgs))
t << arg;
- t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
+ t << "-e \"s,@LIBRARY@," << lib_bundle_name << ",g\" "
<< "-e \"s,@TYPEINFO@,"
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "