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

📄 pbuilder_pbx.cpp

📁 qt专门用于嵌入式的图形开发GUI
💻 CPP
📖 第 1 页 / 共 5 页
字号:
	    mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS) $(IMAGES)" << endl;	    mkt << "clean preprocess_clean: mocclean uiclean parser_clean" << endl << endl;	    mkt << "mocclean:" << "\n";	    if(!project->isEmpty("SRCMOC"))		mkt << "\t-rm -f $(MOCS)" << "\n";	    mkt << "uiclean:" << "\n";	    if(!project->isEmpty("UICIMPLS"))		mkt << "\t-rm -f $(FORMS)" << "\n";	    if(!project->isEmpty("QMAKE_IMAGE_COLLECTION"))		mkt << "\t-rm -f $(IMAGES)" << "\n";	    mkt << "parser_clean:" << "\n";	    if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES"))		mkt << "\t-rm -f $(PARSERS)" << "\n";	    writeUicSrc(mkt, "FORMS");	    writeMocSrc(mkt, "HEADERS");	    writeMocSrc(mkt, "SOURCES");	    writeMocSrc(mkt, "UICDECLS");	    writeYaccSrc(mkt, "YACCSOURCES");	    writeLexSrc(mkt, "LEXSOURCES");	    writeImageSrc(mkt, "QMAKE_IMAGE_COLLECTION");	    mkf.close();	}	mkfile = fileFixify(mkfile, QDir::currentDirPath());	QString phase_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");//	project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key);	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"	  << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")	  << "\t\t\t" << ");" << "\n"	  << "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n"	  << "\t\t\t" << "name = \"Qt Preprocessors\";" << "\n"	  << "\t\t\t" << "neededFileNames = (" << "\n"	  << varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")	  << "\t\t\t" << ");" << "\n"	  << "\t\t\t" << "shellPath = /bin/sh;" << "\n"	  << "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() <<	    " -f " << mkfile << "\";" << "\n"	  << "\t\t" << "};" << "\n";   }    //SOURCE BUILDPHASE    if(!project->isEmpty("QMAKE_PBX_OBJ")) {	QString grp = "Build Sources", 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_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")	  << "\t\t\t" << ");" << "\n"	  << "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n"	  << "\t\t\t" << "name = \"" << grp << "\";" << "\n"	  << "\t\t" << "};" << "\n";    }    if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES	QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"];	QString libs[] = { "QMAKE_LFLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };	for(i = 0; !libs[i].isNull(); i++) {	    tmp = project->variables()[libs[i]];	    for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) {		bool remove = FALSE;		QString library, name, opt = (*it).stripWhiteSpace();		if(opt.length() >= 2 && (opt[0] == '"' || opt[0] == '\'') && opt[(int) opt.length()-1] == opt[0])		    opt = opt.mid(1, opt.length()-2);		if(opt.startsWith("-L")) {		    QString r = opt.right(opt.length() - 2);		    fixEnvVariables(r);		    libdirs.append(r);		} else if(opt == "-prebind") {		    project->variables()["QMAKE_DO_PREBINDING"].append("TRUE");		    remove = TRUE;		} else if(opt.startsWith("-l")) {		    name = opt.right(opt.length() - 2);		    QString lib("lib" + name);		    for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) {			if(project->isActiveConfig("link_prl")) {			    /* This isn't real nice, but it is real usefull. This looks in a prl			       for what the library will ultimately be called so we can stick it			       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.latin1(), lib_file.latin1(), library.latin1());					remove = TRUE;				    }				}			    }			}			if(!remove) {			    QString extns[] = { ".dylib", ".so", ".a", QString::null };			    for(int n = 0; !remove && !extns[n].isNull(); n++) {				QString tmp =  (*lit) + Option::dir_sep + lib + extns[n];				if(QFile::exists(tmp)) {				    library = tmp;				    debug_msg(1, "pbuilder: Found library (%s) via %s",					      opt.latin1(), library.latin1());				    remove = TRUE;				}			    }			}		    }		} else if(opt == "-framework") {		    ++it;		    if(it == tmp.end())			break;		    QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"];		    if(fdirs.isEmpty())			fdirs.append("/System/Library/Frameworks/");		    for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) {			if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) {			    --it;			    it = tmp.remove(it);			    remove = TRUE;			    library = (*fit) + Option::dir_sep + (*it) + ".framework";			    break;			}		    }		} else if(opt.left(1) != "-") {                    if(QFile::exists(opt)) {                        remove = TRUE;                        library = opt;                    }		}		if(!library.isEmpty()) {		    if(name.isEmpty()) {			int slsh = library.findRev(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 obj_key = library + ".o";		    obj_key = keyFor(obj_key);		    t << "\t\t" << obj_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(obj_key);		}		if(remove)		    it = tmp.remove(it);		else		    ++it;	    }	    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(IO_WriteOnly | IO_Translate)) {	    debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1());	    QTextStream mkt(&mkf);	    writeHeader(mkt);	    mkt << "SUBLIBS= ";	    tmp = project->variables()["SUBLIBS"];	    QStringList::Iterator it;	    for(it = tmp.begin(); it != tmp.end(); ++it)		t << "tmp/lib" << (*it) << ".a ";	    t << endl << endl;	    mkt << "sublibs: $(SUBLIBS)" << endl << endl;	    tmp = project->variables()["SUBLIBS"];	    for(it = tmp.begin(); it != tmp.end(); ++it)		t << "tmp/lib" << (*it) << ".a" << ":\n\t"		  << var(QString("MAKELIB") + (*it)) << endl << endl;	    mkf.close();	}	QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE");	mkfile = fileFixify(mkfile, QDir::currentDirPath());	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 " << QDir::currentDirPath() <<	    " -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"	  << (!project->isEmpty("RC_FILE") ? keyFor("ICNS_FILE_REFERENCE") : QString(""))	  << "\t\t\t" << ");" << "\n"	  << "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n"	  << "\t\t\t" << "name = \"" << grp << "\";" << "\n"	  << "\t\t" << "};" << "\n";    }    { //INSTALL BUILDPHASE (sh script)        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");        fixEnvs(destDir);        destDir = QFileInfo(Option::fixPathToLocalOS(destDir)).absFilePath();        project->variables()["QMAKE_PBX_PRESCRIPT_BUILDPHASES"].append(phase_key);        t << "\t\t" << phase_key << " = {\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";    }    if(/*ideType() == MAC_XCODE &&*/ !project->isEmpty("QMAKE_PBX_PRESCRIPT_BUILDPHASES") && 0) {	// build reference	t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPT_BUILDREFERENCE") << " = {" << "\n"	  << "\t\t\t" << "includeInIndex = 0;" << "\n"	  << "\t\t\t" << "isa = PBXFileReference;" << "\n"	  << "\t\t\t" << "path = preprocessor.out;" << "\n"	  << "\t\t\t" << "refType = 3;" << "\n"	  << "\t\t\t" << "sourceTree = BUILT_PRODUCTS_DIR;" << "\n"	  << "\t\t" << "};" << "\n";	project->variables()["QMAKE_PBX_PRODUCTS"].append(keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE"));	//build phase        QString prescript_key = keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE");

⌨️ 快捷键说明

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