Example #1
0
    static QStringList build(const ProjectPart::Ptr &pPart, ProjectFile::Kind fileKind)
    {
        if (pPart.isNull())
            return QStringList();

        LibClangOptionsBuilder optionsBuilder(pPart);

        if (verboseRunLog().isDebugEnabled())
            optionsBuilder.add(QLatin1String("-v"));

        optionsBuilder.addLanguageOption(fileKind);
        optionsBuilder.addOptionsForLanguage(maybeIncludeBorlandExtensions());
        optionsBuilder.addToolchainAndProjectDefines();

        static const QString resourceDir = getResourceDir();
        if (!resourceDir.isEmpty()) {
            optionsBuilder.add(QLatin1String("-nostdlibinc"));
            optionsBuilder.add(QLatin1String("-I") + resourceDir);
            optionsBuilder.add(QLatin1String("-undef"));
        }

        optionsBuilder.addHeaderPathOptions();

        // Inject header file
        static const QString injectedHeader = ICore::instance()->resourcePath()
                + QLatin1String("/cplusplus/qt%1-qobjectdefs-injected.h");

//        if (pPart->qtVersion == ProjectPart::Qt4) {
//            builder.addOption(QLatin1String("-include"));
//            builder.addOption(injectedHeader.arg(QLatin1Char('4')));
//        }

        if (pPart->qtVersion == ProjectPart::Qt5) {
            optionsBuilder.add(QLatin1String("-include"));
            optionsBuilder.add(injectedHeader.arg(QLatin1Char('5')));
        }

        if (!pPart->projectConfigFile.isEmpty()) {
            optionsBuilder.add(QLatin1String("-include"));
            optionsBuilder.add(pPart->projectConfigFile);
        }

        optionsBuilder.add(QLatin1String("-fmessage-length=0"));
        optionsBuilder.add(QLatin1String("-fdiagnostics-show-note-include-stack"));
        optionsBuilder.add(QLatin1String("-fmacro-backtrace-limit=0"));
        optionsBuilder.add(QLatin1String("-fretain-comments-from-system-headers"));
        // TODO: -Xclang -ferror-limit -Xclang 0 ?

        return optionsBuilder.options();
    }
    static QStringList build(const ProjectPart::Ptr &projectPart, ProjectFile::Kind fileKind)
    {
        if (projectPart.isNull())
            return QStringList();

        LibClangOptionsBuilder optionsBuilder(projectPart);

        if (verboseRunLog().isDebugEnabled())
            optionsBuilder.add(QLatin1String("-v"));

        optionsBuilder.addLanguageOption(fileKind);
        optionsBuilder.addOptionsForLanguage(maybeIncludeBorlandExtensions());

        optionsBuilder.addToolchainAndProjectDefines();

        optionsBuilder.addResourceDirOptions();
        optionsBuilder.addWrappedQtHeadersIncludePath();
        optionsBuilder.addHeaderPathOptions();
        optionsBuilder.addProjectConfigFileInclude();

        optionsBuilder.addExtraOptions();

        return optionsBuilder.options();
    }