1 --- a/ApiExtractor/clangparser/compilersupport.cpp
2 +++ b/ApiExtractor/clangparser/compilersupport.cpp
4 #include <QtCore/QStandardPaths>
5 #include <QtCore/QStringList>
6 #include <QtCore/QVersionNumber>
7 +#include <QtCore/QRegularExpression>
9 #include <clang-c/Index.h>
11 @@ -341,6 +342,13 @@ QByteArrayList emulatedCompilerOptions()
13 QByteArrayList result;
14 HeaderPaths headerPaths;
16 + bool isNixDebug = qgetenv("NIX_DEBUG").toInt() > 0;
18 + // /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-qtsensors-6.4.2-dev/include
19 + // /nix/store/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-qtbase-6.4.2-dev/include
20 + QRegularExpression qtHeaderRegex(uR"(/[0-9a-z]{32}-qt[a-z0-9]+-)"_s);
24 result.append(QByteArrayLiteral("-fms-compatibility-version=19.26.28806"));
25 @@ -352,9 +360,30 @@ QByteArrayList emulatedCompilerOptions()
26 appendClangBuiltinIncludes(&headerPaths);
29 - headerPaths.append(gppInternalIncludePaths(compilerFromCMake(u"clang++"_s)));
30 + // fix: error: cannot jump from switch statement to this case label: case Compiler::Gpp
31 + // note: jump bypasses variable initialization: const HeaderPaths clangPaths =
33 + //headerPaths.append(gppInternalIncludePaths(compilerFromCMake(u"clang++"_s)));
34 + // fix: qt.shiboken: x is specified in typesystem, but not defined. This could potentially lead to compilation errors.
35 + // PySide requires that Qt headers are not -isystem
36 + // https://bugreports.qt.io/browse/PYSIDE-787
37 + const HeaderPaths clangPaths = gppInternalIncludePaths(compilerFromCMake(u"clang++"_qs));
38 + for (const HeaderPath &h : clangPaths) {
39 + auto match = qtHeaderRegex.match(QString::fromUtf8(h.path));
40 + if (!match.hasMatch()) {
42 + qDebug() << "shiboken compilersupport.cpp: found non-qt header: " << h.path;
43 + // add using -isystem
44 + headerPaths.append(h);
47 + qDebug() << "shiboken compilersupport.cpp: found qt header: " << h.path;
48 + headerPaths.append({h.path, HeaderType::Standard});
51 result.append(noStandardIncludeOption());
55 if (needsClangBuiltinIncludes())
56 appendClangBuiltinIncludes(&headerPaths);
57 @@ -363,8 +392,20 @@ QByteArrayList emulatedCompilerOptions()
58 // <type_traits> etc (g++ 11.3).
59 const HeaderPaths gppPaths = gppInternalIncludePaths(compilerFromCMake(u"g++"_qs));
60 for (const HeaderPath &h : gppPaths) {
61 - if (h.path.contains("c++") || h.path.contains("sysroot"))
62 + // fix: qt.shiboken: x is specified in typesystem, but not defined. This could potentially lead to compilation errors.
63 + // PySide requires that Qt headers are not -isystem
64 + // https://bugreports.qt.io/browse/PYSIDE-787
65 + auto match = qtHeaderRegex.match(QString::fromUtf8(h.path));
66 + if (!match.hasMatch()) {
68 + qDebug() << "shiboken compilersupport.cpp: found non-qt header: " << h.path;
69 + // add using -isystem
70 headerPaths.append(h);
73 + qDebug() << "shiboken compilersupport.cpp: found qt header: " << h.path;
74 + headerPaths.append({h.path, HeaderType::Standard});