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

📄 pbuilder_pbx.cpp

📁 qt-x11-opensource-src-4.1.4.tar.gz源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
                               in the ProjectFile. If the prl format ever changes (not likely) then                               this will not really work. However, more concerning is that it will                               encode the version number in the Project file which might be a bad                               things in days to come? --Sam                            */                            QString lib_file = (*lit) + Option::dir_sep + lib;                            if(QMakeMetaInfo::libExists(lib_file)) {                                QMakeMetaInfo libinfo;                                if(libinfo.readLib(lib_file)) {                                    if(!libinfo.isEmpty("QMAKE_PRL_TARGET")) {                                        library = (*lit) + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");                                        debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",                                                  opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData());                                        remove = true;                                    }                                }                            }                        }                        if(!remove) {                            QString extns[] = { ".dylib", ".so", ".a", QString() };                            for(int n = 0; !remove && !extns[n].isNull(); n++) {                                QString tmp =  (*lit) + Option::dir_sep + lib + extns[n];                                if(exists(tmp)) {                                    library = tmp;                                    debug_msg(1, "pbuilder: Found library (%s) via %s",                                              opt.toLatin1().constData(), library.toLatin1().constData());                                    remove = true;                                }                            }                        }                    }                } else if(opt == "-framework") {                    if(x == tmp.count()-1)                        break;                    QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"];                    if(fdirs.isEmpty())                        fdirs << "/System/Library/Frameworks/" << "/Library/Frameworks/";                    const QString framework = tmp[x+1];                    for(int fdir = 0; fdir < fdirs.count(); fdir++) {                        if(exists(fdirs[fdir] + QDir::separator() + framework + ".framework")) {                            tmp.removeAt(x);                            remove = true;                            library = fdirs[fdir] + Option::dir_sep + framework + ".framework";                            break;                        }                    }                } else if(opt.left(1) != "-") {                    if(exists(opt)) {                        remove = true;                        library = opt;                    }                }                if(!library.isEmpty()) {                    if(name.isEmpty()) {                        int slsh = library.lastIndexOf(Option::dir_sep);                        if(slsh != -1)                            name = library.right(library.length() - slsh - 1);                    }                    library = fileFixify(library);                    QString key = keyFor(library);                    bool is_frmwrk = (library.endsWith(".framework"));                    t << "\t\t" << key << " = {" << "\n"                      << "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n"                      << "\t\t\t" << "name = \"" << name << "\";" << "\n"                      << "\t\t\t" << "path = \"" << library << "\";" << "\n"                      << "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n"                      << "\t\t" << "};" << "\n";                    project->variables()["QMAKE_PBX_LIBRARIES"].append(key);                    QString build_key = keyFor(library + ".BUILDABLE");                    t << "\t\t" << build_key << " = {" << "\n"                      << "\t\t\t" << "fileRef = " << key << ";" << "\n"                      << "\t\t\t" << "isa = PBXBuildFile;" << "\n"                      << "\t\t\t" << "settings = {" << "\n"                      << "\t\t\t" << "};" << "\n"                      << "\t\t" << "};" << "\n";                    project->variables()["QMAKE_PBX_BUILD_LIBRARIES"].append(build_key);                }                if(remove)                    tmp.removeAt(x);                else                    x++;            }            project->variables()[libs[i]] = tmp;        }    }    //SUBLIBS BUILDPHASE (just another makefile)    if(!project->isEmpty("SUBLIBS")) {        QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.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 << "SUBLIBS= ";            tmp = project->variables()["SUBLIBS"];            for(int i = 0; i < tmp.count(); i++)                t << "tmp/lib" << tmp[i] << ".a ";            t << endl << endl;            mkt << "sublibs: $(SUBLIBS)" << endl << endl;            tmp = project->variables()["SUBLIBS"];            for(int i = 0; i < tmp.count(); i++)                t << "tmp/lib" << tmp[i] << ".a" << ":\n\t"                  << var(QString("MAKELIB") + tmp[i]) << endl << endl;            mkt.flush();            mkf.close();        }        QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_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 Sublibs\";" << "\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";    }    //LIBRARY BUILDPHASE    if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) {        tmp = project->variables()["QMAKE_PBX_LIBRARIES"];        if(!tmp.isEmpty()) {            QString grp("External Frameworks and Libraries"), key = keyFor(grp);            project->variables()["QMAKE_PBX_GROUPS"].append(key);            t << "\t\t" << key << " = {" << "\n"              << "\t\t\t" << "children = (" << "\n"              << varGlue("QMAKE_PBX_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n")              << "\t\t\t" << ");" << "\n"              << "\t\t\t" << "isa = PBXGroup;" << "\n"              << "\t\t\t" << "name = \"" << grp << "\"" << ";" << "\n"              << "\t\t\t" << "path = \"\";" << "\n"              << "\t\t\t" << "refType = 4;" << "\n"              << "\t\t" << "};" << "\n";        }    }    {        QString grp("Frameworks & Libraries"), key = keyFor(grp);        project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);        t << "\t\t" << key << " = {" << "\n"          << "\t\t\t" << "buildActionMask = 2147483647;" << "\n"          << "\t\t\t" << "files = (" << "\n"          << varGlue("QMAKE_PBX_BUILD_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n")          << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "isa = PBXFrameworksBuildPhase;" << "\n"          << "\t\t\t" << "name = \"" << grp << "\";" << "\n"          << "\t\t" << "};" << "\n";    }    if(!project->isActiveConfig("console") && project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES        QString grp("Bundle Resources"), key = keyFor(grp);        project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);        t << "\t\t" << key << " = {" << "\n"          << "\t\t\t" << "buildActionMask = 2147483647;" << "\n"          << "\t\t\t" << "files = (" << "\n";        if(!project->isEmpty("ICON")) {            QString icon = project->first("ICON");            if(icon.length() >= 2 && (icon[0] == '"' || icon[0] == '\'') && icon[(int)icon.length()-1] == icon[0])                icon = icon.mid(1, icon.length()-2);            t << "\t\t\t\t" << keyFor(icon + ".BUILDABLE") << ",\n";        }        t << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n"          << "\t\t\t" << "name = \"" << grp << "\";" << "\n"          << "\t\t" << "};" << "\n";    }    { //INSTALL BUILDPHASE (copy)        QString phase_key = keyFor("QMAKE_PBX_TARGET_COPY_PHASE");        QString destDir = Option::output_dir;        if (!project->isEmpty("QMAKE_ORIG_DESTDIR"))            destDir = project->first("QMAKE_ORIG_DESTDIR");        destDir = fixForOutput(destDir);        destDir = fileInfo(Option::fixPathToLocalOS(destDir)).absoluteFilePath();        project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key);        t << "\t\t" << phase_key << " = {\n"          << "\t\t\tname = \"Project Copy\";\n"          << "\t\t\tbuildActionMask = 2147483647;\n"          << "\t\t\tdstPath = " << destDir << ";\n"          << "\t\t\tdstSubfolderSpec = 0;\n"          << "\t\t\tfiles = (\n"          << "\t\t\t" << keyFor("QMAKE_PBX_TARGET_COPY_FILE") << ",\n"          << "\t\t\t);\n"          << "\t\t\tisa = PBXCopyFilesBuildPhase;\n"          << "\t\t\trunOnlyForDeploymentPostprocessing = 0;\n"          << "\t\t};\n"          << "\t\t" << keyFor("QMAKE_PBX_TARGET_COPY_FILE")  << " = {\n"          << "\t\t\tfileRef =  " <<  keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << ";\n"          << "\t\t\tisa = PBXBuildFile;\n"          << "\t\t\tsettings = {\n"          << "\t\t\t};\n"          << "\t\t};\n";    }    //BUNDLE_DATA BUILDPHASE (copy)    if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {        QStringList bundle_file_refs;        //all bundle data        const QStringList &bundle_data = project->variables()["QMAKE_BUNDLE_DATA"];        for(int i = 0; i < bundle_data.count(); i++) {            QStringList pbx_files;            //all files            const QStringList &files = project->variables()[bundle_data[i] + ".files"];            for(int file = 0; file < files.count(); file++) {                QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE_REF." + bundle_data[i] + "-" + files[file]);                bundle_file_refs += file_ref_key;                t << "\t\t" << file_ref_key << " = {" << "\n"                  << "\t\t\t" << "isa = PBXFileReference;" << "\n"                  << "\t\t\t" << "path = \"" << files[file] << "\";" << "\n"                  << "\t\t\t" << "refType = " << reftypeForFile(files[file]) << ";" << "\n"                  << "\t\t" << "};" << "\n";                QString copy_file_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE." + bundle_data[i] + "-" + files[file]);                pbx_files += copy_file_key;                t << "\t\t" <<  copy_file_key << " = {\n"                  << "\t\t\tfileRef =  " <<  file_ref_key << ";\n"                  << "\t\t\tisa = PBXBuildFile;\n"                  << "\t\t\tsettings = {\n"                  << "\t\t\t};\n"                  << "\t\t};\n";            }            //the phase            QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]);            QString path;            if(!project->isEmpty(bundle_data[i] + ".version")) {                //###            }            path += project->first(bundle_data[i] + ".path");            project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key);            t << "\t\t" << phase_key << " = {\n"              << "\t\t\tname = \"Bundle Copy [" << bundle_data[i] << "]\";\n"              << "\t\t\tbuildActionMask = 2147483647;\n"              << "\t\t\tdstPath = \"" << path << "\";\n"              << "\t\t\tdstSubfolderSpec = 1;\n"              << "\t\t\tfiles = (\n"              << valGlue(pbx_files, "\t\t\t\t", ",\n\t\t\t\t", "\n")              << "\t\t\t);\n"              << "\t\t\tisa = PBXCopyFilesBuildPhase;\n"              << "\t\t\trunOnlyForDeploymentPostprocessing = 0;\n"              << "\t\t};\n";        }        QString bundle_copy_key = keyFor("QMAKE_PBX_BUNDLE_COPY");        project->variables()["QMAKE_PBX_GROUPS"].append(bundle_copy_key);        t << "\t\t" << bundle_copy_key << " = {" << "\n"          << "\t\t\t" << "children = (" << "\n"          << valGlue(bundle_file_refs, "\t\t\t\t", ",\n\t\t\t\t", "\n")          << "\t\t\t" << ");" << "\n"          << "\t\t\t" << "isa = PBXGroup;" << "\n"          << "\t\t\t" << "name = \"Source [bundle data]\"" << ";" << "\n"          << "\t\t\t" << "path = \"\";" << "\n"          << "\t\t\t" << "refType = 4;" << "\n"          << "\t\t" << "};" << "\n";    }

⌨️ 快捷键说明

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