Skip to content

Commit 69c29cf

Browse files
committed
fix(generator): normalize macOS framework includes to bare Qt headers
Follow-up of 19738be ("feat(generator): discover Qt include/framework paths dynamically; add PYTHONQT_FRAMEWORK", 2025-09-18). On macOS, headers parsed from framework paths like: .../QtCore.framework/Headers/qbytearray.h .../QtCore.framework/Versions/A/Headers/qbytearray.h were emitted as relative framework paths. Update `AbstractMetaBuilder::getRelativeInclude()` to detect both layouts and emit only the basename (e.g., `<qbytearray.h>`).
1 parent 3f119cb commit 69c29cf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

generator/abstractmetabuilder.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,22 @@ AbstractMetaClass* AbstractMetaBuilder::getGlobalNamespace(const TypeEntry* type
416416

417417
Include AbstractMetaBuilder::getRelativeInclude(const QString& path)
418418
{
419+
#ifdef Q_OS_MACOS
420+
// If the parsed header lives inside a macOS framework bundle, emit just the
421+
// bare header name (e.g., "qbytearray.h") so generators will produce <...>.
422+
//
423+
// Match both:
424+
// .../QtCore.framework/Headers/...
425+
// .../QtCore.framework/Versions/<X>/Headers/...
426+
static const QRegularExpression fwHeadersRe(
427+
QStringLiteral(R"(\.framework/(Versions/[^/]+/)?Headers/)")
428+
);
429+
if (fwHeadersRe.match(path).hasMatch()) {
430+
const QString base = QFileInfo(s).fileName(); // e.g., "qbytearray.h"
431+
return Include(Include::IncludePath, base); // choose <> style
432+
}
433+
#endif
434+
419435
QString bestRelativePath;
420436
int bestNumDirectories = 0;
421437
// find the shortest relative path relative to all given include directories

0 commit comments

Comments
 (0)