📄 msvc_dsp.cpp
字号:
fname.prepend(uiSourcesDir); else if ( ext == ".h" && !uiHeadersDir.isEmpty() ) fname.prepend(uiHeadersDir); else fname = base;// beginGroupForFile(fname, t); t << "# Begin Source File\n\nSOURCE=" << fname << "\n# End Source File" << endl; }// endGroups(t); } else if(variable == "MSVCDSP_TRANSLATIONS" ) { if(project->variables()["TRANSLATIONS"].isEmpty()) continue; t << "# Begin Group \"Translations\"\n"; t << "# Prop Default_Filter \"ts\"\n"; QStringList list = project->variables()["TRANSLATIONS"]; if(!project->isActiveConfig("flat")) list.sort(); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { QString sify = *it; sify.replace('/', '\\' ); QString base = (*it); base.replace(QRegExp("\\..*$"), "").upper(); base.replace(QRegExp("[^a-zA-Z]"), "_");// beginGroupForFile(sify, t); t << "# Begin Source File\n\nSOURCE=" << sify << endl; t << "\n# End Source File" << endl; }// endGroups(t); t << "\n# End Group\n"; } else if (variable == "MSVCDSP_MOCSOURCES" && project->isActiveConfig("moc")) { if ( project->variables()["SRCMOC"].isEmpty()) continue; QString mocpath = var( "QMAKE_MOC" ); mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; QStringList list = project->variables()["SRCMOC"]; if(!project->isActiveConfig("flat")) list.sort(); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) {// beginGroupForFile((*it), t); t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; if ( project->isActiveConfig("moc") && (*it).endsWith(Option::cpp_moc_ext)) { QString base = (*it); base.replace(QRegExp("\\..*$"), "").upper(); base.replace(QRegExp("[^a-zA-Z]"), "_"); QString build = "\n\n# Begin Custom Build - Moc'ing " + findMocSource((*it)) + "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + (*it) + "\"" " : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n" "\t" + mocpath + findMocSource((*it)) + " -o " + (*it) + "\n\n" "# End Custom Build\n\n"; t << "USERDEP_" << base << "=\".\\" << findMocSource((*it)) << "\" \"$(QTDIR)\\bin\\moc.exe\"" << endl << endl; t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build << "!ENDIF " << endl << endl; } t << "# End Source File" << endl; }// endGroups(t); } else if(variable == "MSVCDSP_PICTURES") { if(project->variables()["IMAGES"].isEmpty()) continue; t << "# Begin Group \"Images\"\n" << "# Prop Default_Filter \"png jpeg bmp xpm\"\n"; QStringList list = project->variables()["IMAGES"]; if(!project->isActiveConfig("flat")) list.sort(); QStringList::Iterator it; // dump the image list to a file UIC can read. QFile f( "images.tmp" ); f.open( IO_WriteOnly ); QTextStream ts( &f ); for( it = list.begin(); it != list.end(); ++it ) ts << " " << *it; f.close(); // create an output step for images not more than once bool imagesBuildDone = FALSE; for( it = list.begin(); it != list.end(); ++it ) {// beginGroupForFile((*it), t); t << "# Begin Source File\n\nSOURCE=" << (*it) << endl; QString base = (*it); QString uicpath = var("QMAKE_UIC"); uicpath = uicpath.replace(QRegExp("\\..*$"), "") + " "; if ( !imagesBuildDone ) { imagesBuildDone = TRUE; QString build = "\n\n# Begin Custom Build - Creating image collection...\n" "InputPath=.\\" + base + "\n\n"; build += "\"" + project->first("QMAKE_IMAGE_COLLECTION") + "\" : $(SOURCE) \"$(INTDIR)\" \"$(OUTDIR)\"\n"; build += "\t" + uicpath + "-embed " + project->first("QMAKE_ORIG_TARGET") + " -f images.tmp -o " + project->first("QMAKE_IMAGE_COLLECTION") + "\n\n"; build.append("# End Custom Build\n\n"); t << "USERDEP_" << base << "="; QStringList::Iterator it2 = list.begin(); while ( it2 != list.end() ) { t << "\"" << (*it2) << "\""; it2++; if ( it2 != list.end() ) t << "\\\n"; } t << endl << endl; t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Release\"" << build << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 Debug\"" << build << "!ENDIF \n\n" << endl; } t << "# End Source File" << endl; }// endGroups(t); t << "\n# End Group\n"; } else if(variable == "MSVCDSP_FORMS") { if(project->variables()["FORMS"].isEmpty()) continue; t << "# Begin Group \"Forms\"\n" << "# Prop Default_Filter \"ui\"\n"; QString uicpath = var("QMAKE_UIC"); uicpath = uicpath.replace(QRegExp("\\..*$"), "") + " "; QString mocpath = var( "QMAKE_MOC" ); mocpath = mocpath.replace( QRegExp( "\\..*$" ), "" ) + " "; QStringList list = project->variables()["FORMS"]; if(!project->isActiveConfig("flat")) list.sort(); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { QString base = (*it);// beginGroupForFile(base, t); t << "# Begin Source File\n\nSOURCE=" << base << endl; QString fname = base; fname.replace(".ui", ""); int lbs = fname.findRev( "\\" ); QString fpath; if ( lbs != -1 ) fpath = fname.left( lbs + 1 ); fname = fname.right( fname.length() - lbs - 1 ); QString mocFile; if(!project->variables()["MOC_DIR"].isEmpty()) mocFile = project->first("MOC_DIR"); else mocFile = fpath; QString uiSourcesDir; QString uiHeadersDir; if(!project->variables()["UI_DIR"].isEmpty()) { uiSourcesDir = project->first("UI_DIR"); uiHeadersDir = project->first("UI_DIR"); } else { if ( !project->variables()["UI_SOURCES_DIR"].isEmpty() ) uiSourcesDir = project->first("UI_SOURCES_DIR"); else uiSourcesDir = fpath; if ( !project->variables()["UI_HEADERS_DIR"].isEmpty() ) uiHeadersDir = project->first("UI_HEADERS_DIR"); else uiHeadersDir = fpath; } t << "USERDEP_" << base << "=\"$(QTDIR)\\bin\\moc.exe\" \"$(QTDIR)\\bin\\uic.exe\"" << endl << endl; QString build = "\n\n# Begin Custom Build - Uic'ing " + base + "...\n" "InputPath=.\\" + base + "\n\n" "BuildCmds= \\\n\t" + uicpath + base + " -o " + uiHeadersDir + fname + ".h \\\n" "\t" + uicpath + base + " -i " + fname + ".h -o " + uiSourcesDir + fname + ".cpp \\\n" "\t" + mocpath + " " + uiHeadersDir + fname + ".h -o " + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + " \\\n"; build.append("\n\"" + uiHeadersDir + fname + ".h\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" "\t$(BuildCmds)\n\n" "\"" + uiSourcesDir + fname + ".cpp\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" "\t$(BuildCmds)\n\n" "\"" + mocFile + Option::h_moc_mod + fname + Option::h_moc_ext + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" "\t$(BuildCmds)\n\n"); build.append("# End Custom Build\n\n"); t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build << "!ENDIF \n\n" << "# End Source File" << endl; }// endGroups(t); t << "\n# End Group\n"; } else if(variable == "MSVCDSP_LEXSOURCES") { if(project->variables()["LEXSOURCES"].isEmpty()) continue; t << "# Begin Group \"Lexables\"\n" << "# Prop Default_Filter \"l\"\n"; QString lexpath = var("QMAKE_LEX") + varGlue("QMAKE_LEXFLAGS", " ", " ", "") + " "; QStringList list = project->variables()["LEXSOURCES"]; if(!project->isActiveConfig("flat")) list.sort(); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { QString fname = (*it);// beginGroupForFile(fname, t); t << "# Begin Source File\n\nSOURCE=" << fname << endl; fname.replace(".l", Option::lex_mod + Option::cpp_ext.first()); QString build = "\n\n# Begin Custom Build - Lex'ing " + (*it) + "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + fname + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" "\t" + lexpath + (*it) + "\\\n" "\tdel " + fname + "\\\n" "\tcopy lex.yy.c " + fname + "\n\n" + "# End Custom Build\n\n"; t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build << "!ENDIF \n\n" << build << "# End Source File" << endl; }// endGroups(t); t << "\n# End Group\n"; } else if(variable == "MSVCDSP_YACCSOURCES") { if(project->variables()["YACCSOURCES"].isEmpty()) continue; t << "# Begin Group \"Yaccables\"\n" << "# Prop Default_Filter \"y\"\n"; QString yaccpath = var("QMAKE_YACC") + varGlue("QMAKE_YACCFLAGS", " ", " ", "") + " "; QStringList list = project->variables()["YACCSOURCES"]; if(!project->isActiveConfig("flat")) list.sort(); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { QString fname = (*it);// beginGroupForFile(fname, t); t << "# Begin Source File\n\nSOURCE=" << fname << endl; fname.replace(".y", Option::yacc_mod); QString build = "\n\n# Begin Custom Build - Yacc'ing " + (*it) + "...\n" "InputPath=.\\" + (*it) + "\n\n" "\"" + fname + Option::cpp_ext.first() + "\" : \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"" "\n" "\t" + yaccpath + (*it) + "\\\n" "\tdel " + fname + Option::h_ext.first() + "\\\n" "\tmove y.tab.h " + fname + Option::h_ext.first() + "\n\n" + "\tdel " + fname + Option::cpp_ext.first() + "\\\n" "\tmove y.tab.c " + fname + Option::cpp_ext.first() + "\n\n" + "# End Custom Build\n\n"; t << "!IF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Release\"" << build << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - " << platform << " Debug\"" << build << "!ENDIF \n\n" << "# End Source File" << endl; }// endGroups(t); t << "\n# End Group\n"; } else if( variable == "MSVCDSP_CONFIGMODE" ) { if( project->isActiveConfig( "debug" ) ) t << "Debug"; else t << "Release"; } else if( variable == "MSVCDSP_IDLSOURCES" ) { QStringList list = project->variables()["MSVCDSP_IDLSOURCES"]; if(!project->isActiveConfig("flat")) list.sort(); for(QStringList::Iterator it = list.begin(); it != list.end(); ++it) { t << "# Begin Source File" << endl << endl; t << "SOURCE=" << (*it) << endl; t << "# PROP Exclude_From_Build 1" << endl; t << "# End Source File" << endl << endl; } } else t << var(variable); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -