Skip to content

Commit 1185f65

Browse files
committed
QMake: Add ability to link against xcframeworks with Xcode
This adds rudimentary support for linking against xcframeworks. We can now do LIBS += /absolute/path/to/some.xcframework and this will end up in the frameworks section of the Xcode project. This is required for linking against the FFmpeg xcframeworks we're providing for iOS. Pick-to: 6.8 6.9 Task-number: QTBUG-86387 Task-number: QTBUG-129651 Change-Id: Id212700d3554689160d23eafb26d99ac43b91062 Reviewed-by: Alexandru Croitor <[email protected]>
1 parent 83b6139 commit 1185f65

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

qmake/generators/mac/pbuilder_pbx.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ static QString xcodeFiletypeForFilename(const QString &filename)
450450
return QStringLiteral("sourcecode.c.objc");
451451
if (filename.endsWith(QLatin1String(".framework")))
452452
return QStringLiteral("wrapper.framework");
453+
if (filename.endsWith(QLatin1String(".xcframework")))
454+
return QStringLiteral("wrapper.xcframework");
453455
if (filename.endsWith(QLatin1String(".a")))
454456
return QStringLiteral("archive.ar");
455457
if (filename.endsWith(QLatin1String(".pro")) || filename.endsWith(QLatin1String(".qrc")))
@@ -964,15 +966,18 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
964966
library = fileFixify(library, FileFixifyFromOutdir | FileFixifyAbsolute);
965967
QString key = keyFor(library);
966968
if (!project->values("QMAKE_PBX_LIBRARIES").contains(key)) {
967-
bool is_frmwrk = (library.endsWith(".framework"));
969+
const QString fileType = xcodeFiletypeForFilename(library);
970+
bool is_frmwrk = fileType.endsWith("framework");
968971
t << "\t\t" << key << " = {\n"
969972
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
970973
<< "\t\t\t" << writeSettings("name", name) << ";\n"
971974
<< "\t\t\t" << writeSettings("path", library) << ";\n"
972975
<< "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(library)), SettingsNoQuote) << ";\n"
973976
<< "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";\n";
974-
if (is_frmwrk)
975-
t << "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.framework") << ";\n";
977+
if (is_frmwrk) {
978+
t << "\t\t\t" << writeSettings("lastKnownFileType", fileType)
979+
<< ";\n";
980+
}
976981
t << "\t\t};\n";
977982
project->values("QMAKE_PBX_LIBRARIES").append(key);
978983
QString build_key = keyFor(library + ".BUILDABLE");

0 commit comments

Comments
 (0)