⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pbuilder_pbx.cpp

📁 qt-x11-opensource-src-4.1.4.tar.gz源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
        else            name = (as_release ? "Deployment" : "Development");        if(pbVersion >= 42) {            QString key = keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_" + name);            project->variables()["QMAKE_SUBDIR_PBX_BUILDCONFIGS"].append(key);            t << "\t\t" << key << " = {" << "\n"              << "\t\t\t" << "isa = XCBuildConfiguration;" << "\n"              << "\t\t\t" << "buildSettings = {" << "\n";            for(QMap<QString, QString>::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it)                t << "\t\t\t\t" << set_it.key() << " = \"" << set_it.value() << "\";\n";            t << "\t\t\t" << "};" << "\n"              << "\t\t\t" << "name = " << name << ";" << "\n"              << "\t\t" << "};" << "\n";        }        QString key = keyFor("QMAKE_SUBDIR_PBX_BUILDSTYLE_" + name);        if(project->isActiveConfig("debug") != (bool)as_release) {            project->variables()["QMAKE_SUBDIR_PBX_BUILDSTYLES"].append(key);            active_buildstyle = name;        } else if(pbVersion >= 42) {            project->variables()["QMAKE_SUBDIR_PBX_BUILDSTYLES"].append(key);        }        t << "\t\t" << key << " = {" << "\n"          << "\t\t\t" << "buildRules = (" << "\n"          << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "buildSettings = {" << "\n";        for(QMap<QString, QString>::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it)            t << "\t\t\t\t" << set_it.key() << " = \"" << set_it.value() << "\";\n";        t << "\t\t\t" << "};" << "\n"          << "\t\t\t" << "isa = PBXBuildStyle;" << "\n"          << "\t\t\t" << "name = " << name << ";" << "\n"          << "\t\t" << "};" << "\n";    }    if(pbVersion >= 42) {        t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST") << " = {" << "\n"          << "\t\t\t" << "isa = XCConfigurationList;" << "\n"          << "\t\t\t" << "buildConfigurations = (" << "\n"          << varGlue("QMAKE_SUBDIR_PBX_BUILDCONFIGS", "\t\t\t\t", ",\n\t\t\t\t", "\n")          << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "defaultConfigurationIsVisible = 0;" << "\n"          << "\t\t\t" << "defaultConfigurationIsName = " << active_buildstyle << ";" << "\n"          << "\t\t" << "};" << "\n";    }#ifdef GENERATE_AGGREGRATE_SUBDIR    //target    t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_AGGREGATE_TARGET") << " = {" << "\n"      << "\t\t\t" << "buidPhases = (" << "\n"      << "\t\t\t" << ");" << "\n"      << "\t\t\t" << "buildSettings = {" << "\n"      << "\t\t\t\t" << "PRODUCT_NAME = " << project->variables()["TARGET"].first() << ";" << "\n"      << "\t\t\t" << "};" << "\n"      << "\t\t\t" << "dependencies = (" << "\n";    {        const QStringList &qmake_subdirs = project->variables()["QMAKE_PBX_SUBDIRS"];        for(int i = 0; i < qmake_subdirs.count(); i++)            t << "\t\t\t\t" << keyFor(qmake_subdirs[i] + "_TARGETREF") << "," << "\n";    }    t << "\t\t\t" << ");" << "\n"      << "\t\t\t" << "isa = PBXAggregateTarget;" << "\n"      << "\t\t\t" << "name = " << project->variables()["TARGET"].first() << ";" << "\n"      << "\t\t\t" << "productName = " << project->variables()["TARGET"].first() << ";" << "\n"      << "\t\t" << "};" << "\n";#endif    //ROOT_GROUP    t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_ROOT_GROUP") << " = {" << "\n"      << "\t\t\t" << "children = (" << "\n"      << varGlue("QMAKE_SUBDIR_PBX_GROUPS", "\t\t\t\t", ",\n\t\t\t\t", "\n")      << "\t\t\t" << ");" << "\n"      << "\t\t\t" << "isa = PBXGroup;" << "\n"      << "\t\t\t" << "refType = 4;" << "\n"      << "\t\t\t" << "sourceTree = \"<group>\";" << "\n"      << "\t\t" << "};" << "\n";    //ROOT    t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_ROOT") << " = {" << "\n"      << "\t\t\t" << "buildSettings = {" << "\n"      << "\t\t\t" << "};" << "\n"      << "\t\t\t" << "buildStyles = (" << "\n"      << varGlue("QMAKE_SUBDIR_PBX_BUILDSTYLES", "\t\t\t\t", ",\n\t\t\t\t", "\n")      << "\t\t\t" << ");" << "\n"      << "\t\t\t" << "isa = PBXProject;" << "\n"      << "\t\t\t" << "mainGroup = " << keyFor("QMAKE_SUBDIR_PBX_ROOT_GROUP") << ";" << "\n"      << "\t\t\t" << "projectDirPath = \"\";" << "\n";    if(pbVersion >= 42)        t << "\t\t\t" << "buildConfigurationList = " << keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST") << ";" << "\n";    t << "\t\t\t" << "projectReferences = (" << "\n";    {        QStringList &qmake_subdirs = project->variables()["QMAKE_PBX_SUBDIRS"];        for(int i = 0; i < qmake_subdirs.count(); i++) {            QString subdir = qmake_subdirs[i];            t << "\t\t\t\t" << "{" << "\n"              << "\t\t\t\t\t" << "ProductGroup = " << keyFor(subdir + "_PRODUCTGROUP") << ";" << "\n"              << "\t\t\t\t\t" << "ProjectRef = " << keyFor(subdir + "_PROJECTREF") << ";" << "\n"              << "\t\t\t\t" << "}," << "\n";        }    }    t << "\t\t\t" << ");" << "\n"      << "\t\t\t" << "targets = (" << "\n"#ifdef GENERATE_AGGREGRATE_SUBDIR      << "\t\t\t\t" << keyFor("QMAKE_SUBDIR_PBX_AGGREGATE_TARGET") << "\n"#endif      << "\t\t\t" << ");" << "\n"      << "\t\t" << "};" << "\n";    //FOOTER    t << "\t" << "};" << "\n"      << "\t" << "rootObject = " << keyFor("QMAKE_SUBDIR_PBX_ROOT") << ";" << "\n"      << "}" << endl;    return true;}class ProjectBuilderSources{    QString key, group, compiler;public:    ProjectBuilderSources(const QString &key, const QString &group=QString(), const QString &compiler=QString());    QStringList files(QMakeProject *project) const;    inline QString keyName() const { return key; }    inline QString groupName() const { return group; }    inline QString compilerName() const { return compiler; }};ProjectBuilderSources::ProjectBuilderSources(const QString &k, const QString &g,                                             const QString &c) : key(k), group(g), compiler(c){    if(group.isNull()) {        if(k == "SOURCES")            group = "Sources";        else if(k == "HEADERS")            group = "Headers";        else if(k == "QMAKE_INTERNAL_INCLUDED_FILES")            group = "Sources [qmake]";        else if(k == "GENERATED_SOURCES" || k == "GENERATED_FILES")            group = "Temporary Sources";        else            fprintf(stderr, "No group available for %s!\n", k.toLatin1().constData());    }}QStringListProjectBuilderSources::files(QMakeProject *project) const{    QStringList ret = project->variables()[key];    if(key == "QMAKE_INTERNAL_INCLUDED_FILES") {        QString pfile = project->projectFile();        if(pfile != "(stdin)")            ret.prepend(pfile);        for(int i = 0; i < ret.size(); ++i) {            QStringList newret;            if(!ret.at(i).endsWith(Option::prf_ext))                newret.append(ret.at(i));            ret = newret;        }    }    if(key == "SOURCES" && project->first("TEMPLATE") == "app" && !project->isEmpty("ICON"))        ret.append(project->first("ICON"));    return ret;}boolProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t){    QStringList tmp;    bool did_preprocess = false;    //HEADER    const int pbVersion = pbuilderVersion();    t << "// !$*UTF8*$!" << "\n"      << "{" << "\n"      << "\t" << "archiveVersion = 1;" << "\n"      << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n"      << "\t" << "objectVersion = " << pbVersion << ";" << "\n"      << "\t" << "objects = {" << endl;    //MAKE QMAKE equivelant    if(!project->isActiveConfig("no_autoqmake") && project->projectFile() != "(stdin)") {        QString mkfile = pbx_dir + Option::dir_sep + "qt_makeqmake.mak";        QFile mkf(mkfile);        if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) {            debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData());            QTextStream mkt(&mkf);            writeHeader(mkt);            mkt << "QMAKE    = "        << (project->isEmpty("QMAKE_QMAKE") ?                                            QString((QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake")) :                                            var("QMAKE_QMAKE")) << endl;            writeMakeQmake(mkt);            mkt.flush();            mkf.close();        }        QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE");        mkfile = fileFixify(mkfile, qmake_getpwd());        project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key);        t << "\t\t" << phase_key << " = {" << "\n"          << "\t\t\t" << "buildActionMask = 2147483647;" << "\n"          << "\t\t\t" << "files = (" << "\n"          << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "generatedFileNames = (" << "\n"          << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n"          << "\t\t\t" << "name = \"Qt Qmake\";" << "\n"          << "\t\t\t" << "neededFileNames = (" << "\n"          << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "shellPath = /bin/sh;" << "\n"          << "\t\t\t" << "shellScript = \"make -C " << qmake_getpwd() <<            " -f " << mkfile << "\";" << "\n"          << "\t\t" << "};" << "\n";    }    //DUMP SOURCES    QMap<QString, QStringList> groups;    QList<ProjectBuilderSources> sources;    sources.append(ProjectBuilderSources("SOURCES"));    sources.append(ProjectBuilderSources("GENERATED_SOURCES"));    sources.append(ProjectBuilderSources("GENERATED_FILES"));    sources.append(ProjectBuilderSources("HEADERS"));    sources.append(ProjectBuilderSources("QMAKE_INTERNAL_INCLUDED_FILES"));    if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {        const QStringList &quc = project->variables()["QMAKE_EXTRA_COMPILERS"];        for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {            QString tmp_out = project->first((*it) + ".output");            if(project->isEmpty((*it) + ".output"))                continue;            QString name = (*it);            if(!project->isEmpty((*it) + ".name"))                name = project->first((*it) + ".name");            const QStringList &inputs = project->values((*it) + ".input");            for(int input = 0; input < inputs.size(); ++input) {                if(project->isEmpty(inputs.at(input)))                    continue;                bool duplicate = false;                for(int i = 0; i < sources.size(); ++i) {                    if(sources.at(i).keyName() == inputs.at(input)) {                        duplicate = true;                        break;                    }                }                if(duplicate)                    continue;                sources.append(ProjectBuilderSources(inputs.at(input),                                                     QString("Sources [") + name + "]", (*it)));            }        }    }    for(int source = 0; source < sources.size(); ++source) {        QStringList &src_list = project->variables()["QMAKE_PBX_" + sources.at(source).keyName()];        QStringList &root_group_list = project->variables()["QMAKE_PBX_GROUPS"];        QStringList files = fileFixify(sources.at(source).files(project));        for(int f = 0; f < files.count(); ++f) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -