📄 pbuilder_pbx.cpp
字号:
QTextStream mkt(&mkf); writeHeader(mkt); mkt << "SUBLIBS= "; tmp = project->values("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->values("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(); writingUnixMakefileGenerator = false; } QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE"); mkfile = fileFixify(mkfile, qmake_getpwd()); project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); t << "\t\t" << phase_key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("generatedFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Qt Sublibs") << ";" << "\n" << "\t\t\t" << writeSettings("neededFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << "\n" << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f " + escapeFilePath(mkfile))) << ";" << "\n" << "\t\t" << "};" << "\n"; } //LIBRARY BUILDPHASE if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { tmp = project->values("QMAKE_PBX_LIBRARIES"); if(!tmp.isEmpty()) { QString grp("External Frameworks and Libraries"), key = keyFor(grp); project->values("QMAKE_PBX_GROUPS").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_LIBRARIES"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" << "\t\t\t" << writeSettings("path", QStringList()) << ";" << "\n" << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; } } { QString grp("Frameworks & Libraries"), key = keyFor(grp); project->values("QMAKE_PBX_BUILDPHASES").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", project->values("QMAKE_PBX_BUILD_LIBRARIES"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFrameworksBuildPhase", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" << "\t\t" << "};" << "\n"; } if(project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES QString grp("Bundle Resources"), key = keyFor(grp); project->values("QMAKE_PBX_BUILDPHASES").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\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" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(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->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); t << "\t\t" << phase_key << " = {\n" << "\t\t\t" << writeSettings("name", "Project Copy") << ";" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("dstPath", escapeFilePath(destDir)) << ";" << "\n" << "\t\t\t" << writeSettings("dstSubfolderSpec", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", keyFor("QMAKE_PBX_TARGET_COPY_FILE"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};\n" << "\t\t" << keyFor("QMAKE_PBX_TARGET_COPY_FILE") << " = {\n" << "\t\t\t" << writeSettings("fileRef", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << "settings = {\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->values("QMAKE_BUNDLE_DATA"); for(int i = 0; i < bundle_data.count(); i++) { QStringList pbx_files; //all files const QStringList &files = project->values(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" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("path", escapeFilePath(files[file])) << ";" << "\n" << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(files[file])), SettingsNoQuote) << ";" << "\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\t" << writeSettings("fileRef", file_ref_key) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << "settings = {\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->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); t << "\t\t" << phase_key << " = {\n" << "\t\t\t" << writeSettings("name", "Bundle Copy [" + bundle_data[i] + "]") << ";" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";" << "\n" << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("files", pbx_files, SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t" << "}" << ";" << "\n"; } QString bundle_copy_key = keyFor("QMAKE_PBX_BUNDLE_COPY"); project->values("QMAKE_PBX_GROUPS").append(bundle_copy_key); t << "\t\t" << bundle_copy_key << " = {" << "\n" << "\t\t\t" << writeSettings("children", bundle_file_refs, SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Source [bundle data]") << ";" << "\n" << "\t\t\t" << writeSettings("path", QStringList()) << ";" << "\n" << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; } if(/*pbVersion >= 38 &&*/ !project->isEmpty("QMAKE_PBX_PRESCRIPT_BUILDPHASES") && 0) { // build reference t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPT_BUILDREFERENCE") << " = {" << "\n" << "\t\t\t" << writeSettings("includeInIndex", "0") << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("path", "preprocessor.out") << ";" << "\n" << "\t\t\t" << writeSettings("refType", "3", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; project->values("QMAKE_PBX_PRODUCTS").append(keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE")); //build phase t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE") << " = {" << "\n" << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("buildRules", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("buildSettings", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("dependencies", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Qt Preprocessor Steps") << ";" << "\n" << "\t\t\t" << writeSettings("productName", "Qt Preprocessor Steps") << ";" << "\n" << "\t\t\t" << writeSettings("productReference", keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE")) << ";" << "\n"; if(!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; else t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.tool") << ";" << "\n"; t << "\t\t" << "};" << "\n"; //dependency t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY") << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("target", keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE")) << ";" << "\n" << "\t\t" << "};" << "\n"; project->values("QMAKE_PBX_TARGET_DEPENDS").append(keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY")); project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").clear(); //these are already consumed above } //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER //ROOT_GROUP t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {" << "\n" << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_GROUPS"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n" << "\t\t\t" << writeSettings("path", QStringList()) << ";" << "\n" << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; //REFERENCE project->values("QMAKE_PBX_PRODUCTS").append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")); t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n"; if(project->first("TEMPLATE") == "app") { QString targ = project->first("QMAKE_ORIG_TARGET"); if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) { if(!project->isEmpty("QMAKE_BUNDLE_NAME")) targ = project->first("QMAKE_BUNDLE_NAME"); targ += project->first("QMAKE_BUNDLE_EXTENSION"); if(!project->isEmpty("QMAKE_PBX_BUNDLE_TYPE")) t << "\t\t\t" << writeSettings("explicitFileType", project->first("QMAKE_PBX_BUNDLE_TYPE")) + ";" << "\n"; } else if(project->isActiveConfig("app_bundle")) { if(!project->isEmpty("QMAKE_APPLICATION_BUNDLE_NAME")) targ = project->first("QMAKE_APPLICATION_BUNDLE_NAME"); targ += ".app"; t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.application") << ";" << "\n"; } else { t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.executable") << ";" << "\n"; } QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : qmake_getpwd()) + Option::dir_sep + targ; t << "\t\t\t" << writeSettings("path", escapeFilePath(targ)) << ";" << "\n"; } else { QString lib = project->first("QMAKE_ORIG_TARGET"); if(project->isActiveConfig("staticlib")) { lib = project->first("TARGET"); } else if(!project->isActiveConfig("lib_bundle")) { if(project->isActiveConfig("plugin")) lib = project->first("TARGET"); else lib = project->first("TARGET_"); } int slsh = lib.lastIndexOf(Option::dir_sep); if(slsh != -1) lib = lib.right(lib.length() - slsh - 1); if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) { if(!project->isEmpty("QMAKE_BUNDLE_NAME")) lib
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -