diff options
Diffstat (limited to 'qmake/generators')
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 66 | ||||
-rw-r--r-- | qmake/generators/projectgenerator.cpp | 11 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 9 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 102 |
4 files changed, 142 insertions, 46 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index dce22ed712..feedec298a 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1113,6 +1113,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } bool copyBundleResources = project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app"; ProStringList bundle_resources_files; + ProStringList embedded_frameworks; + QMap<ProString, ProStringList> embedded_plugins; // Copy Bundle Data if (!project->isEmpty("QMAKE_BUNDLE_DATA")) { ProStringList bundle_file_refs; @@ -1123,6 +1125,11 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) for(int i = 0; i < bundle_data.count(); i++) { ProStringList bundle_files; ProString path = project->first(ProKey(bundle_data[i] + ".path")); + const bool isEmbeddedFramework = ((!osx && path == QLatin1String("Frameworks")) + || (osx && path == QLatin1String("Contents/Frameworks"))); + const ProString pluginsPrefix = ProString(osx ? QLatin1String("Contents/PlugIns") : QLatin1String("PlugIns")); + const bool isEmbeddedPlugin = (path == pluginsPrefix) || path.startsWith(pluginsPrefix + "/"); + //all files const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); for(int file = 0; file < files.count(); file++) { @@ -1140,19 +1147,29 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) bundle_files += file_key; t << "\t\t" << file_key << " = {\n" << "\t\t\t" << writeSettings("fileRef", file_ref_key) << ";\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";\n" - << "\t\t};\n"; + << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";\n"; + if (isEmbeddedFramework || isEmbeddedPlugin || name.endsWith(".dylib") || name.endsWith(".framework")) + t << "\t\t\t" << writeSettings("settings", "{ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }", SettingsNoQuote) << ";\n"; + t << "\t\t};\n"; } if (copyBundleResources && ((!osx && path.isEmpty()) || (osx && path == QLatin1String("Contents/Resources")))) { for (const ProString &s : qAsConst(bundle_files)) bundle_resources_files << s; + } else if (copyBundleResources && isEmbeddedFramework) { + for (const ProString &s : qAsConst(bundle_files)) + embedded_frameworks << s; + } else if (copyBundleResources && isEmbeddedPlugin) { + for (const ProString &s : qAsConst(bundle_files)) { + ProString subpath = (path == pluginsPrefix) ? ProString() : path.mid(pluginsPrefix.size() + 1); + embedded_plugins[subpath] << s; + } } else { QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); - if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) { - //### - } + //if (!project->isActiveConfig("shallow_bundle") + // && !project->isEmpty(ProKey(bundle_data[i] + ".version"))) { + //} project->values("QMAKE_PBX_BUILDPHASES").append(phase_key); t << "\t\t" << phase_key << " = {\n" @@ -1196,6 +1213,35 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("name", grp) << ";\n" << "\t\t};\n"; + + QString grp2("Embed Frameworks"), key2 = keyFor(grp2); + project->values("QMAKE_PBX_BUILDPHASES").append(key2); + t << "\t\t" << key2 << " = {\n" + << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("dstPath", "") << ";\n" + << "\t\t\t" << writeSettings("dstSubfolderSpec", "10", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("files", embedded_frameworks, SettingsAsList, 4) << ";\n" + << "\t\t\t" << writeSettings("name", grp2) << ";\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" + << "\t\t};\n"; + + QMapIterator<ProString, ProStringList> it(embedded_plugins); + while (it.hasNext()) { + it.next(); + QString suffix = !it.key().isEmpty() ? (" (" + it.key() + ")") : QString(); + QString grp3("Embed PlugIns" + suffix), key3 = keyFor(grp3); + project->values("QMAKE_PBX_BUILDPHASES").append(key3); + t << "\t\t" << key3 << " = {\n" + << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("dstPath", it.key()) << ";\n" + << "\t\t\t" << writeSettings("dstSubfolderSpec", "13", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("files", it.value(), SettingsAsList, 4) << ";\n" + << "\t\t\t" << writeSettings("name", grp3) << ";\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" + << "\t\t};\n"; + } } //REFERENCE @@ -1515,9 +1561,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/projectgenerator.cpp b/qmake/generators/projectgenerator.cpp index e45217cb45..790de30a0c 100644 --- a/qmake/generators/projectgenerator.cpp +++ b/qmake/generators/projectgenerator.cpp @@ -344,6 +344,17 @@ ProjectGenerator::writeMakefile(QTextStream &t) << getWritableVar("CONFIG_REMOVE", false) << getWritableVar("INCLUDEPATH") << endl; + t << "# The following define makes your compiler emit warnings if you use\n" + "# any feature of Qt which as been marked as deprecated (the exact warnings\n" + "# depend on your compiler). Please consult the documentation of the\n" + "# deprecated API in order to know how to port your code away from it.\n" + "DEFINES += QT_DEPRECATED_WARNINGS\n" + "\n" + "# You can also make your code fail to compile if you use deprecated APIs.\n" + "# In order to do so, uncomment the following line.\n" + "# You can also select to disable deprecated APIs only up to a certain version of Qt.\n" + "#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0\n\n"; + t << "# Input" << "\n"; t << getWritableVar("HEADERS") << getWritableVar("FORMS") diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 349dcd2f40..794d04a6e9 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -599,10 +599,13 @@ UnixMakefileGenerator::defaultInstall(const QString &t) plain_targ = escapeFilePath(plain_targ); if (bundle != NoBundle) { QString suffix; - if (project->first("TEMPLATE") == "lib") - suffix = "/Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/$(TARGET)"; - else + if (project->first("TEMPLATE") == "lib") { + if (!project->isActiveConfig("shallow_bundle")) + suffix += "/Versions/" + project->first("QMAKE_FRAMEWORK_VERSION"); + suffix += "/$(TARGET)"; + } else { suffix = "/" + project->first("QMAKE_BUNDLE_LOCATION") + "/$(QMAKE_TARGET)"; + } dst_targ += suffix; if (bundle == SolidBundle) { if (!ret.isEmpty()) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 6fa355390f..3d12ffd65c 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -596,9 +596,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << var("QMAKE_LINK_SHLIB_CMD") << "\n\t" << mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGETD)`\"", false) << "\n\t" << "-$(MOVE) $(TARGET) $(DESTDIR)$(TARGETD)\n\t" - << mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGET0)`\"", false) << "\n\t" - << varGlue("QMAKE_LN_SHLIB", "-", " ", - " Versions/Current/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"; + << mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGET0)`\"", false) << "\n\t"; + if (!project->isActiveConfig("shallow_bundle")) + t << varGlue("QMAKE_LN_SHLIB", "-", " ", + " Versions/Current/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"; if(!project->isEmpty("QMAKE_POST_LINK")) t << "\n\t" << var("QMAKE_POST_LINK"); t << endl << endl; @@ -777,10 +778,17 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } else { info_plist = escapeFilePath(fileFixify(info_plist)); } - bool isFramework = project->first("TEMPLATE") == "lib" && project->isActiveConfig("lib_bundle"); + bool isFramework = project->first("TEMPLATE") == "lib" + && !project->isActiveConfig("plugin") + && project->isActiveConfig("lib_bundle"); + bool isShallowBundle = project->isActiveConfig("shallow_bundle"); QString info_plist_out = bundle_dir + - (isFramework ? ("Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/Resources/Info.plist") - : "Contents/Info.plist"); + (!isShallowBundle + ? (isFramework + ? ("Versions/" + project->first("QMAKE_FRAMEWORK_VERSION") + "/Resources/") + : "Contents/") + : QString()) + + "Info.plist"; bundledFiles << info_plist_out; alldeps << info_plist_out; QString destdir = info_plist_out.section(Option::dir_sep, 0, -2); @@ -814,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; @@ -838,12 +854,17 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "@$(COPY_FILE) " << escapeFilePath(icon) << ' ' << icon_path_f << endl; } } else { - symlinks[bundle_dir + "Resources"] = "Versions/Current/Resources"; + 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\" " @@ -857,18 +878,20 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) for(int i = 0; i < bundle_data.count(); i++) { const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); QString path = bundle_dir; - const ProKey vkey(bundle_data[i] + ".version"); const ProKey pkey(bundle_data[i] + ".path"); - if (!project->isEmpty(vkey)) { - QString version = project->first(vkey) + "/" + - project->first("QMAKE_FRAMEWORK_VERSION") + "/"; - ProString name = project->first(pkey); - int pos = name.indexOf('/'); - if (pos > 0) - name = name.mid(0, pos); - symlinks[Option::fixPathToTargetOS(path + name)] = - project->first(vkey) + "/Current/" + name; - path += version; + if (!project->isActiveConfig("shallow_bundle")) { + const ProKey vkey(bundle_data[i] + ".version"); + if (!project->isEmpty(vkey)) { + QString version = project->first(vkey) + "/" + + project->first("QMAKE_FRAMEWORK_VERSION") + "/"; + ProString name = project->first(pkey); + int pos = name.indexOf('/'); + if (pos > 0) + name = name.mid(0, pos); + symlinks[Option::fixPathToTargetOS(path + name)] = + project->first(vkey) + "/Current/" + name; + path += version; + } } path += project->first(pkey).toQString(); path = Option::fixPathToTargetOS(path); @@ -906,15 +929,17 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) << "@$(SYMLINK) " << escapeFilePath(symIt.value()) << ' ' << bundle_dir_f << endl; } - QString currentLink = bundle_dir + "Versions/Current"; - QString currentLink_f = escapeDependencyPath(currentLink); - bundledFiles << currentLink; - alldeps << currentLink; - t << currentLink_f << ": $(MAKEFILE)\n\t" - << mkdir_p_asstring(bundle_dir + "Versions") << "\n\t" - << "@-$(DEL_FILE) " << currentLink_f << "\n\t" - << "@$(SYMLINK) " << project->first("QMAKE_FRAMEWORK_VERSION") - << ' ' << currentLink_f << endl; + if (!project->isActiveConfig("shallow_bundle")) { + QString currentLink = bundle_dir + "Versions/Current"; + QString currentLink_f = escapeDependencyPath(currentLink); + bundledFiles << currentLink; + alldeps << currentLink; + t << currentLink_f << ": $(MAKEFILE)\n\t" + << mkdir_p_asstring(bundle_dir + "Versions") << "\n\t" + << "@-$(DEL_FILE) " << currentLink_f << "\n\t" + << "@$(SYMLINK) " << project->first("QMAKE_FRAMEWORK_VERSION") + << ' ' << currentLink_f << endl; + } } } @@ -1186,12 +1211,17 @@ void UnixMakefileGenerator::init2() bundle_loc.prepend("/"); if(!bundle_loc.endsWith("/")) bundle_loc += "/"; - project->values("TARGET_").append(project->first("QMAKE_BUNDLE") + - bundle_loc + project->first("TARGET")); - project->values("TARGET_x.y").append(project->first("QMAKE_BUNDLE") + - "/Versions/" + - project->first("QMAKE_FRAMEWORK_VERSION") + - bundle_loc + project->first("TARGET")); + const QString target = project->first("QMAKE_BUNDLE") + + bundle_loc + project->first("TARGET"); + project->values("TARGET_").append(target); + if (!project->isActiveConfig("shallow_bundle")) { + project->values("TARGET_x.y").append(project->first("QMAKE_BUNDLE") + + "/Versions/" + + project->first("QMAKE_FRAMEWORK_VERSION") + + bundle_loc + project->first("TARGET")); + } else { + project->values("TARGET_x.y").append(target); + } } else if(project->isActiveConfig("plugin")) { QString prefix; if(!project->isActiveConfig("no_plugin_name_prefix")) |