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

📄 pbuilder_pbx.cpp

📁 Linux下的基于X11的图形开发环境。
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    t << "\t\t" << keyFor("QMAKE_PBX_TARGET") << " = {" << "\n"      << "\t\t\t" << "buildPhases = (" << "\n"      << varGlue("QMAKE_PBX_BUILDPHASES", "\t\t\t\t", ",\n\t\t\t\t", "\n")      << "\t\t\t" << ");" << "\n"      << "\t\t\t" << "buildSettings = {" << "\n"      << "\t\t\t\t" << "CC = \"" << fixEnvsList("QMAKE_CC") << "\";" << "\n"      << "\t\t\t\t" << "CPLUSPLUS = \"" << fixEnvsList("QMAKE_CXX") << "\";" << "\n"      << "\t\t\t\t" << "FRAMEWORK_SEARCH_PATHS = \"\";" << "\n"      << "\t\t\t\t" << "HEADER_SEARCH_PATHS = \"" << fixEnvsList("INCLUDEPATH") << " " << fixEnvs(specdir()) << "\";" << "\n"      << "\t\t\t\t" << "LIBRARY_SEARCH_PATHS = \"" << var("QMAKE_PBX_LIBPATHS") << "\";" << "\n"      << "\t\t\t\t" << "OPTIMIZATION_CFLAGS = \"\";" << "\n"      << "\t\t\t\t" << "OTHER_CFLAGS = \"" <<	fixEnvsList("QMAKE_CFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") <<	varGlue("DEFINES"," -D"," -D","") << "\";" << "\n"      << "\t\t\t\t" << "LEXFLAGS = \"" << var("QMAKE_LEXFLAGS") << "\";" << "\n"      << "\t\t\t\t" << "YACCFLAGS = \"" << var("QMAKE_YACCFLAGS") << "\";" << "\n"      << "\t\t\t\t" << "OTHER_CPLUSPLUSFLAGS = \"" <<	fixEnvsList("QMAKE_CXXFLAGS") << varGlue("PRL_EXPORT_DEFINES"," -D"," -D","") <<	varGlue("DEFINES"," -D"," -D","") << "\";" << "\n"      << "\t\t\t\t" << "OTHER_REZFLAGS = \"\";" << "\n"      << "\t\t\t\t" << "SECTORDER_FLAGS = \"\";" << "\n"      << "\t\t\t\t" << "WARNING_CFLAGS = \"\";" << "\n"      << "\t\t\t\t" << "PREBINDING = " << (project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES") << ";" << "\n";#if 1    t << "\t\t\t\t" << "BUILD_ROOT = \"" << QDir::currentDirPath() << "\";" << "\n";#endif    if(!project->isActiveConfig("staticlib")) 	t << "\t\t\t\t" << "OTHER_LDFLAGS = \"" << fixEnvsList("SUBLIBS") << " " <<	    fixEnvsList("QMAKE_LFLAGS") << " " << fixEnvsList("QMAKE_LIBDIR_FLAGS") <<	    " " << fixEnvsList("QMAKE_LIBS") << "\";" << "\n";    if(!project->isEmpty("DESTDIR"))	t << "\t\t\t\t" << "INSTALL_PATH = \"" << project->first("DESTDIR") << "\";" << "\n";    if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0")	t << "\t\t\t\t" << "DYLIB_CURRENT_VERSION = \"" << project->first("VERSION") << "\";" << "\n";    if(!project->isEmpty("OBJECTS_DIR"))	t << "\t\t\t\t" << "OBJROOT = \"" << project->first("OBJECTS_DIR") << "\";" << "\n";    if(project->first("TEMPLATE") == "app") {	if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console"))	    t << "\t\t\t\t" << "WRAPPER_EXTENSION = app;" << "\n";	t << "\t\t\t\t" << "PRODUCT_NAME = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n";    } else {	QString lib = project->first("QMAKE_ORIG_TARGET");	if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) {	    t << "\t\t\t\t" << "LIBRARY_STYLE = STATIC;" << "\n";	    lib = project->first("TARGET");	} else {	    t << "\t\t\t\t" << "LIBRARY_STYLE = DYNAMIC;" << "\n";	    if(!project->isActiveConfig("frameworklib")) {		if(project->isActiveConfig("plugin"))		    lib = project->first("TARGET");		else		    lib = project->first("TARGET_");	    }	}	int slsh = lib.findRev(Option::dir_sep);	if(slsh != -1)	    lib = lib.right(lib.length() - slsh - 1);	t << "\t\t\t\t" << "PRODUCT_NAME = " << lib << ";" << "\n";    }    tmp = project->variables()["QMAKE_PBX_VARS"];    for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it)	t << "\t\t\t\t" << (*it) << " = \"" << getenv((*it)) << "\";" << "\n";    t << "\t\t\t" << "};" << "\n"      << "\t\t\t" << "conditionalBuildSettings = {" << "\n"      << "\t\t\t" << "};" << "\n"      << "\t\t\t" << "dependencies = (" << "\n"      << varGlue("QMAKE_PBX_TARGETDEPENDS", "\t\t\t\t", ",\n\t\t\t\t", "\n")      << "\t\t\t" << ");" << "\n"      << "\t\t\t" << "productReference = " << keyFor("QMAKE_PBX_REFERENCE") << ";" << "\n"      << "\t\t\t" << "shouldUseHeadermap = 1;" << "\n";    if(project->first("TEMPLATE") == "app") {	if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) {	    t << "\t\t\t" << "isa = PBXApplicationTarget;" << "\n"	      << "\t\t\t" << "productSettingsXML = " << "\"" << "<?xml version=" 	      << "\\\"1.0\\\" encoding=" << "\\\"UTF-8\\\"" << "?>" << "\n"	      << "\t\t\t\t" << "<!DOCTYPE plist SYSTEM \\\"file://localhost/System/" 	      << "Library/DTDs/PropertyList.dtd\\\">" << "\n"	      << "\t\t\t\t" << "<plist version=\\\"0.9\\\">" << "\n"	      << "\t\t\t\t" << "<dict>" << "\n"	      << "\t\t\t\t\t" << "<key>CFBundleDevelopmentRegion</key>" << "\n"	      << "\t\t\t\t\t" << "<string>English</string>" << "\n"	      << "\t\t\t\t\t" << "<key>CFBundleExecutable</key>" << "\n"	      << "\t\t\t\t\t" << "<string>" << project->first("QMAKE_ORIG_TARGET") << "</string>" << "\n"	      << "\t\t\t\t\t" << "<key>CFBundleIconFile</key>" << "\n"	      << "\t\t\t\t\t" << "<string>" << var("RC_FILE").section(Option::dir_sep, -1) << "</string>" << "\n"	      << "\t\t\t\t\t" << "<key>CFBundleInfoDictionaryVersion</key>"  << "\n"	      << "\t\t\t\t\t" << "<string>6.0</string>" << "\n"	      << "\t\t\t\t\t" << "<key>CFBundlePackageType</key>" << "\n"	      << "\t\t\t\t\t" << "<string>APPL</string>" << "\n"	      << "\t\t\t\t\t" << "<key>CFBundleSignature</key>" << "\n"		//Although the output below looks strange it is to avoid the trigraph ??<	      << "\t\t\t\t\t" << "<string>????" << "</string>" << "\n"	      << "\t\t\t\t\t" << "<key>CFBundleVersion</key>" << "\n"	      << "\t\t\t\t\t" << "<string>0.1</string>" << "\n"	      << "\t\t\t\t\t" << "<key>CSResourcesFileMapped</key>" << "\n"	      << "\t\t\t\t\t" << "<true/>" << "\n"	      << "\t\t\t\t" << "</dict>" << "\n"	      << "\t\t\t\t" << "</plist>" << "\";" << "\n";	} else {	    t << "\t\t\t" << "isa = PBXToolTarget;" << "\n";	}	t << "\t\t\t" << "name = \"" << project->first("QMAKE_ORIG_TARGET") << "\";" << "\n"	  << "\t\t\t" << "productName = " << project->first("QMAKE_ORIG_TARGET") << ";" << "\n";    } else {	QString lib = project->first("QMAKE_ORIG_TARGET");	if(!project->isActiveConfig("frameworklib"))	   lib.prepend("lib");	t << "\t\t\t" << "isa = PBXLibraryTarget;" << "\n"	  << "\t\t\t" << "name = \"" << lib << "\";" << "\n"	  << "\t\t\t" << "productName = " << lib << ";" << "\n";    }    if(!project->isEmpty("DESTDIR"))	t << "\t\t\t" << "productInstallPath = \"" << project->first("DESTDIR") << "\";" << "\n";    t << "\t\t" << "};" << "\n";    //DEBUG/RELEASE    QString active_buildstyle;#if 0    for(int as_release = 0; as_release < 2; as_release++) #else	bool as_release = !project->isActiveConfig("debug");#endif    {	QString key = keyFor("QMAKE_PBX_" + QString(as_release ? "RELEASE" : "DEBUG"));	if(project->isActiveConfig("debug") != as_release) 	    active_buildstyle = key;	project->variables()["QMAKE_PBX_BUILDSTYLES"].append(key);	t << "\t\t" << key << " = {" << "\n"	  << "\t\t\t" << "buildRules = (" << "\n"	  << "\t\t\t" << ");" << "\n"	  << "\t\t\t" << "buildSettings = {" << "\n"	  << "\t\t\t\t" << "COPY_PHASE_STRIP = " << (as_release ? "YES" : "NO") << ";" << "\n";	if(as_release) 	    t << "\t\t\t\t" << "DEBUGGING_SYMBOLS = NO;" << "\n";	t << "\t\t\t" << "};" << "\n"	  << "\t\t\t" << "isa = PBXBuildStyle;" << "\n"	  << "\t\t\t" << "name = " << (as_release ? "Deployment" : "Development") << ";" << "\n"	  << "\t\t" << "};" << "\n";    }    //ROOT    t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n"      << "\t\t\t" << "buildStyles = (" << "\n"      << varGlue("QMAKE_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_PBX_ROOT_GROUP") << ";" << "\n"      << "\t\t\t" << "targets = (" << "\n"      << "\t\t\t\t" << keyFor("QMAKE_PBX_TARGET") << "\n"      << "\t\t\t" << ");" << "\n"      << "\t\t" << "};" << "\n";    //FOOTER    t << "\t" << "};" << "\n"      << "\t" << "rootObject = " << keyFor("QMAKE_PBX_ROOT") << ";" << "\n"      << "}" << endl;    QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), 				QDir::currentDirPath());    QFile mkwrapf(mkwrap);    if(mkwrapf.open(IO_WriteOnly | IO_Translate)) {	debug_msg(1, "pbuilder: Creating file: %s", mkwrap.latin1());	QTextStream mkwrapt(&mkwrapf);	writeHeader(mkwrapt);	const char *cleans = "uiclean mocclean preprocess_clean ";	mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n"		<< "all:" << "\n\t" 		<< "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild") << "\n"		<< "install: all" << "\n\t" 		<< "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild install") << "\n"		<< "distclean clean: preprocess_clean" << "\n\t" 		<< "cd " << (project->first("QMAKE_ORIG_TARGET") + ".pbproj/ && pbxbuild clean") << "\n"		<< (!did_preprocess ? cleans : "") << ":" << "\n";	if(did_preprocess) 	    mkwrapt << cleans << ":" << "\n\t"		    << "make -f " 		    << pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl;    }    return TRUE;}QStringProjectBuilderMakefileGenerator::fixEnvs(const QString &file){    QRegExp reg_var("\\$\\((.*)\\)");    for(int rep = 0; (rep = reg_var.search(file, rep)) != -1; ) {	if(project->variables()["QMAKE_PBX_VARS"].findIndex(reg_var.cap(1)) == -1)	    project->variables()["QMAKE_PBX_VARS"].append(reg_var.cap(1));	rep += reg_var.matchedLength();    }    return file;}QStringProjectBuilderMakefileGenerator::fixEnvsList(const QString &where){    QString ret;    const QStringList &l = project->variables()[where];    for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {	fixEnvs((*it));	if(!ret.isEmpty())	    ret += " ";	ret += (*it);    }    return ret;}QStringProjectBuilderMakefileGenerator::keyFor(const QString &block){#if 1 //This make this code much easier to debug..    if(project->isActiveConfig("pbx_no_munge_key"))       return block;#endif    QString ret;    if(!keys.contains(block)) {#if 0	static unsigned int r = 0;	ret.sprintf("%024x", ++r);#else //not really necesary, but makes it look more interesting..	static struct { unsigned int a1, a2, a3; } r = { 0, 0, 0 };	if(!r.a1 && !r.a2 && !r.a3) {	    r.a1 = rand();	    r.a2 = rand();	    r.a3 = rand();	}	switch(rand() % 3) {	case 0: ++r.a1; break;	case 1: ++r.a2; break;	case 2: ++r.a3; break;	}	ret.sprintf("%08x%08x%08x", r.a1, r.a2, r.a3);#endif	ret = ret.upper();	keys.insert(block, ret);    } else {	ret = keys[block];    }    return ret;}boolProjectBuilderMakefileGenerator::openOutput(QFile &file) const{    if(project->first("TEMPLATE") != "subdirs") {	QFileInfo fi(file);	if(fi.extension() != "pbxproj" || file.name().isEmpty()) {	    QString output = file.name();	    if(fi.isDir())		output += QDir::separator();	    if(fi.extension() != "pbproj") {		if(file.name().isEmpty() || fi.isDir())		    output += project->first("TARGET");		output += QString(".pbproj") + QDir::separator();	    } else if(output[(int)output.length() - 1] != QDir::separator()) {		output += QDir::separator();	    }	    output += QString("project.pbxproj");	    file.setName(output);	}	bool ret = UnixMakefileGenerator::openOutput(file);	((ProjectBuilderMakefileGenerator*)this)->pbx_dir = Option::output_dir.section(Option::dir_sep, 0, -1);	Option::output_dir = pbx_dir.section(Option::dir_sep, 0, -2); 	return ret;    }    return UnixMakefileGenerator::openOutput(file);}/* This function is such a hack it is almost pointless, but it   eliminates the warning message from ProjectBuilder that the project   file is for an older version. I guess this could be used someday if   the format of the output is dependant upon the version of   ProjectBuilder as well.*/intProjectBuilderMakefileGenerator::pbuilderVersion() const{    QString ret;    if(project->isEmpty("QMAKE_PBUILDER_VERSION")) {	QString version, version_plist = project->first("QMAKE_PBUILDER_VERSION_PLIST");	if(version_plist.isEmpty())	    version_plist = "/Developer/Applications/Project Builder.app/Contents/version.plist";	else	    version_plist = version_plist.replace(QRegExp("\""), "");	QFile version_file(version_plist);	if(version_file.open(IO_ReadOnly)) {	    debug_msg(1, "pbuilder: version.plist: Reading file: %s", version_plist.latin1());	    QTextStream plist(&version_file);	    bool in_dict = FALSE;	    QString current_key;	    QRegExp keyreg("^<key>(.*)</key>$"), stringreg("^<string>(.*)</string>$");	    while(!plist.eof()) {		QString line = plist.readLine().stripWhiteSpace();		if(line == "<dict>")		    in_dict = TRUE;		else if(line == "</dict>")		    in_dict = FALSE;		else if(in_dict) {		    if(keyreg.exactMatch(line))			current_key = keyreg.cap(1);		    else if(current_key == "CFBundleShortVersionString" && stringreg.exactMatch(line))			version = stringreg.cap(1);		}	    }	    version_file.close();	} else debug_msg(1, "pbuilder: version.plist: Failure to open %s", version_plist.latin1());	if(version.startsWith("2.0"))	    ret = "38";	else if(version == "1.1")	    ret = "34";    } else {	ret = project->first("QMAKE_PBUILDER_VERSION");    }    if(!ret.isEmpty()) {	bool ok;	int int_ret = ret.toInt(&ok);	if(ok) {	    debug_msg(1, "pbuilder: version.plist: Got version: %d", int_ret);	    return int_ret;	}    }    debug_msg(1, "pbuilder: version.plist: Fallback to default version");    return 34; //my fallback}QStringProjectBuilderMakefileGenerator::reftypeForFile(const QString &where){    if(QDir::isRelativePath(where))	return "4"; //relative    return "0"; //absolute}

⌨️ 快捷键说明

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