author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (side-by-side diff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/generators/win32/msvc_dsp.cpp | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
Diffstat (limited to 'qmake/generators/win32/msvc_dsp.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | qmake/generators/win32/msvc_dsp.cpp | 163 |
1 files changed, 103 insertions, 60 deletions
diff --git a/qmake/generators/win32/msvc_dsp.cpp b/qmake/generators/win32/msvc_dsp.cpp index 8b08c78..3fa0496 100644 --- a/qmake/generators/win32/msvc_dsp.cpp +++ b/qmake/generators/win32/msvc_dsp.cpp @@ -463,211 +463,235 @@ DspMakefileGenerator::writeDspParts(QTextStream &t) "\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") << " - Win32 Release\"" << build << "!ELSEIF \"$(CFG)\" == \"" << var("MSVCDSP_PROJECT") << " - Win32 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); } t << line << endl; } t << endl; file.close(); return TRUE; } void DspMakefileGenerator::init() { if(init_flag) return; QStringList::Iterator it; init_flag = TRUE; + const bool thread = project->isActiveConfig("thread"); + + if ( project->isActiveConfig("stl") ) { + project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_ON"]; + project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_ON"]; + } else { + project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_STL_OFF"]; + project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_STL_OFF"]; + } + if ( project->isActiveConfig("exceptions") ) { + project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_ON"]; + project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_ON"]; + } else { + project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_EXCEPTIONS_OFF"]; + project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_EXCEPTIONS_OFF"]; + } + if ( project->isActiveConfig("rtti") ) { + project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_ON"]; + project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_ON"]; + } else { + project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_RTTI_OFF"]; + project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_RTTI_OFF"]; + } + /* this should probably not be here, but I'm using it to wrap the .t files */ if(project->first("TEMPLATE") == "vcapp" ) project->variables()["QMAKE_APP_FLAG"].append("1"); else if(project->first("TEMPLATE") == "vclib") project->variables()["QMAKE_LIB_FLAG"].append("1"); if ( project->variables()["QMAKESPEC"].isEmpty() ) project->variables()["QMAKESPEC"].append( getenv("QMAKESPEC") ); bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX); project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"]; QStringList &configs = project->variables()["CONFIG"]; if (project->isActiveConfig("shared")) project->variables()["DEFINES"].append("QT_DLL"); if (project->isActiveConfig("qt_dll")) if(configs.findIndex("qt") == -1) configs.append("qt"); if ( project->isActiveConfig("qt") ) { if ( project->isActiveConfig( "plugin" ) ) { project->variables()["CONFIG"].append("dll"); project->variables()["DEFINES"].append("QT_PLUGIN"); } if ( (project->variables()["DEFINES"].findIndex("QT_NODLL") == -1) && ((project->variables()["DEFINES"].findIndex("QT_MAKEDLL") != -1 || project->variables()["DEFINES"].findIndex("QT_DLL") != -1) || (getenv("QT_DLL") && !getenv("QT_NODLL"))) ) { project->variables()["QMAKE_QT_DLL"].append("1"); if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) project->variables()["CONFIG"].append("dll"); } } if ( project->isActiveConfig("dll") || !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { project->variables()["CONFIG"].remove("staticlib"); project->variables()["QMAKE_APP_OR_DLL"].append("1"); } else { project->variables()["CONFIG"].append("staticlib"); } if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") ) { project->variables()["CONFIG"].append("windows"); } if ( !project->variables()["VERSION"].isEmpty() ) { QString version = project->variables()["VERSION"][0]; int firstDot = version.find( "." ); QString major = version.left( firstDot ); QString minor = version.right( version.length() - firstDot - 1 ); minor.replace( ".", "" ); project->variables()["MSVCDSP_VERSION"].append( "/VERSION:" + major + "." + minor ); } if ( project->isActiveConfig("qt") ) { project->variables()["CONFIG"].append("moc"); project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"]; project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QT"]; if ( is_qt && !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { project->variables()["DEFINES"].append("QT_MAKEDLL"); project->variables()["QMAKE_LFLAGS"].append("/base:\"0x39D00000\""); } } else { - if(project->isActiveConfig("thread")) + if( thread ) project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"]; else project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"]; if ( !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { int hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt"); if ( hver == -1 ) hver = findHighestVersion(project->first("QMAKE_LIBDIR_QT"), "qt-mt"); if(hver != -1) { QString ver; - ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (project->isActiveConfig("thread") ? "-mt" : ""), hver); + ver.sprintf("qt%s" QTDLL_POSTFIX "%d.lib", (thread ? "-mt" : ""), hver); QStringList &libs = project->variables()["QMAKE_LIBS"]; for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) (*libit).replace(QRegExp("qt(-mt)?\\.lib"), ver); } } if ( project->isActiveConfig( "activeqt" ) ) { project->variables().remove("QMAKE_LIBS_QT_ENTRY"); project->variables()["QMAKE_LIBS_QT_ENTRY"] = "qaxserver.lib"; if ( project->isActiveConfig( "dll" ) ) project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_ENTRY"]; } if ( !project->isActiveConfig("dll") && !project->isActiveConfig("plugin") ) { project->variables()["QMAKE_LIBS"] +=project->variables()["QMAKE_LIBS_QT_ENTRY"]; } } } if ( project->isActiveConfig("debug") ) { if ( !project->first("OBJECTS_DIR").isEmpty() ) project->variables()["MSVCDSP_OBJECTSDIRDEB"] = project->first("OBJECTS_DIR"); else project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; project->variables()["MSVCDSP_OBJECTSDIRREL"] = "Release"; if ( !project->first("DESTDIR").isEmpty() ) project->variables()["MSVCDSP_TARGETDIRDEB"] = project->first("DESTDIR"); else project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; } else { if ( !project->first("OBJECTS_DIR").isEmpty() ) project->variables()["MSVCDSP_OBJECTSDIRREL"] = project->first("OBJECTS_DIR"); project->variables()["MSVCDSP_OBJECTSDIRDEB"] = "Debug"; if ( !project->first("DESTDIR").isEmpty() ) project->variables()["MSVCDSP_TARGETDIRREL"] = project->first("DESTDIR"); else project->variables()["MSVCDSP_TARGETDIRREL"] = "Release"; project->variables()["MSVCDSP_TARGETDIRDEB"] = "Debug"; } if ( project->isActiveConfig("opengl") ) { project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"]; project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_OPENGL"]; } - if ( project->isActiveConfig("thread") ) { + if ( thread ) { if(project->isActiveConfig("qt")) project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT" ); if ( project->isActiveConfig("dll") || project->first("TARGET") == "qtmain" || !project->variables()["QMAKE_QT_DLL"].isEmpty() ) { project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DLLDBG"]; project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT_DLL"]; } else { // YES we want to use the DLL even in a static build project->variables()["MSVCDSP_MTDEFD"] += project->variables()["QMAKE_CXXFLAGS_MT_DBG"]; project->variables()["MSVCDSP_MTDEF"] += project->variables()["QMAKE_CXXFLAGS_MT"]; } if ( !project->variables()["DEFINES"].contains("QT_DLL") && is_qt && project->first("TARGET") != "qtmain" ) project->variables()["QMAKE_LFLAGS"].append("/NODEFAULTLIB:\"libc\""); } if(project->isActiveConfig("qt")) { if ( project->isActiveConfig("accessibility" ) ) project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT"); if ( project->isActiveConfig("tablet") ) project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT"); } if ( project->isActiveConfig("dll") ) { if ( !project->variables()["QMAKE_LIB_FLAG"].isEmpty() ) { QString ver_xyz(project->first("VERSION")); ver_xyz.replace(".", ""); project->variables()["TARGET_EXT"].append(ver_xyz + ".dll"); } else { project->variables()["TARGET_EXT"].append(".dll"); } } else { if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) project->variables()["TARGET_EXT"].append(".exe"); else project->variables()["TARGET_EXT"].append(".lib"); } project->variables()["MSVCDSP_VER"] = "6.00"; project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /ZI"; if(!project->isActiveConfig("incremental")) { project->variables()["QMAKE_LFLAGS"].append(QString("/incremental:no")); if ( is_qt ) project->variables()["MSVCDSP_DEBUG_OPT"] = "/GZ /Zi"; } QString msvcdsp_project; if ( project->variables()["TARGET"].count() ) @@ -687,269 +711,288 @@ DspMakefileGenerator::init() for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner) (*inner) = Option::fixPathToTargetOS((*inner), FALSE); } MakefileGenerator::init(); if ( msvcdsp_project.isEmpty() ) msvcdsp_project = Option::output.name(); msvcdsp_project = msvcdsp_project.right( msvcdsp_project.length() - msvcdsp_project.findRev( "\\" ) - 1 ); msvcdsp_project = msvcdsp_project.left( msvcdsp_project.findRev( "." ) ); msvcdsp_project.replace("-", ""); project->variables()["MSVCDSP_PROJECT"].append(msvcdsp_project); QStringList &proj = project->variables()["MSVCDSP_PROJECT"]; for(it = proj.begin(); it != proj.end(); ++it) (*it).replace(QRegExp("\\.[a-zA-Z0-9_]*$"), ""); if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) { project->variables()["MSVCDSP_TEMPLATE"].append("win32app" + project->first( "DSP_EXTENSION" ) ); if ( project->isActiveConfig("console") ) { project->variables()["MSVCDSP_CONSOLE"].append("Console"); project->variables()["MSVCDSP_WINCONDEF"].append("_CONSOLE"); project->variables()["MSVCDSP_DSPTYPE"].append("0x0103"); project->variables()["MSVCDSP_SUBSYSTEM"].append("console"); } else { project->variables()["MSVCDSP_CONSOLE"].clear(); project->variables()["MSVCDSP_WINCONDEF"].append("_WINDOWS"); project->variables()["MSVCDSP_DSPTYPE"].append("0x0101"); project->variables()["MSVCDSP_SUBSYSTEM"].append("windows"); } } else { if ( project->isActiveConfig("dll") ) { project->variables()["MSVCDSP_TEMPLATE"].append("win32dll" + project->first( "DSP_EXTENSION" ) ); } else { project->variables()["MSVCDSP_TEMPLATE"].append("win32lib" + project->first( "DSP_EXTENSION" ) ); } } project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_WINDOWS"]; project->variables()["MSVCDSP_LFLAGS" ] += project->variables()["QMAKE_LFLAGS"]; if ( !project->variables()["QMAKE_LIBDIR"].isEmpty() ) project->variables()["MSVCDSP_LFLAGS" ].append(varGlue("QMAKE_LIBDIR","/LIBPATH:\"","\" /LIBPATH:\"","\"")); project->variables()["MSVCDSP_CXXFLAGS" ] += project->variables()["QMAKE_CXXFLAGS"]; project->variables()["MSVCDSP_DEFINES"].append(varGlue("DEFINES","/D ","" " /D ","")); project->variables()["MSVCDSP_DEFINES"].append(varGlue("PRL_EXPORT_DEFINES","/D ","" " /D ","")); + processPrlFiles(); QStringList &libs = project->variables()["QMAKE_LIBS"]; for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) { QString lib = (*libit); lib.replace(QRegExp("\""), ""); project->variables()["MSVCDSP_LIBS"].append(" \"" + lib + "\""); } QStringList &incs = project->variables()["INCLUDEPATH"]; for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { QString inc = (*incit); inc.replace("\"", ""); project->variables()["MSVCDSP_INCPATH"].append("/I \"" + inc + "\""); } project->variables()["MSVCDSP_INCPATH"].append("/I \"" + specdir() + "\""); if ( project->isActiveConfig("qt") ) { project->variables()["MSVCDSP_RELDEFS"].append("/D \"QT_NO_DEBUG\""); } else { project->variables()["MSVCDSP_RELDEFS"].clear(); } QString dest; + QString postLinkStep; + QString copyDllStep; + QString activeQtStepPreCopyDll; + QString activeQtStepPostCopyDll; + QString activeQtStepPreCopyDllDebug; + QString activeQtStepPostCopyDllDebug; + QString activeQtStepPreCopyDllRelease; + QString activeQtStepPostCopyDllRelease; + + if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() ) + postLinkStep += var("QMAKE_POST_LINK"); + if ( !project->variables()["DESTDIR"].isEmpty() ) { project->variables()["TARGET"].first().prepend(project->first("DESTDIR")); Option::fixPathToTargetOS(project->first("TARGET")); dest = project->first("TARGET"); if ( project->first("TARGET").startsWith("$(QTDIR)") ) dest.replace( "$(QTDIR)", getenv("QTDIR") ); project->variables()["MSVCDSP_TARGET"].append( QString("/out:\"") + dest + "\""); if ( project->isActiveConfig("dll") ) { QString imp = dest; imp.replace(".dll", ".lib"); project->variables()["MSVCDSP_TARGET"].append(QString(" /implib:\"") + imp + "\""); } } if ( project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty() ) { QStringList dlldirs = project->variables()["DLLDESTDIR"]; - QString copydll = "# Begin Special Build Tool\n" - "TargetPath=" + dest + "\n" - "SOURCE=$(InputPath)\n" - "PostBuild_Desc=Copy DLL to " + project->first("DLLDESTDIR") + "\n" - "PostBuild_Cmds="; - + if ( dlldirs.count() ) + copyDllStep += "\t"; for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) { - copydll += "copy \"" + dest + "\" \"" + *dlldir + "\"\t"; + copyDllStep += "copy \"$(TargetPath)\" \"" + *dlldir + "\"\t"; } - - copydll += "\n# End Special Build Tool"; - project->variables()["MSVCDSP_COPY_DLL_REL"].append( copydll ); - project->variables()["MSVCDSP_COPY_DLL_DBG"].append( copydll ); } + if ( project->isActiveConfig("activeqt") ) { QString idl = project->variables()["QMAKE_IDL"].first(); QString idc = project->variables()["QMAKE_IDC"].first(); QString version = project->variables()["VERSION"].first(); if ( version.isEmpty() ) version = "1.0"; project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".idl" ); project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".tlb" ); project->variables()["MSVCDSP_IDLSOURCES"].append( "tmp\\" + targetfilename + ".midl" ); if ( project->isActiveConfig( "dll" ) ) { - QString regcmd = "# Begin Special Build Tool\n" - "TargetPath=" + targetfilename + "\n" - "SOURCE=$(InputPath)\n" - "PostBuild_Desc=Finalizing ActiveQt server...\n" - "PostBuild_Cmds=" + - idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + + activeQtStepPreCopyDll += + "\t" + idc + " %1 -idl tmp\\" + targetfilename + ".idl -version " + version + "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" - "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" - "\t" + idc + " %1 /regserver\n" - "# End Special Build Tool"; + "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; + activeQtStepPostCopyDll += + "\t" + idc + " %1 /regserver\n"; - QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); - project->variables()["MSVCDSP_COPY_DLL_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); + QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".dll"; + activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); + activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); - executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); - project->variables()["MSVCDSP_COPY_DLL_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); + executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".dll"; + activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); + activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); } else { - QString regcmd = "# Begin Special Build Tool\n" - "TargetPath=" + targetfilename + "\n" - "SOURCE=$(InputPath)\n" - "PostBuild_Desc=Finalizing ActiveQt server...\n" - "PostBuild_Cmds=" - "%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + + activeQtStepPreCopyDll += + "\t%1 -dumpidl tmp\\" + targetfilename + ".idl -version " + version + "\t" + idl + " tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl" - "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb" - "\t%1 -regserver\n" - "# End Special Build Tool"; + "\t" + idc + " %1 /tlb tmp\\" + targetfilename + ".tlb"; + activeQtStepPostCopyDll += + "\t%1 -regserver\n"; + QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + targetfilename + ".exe"; + activeQtStepPreCopyDllRelease = activeQtStepPreCopyDll.arg(executable).arg(executable); + activeQtStepPostCopyDllRelease = activeQtStepPostCopyDll.arg(executable); - QString executable = project->variables()["MSVCDSP_TARGETDIRREL"].first() + "\\" + project->variables()["TARGET"].first(); - project->variables()["MSVCDSP_REGSVR_REL"].append( regcmd.arg(executable).arg(executable).arg(executable) ); + executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + targetfilename + ".exe"; + activeQtStepPreCopyDllDebug = activeQtStepPreCopyDll.arg(executable).arg(executable); + activeQtStepPostCopyDllDebug = activeQtStepPostCopyDll.arg(executable); + } - executable = project->variables()["MSVCDSP_TARGETDIRDEB"].first() + "\\" + project->variables()["TARGET"].first(); - project->variables()["MSVCDSP_REGSVR_DBG"].append( regcmd.arg(executable).arg(executable).arg(executable) ); } + + if ( !postLinkStep.isEmpty() || !copyDllStep.isEmpty() || !activeQtStepPreCopyDllDebug.isEmpty() || !activeQtStepPreCopyDllRelease.isEmpty() ) { + project->variables()["MSVCDSP_POST_LINK_DBG"].append( + "# Begin Special Build Tool\n" + "SOURCE=$(InputPath)\n" + "PostBuild_Desc=Post Build Step\n" + "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllDebug + copyDllStep + activeQtStepPostCopyDllDebug + "\n" + "# End Special Build Tool\n" ); + project->variables()["MSVCDSP_POST_LINK_REL"].append( + "# Begin Special Build Tool\n" + "SOURCE=$(InputPath)\n" + "PostBuild_Desc=Post Build Step\n" + "PostBuild_Cmds=" + postLinkStep + activeQtStepPreCopyDllRelease + copyDllStep + activeQtStepPostCopyDllRelease + "\n" + "# End Special Build Tool\n" ); } + if ( !project->variables()["SOURCES"].isEmpty() || !project->variables()["RC_FILE"].isEmpty() ) { project->variables()["SOURCES"] += project->variables()["RC_FILE"]; } QStringList &list = project->variables()["FORMS"]; for( it = list.begin(); it != list.end(); ++it ) { if ( QFile::exists( *it + ".h" ) ) project->variables()["SOURCES"].append( *it + ".h" ); } project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "MSVCDSP_LIBS"; } QString -DspMakefileGenerator::findTemplate(QString file) +DspMakefileGenerator::findTemplate(const QString &file) { QString ret; if(!QFile::exists((ret = file)) && !QFile::exists((ret = QString(Option::mkfile::qmakespec + "/" + file))) && !QFile::exists((ret = QString(getenv("QTDIR")) + "/mkspecs/win32-msvc/" + file)) && !QFile::exists((ret = (QString(getenv("HOME")) + "/.tmake/" + file)))) return ""; return ret; } void DspMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l) { if(var == "QMAKE_PRL_DEFINES") { QStringList &out = project->variables()["MSVCDSP_DEFINES"]; for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if(out.findIndex((*it)) == -1) out.append((" /D \"" + *it + "\"")); } } else { MakefileGenerator::processPrlVariable(var, l); } } -int +void DspMakefileGenerator::beginGroupForFile(QString file, QTextStream &t, - QString filter) + const QString& filter) { if(project->isActiveConfig("flat")) - return 0; + return; fileFixify(file, QDir::currentDirPath(), QDir::currentDirPath(), TRUE); file = file.section(Option::dir_sep, 0, -2); if(file.right(Option::dir_sep.length()) != Option::dir_sep) file += Option::dir_sep; if(file == currentGroup) - return 0; + return; if(file.isEmpty() || !QDir::isRelativePath(file)) { endGroups(t); - return 0; + return; } if(file.startsWith(currentGroup)) file = file.mid(currentGroup.length()); - else - endGroups(t); - int lvl = file.contains(Option::dir_sep), old_lvl = currentGroup.contains(Option::dir_sep); - if(lvl > old_lvl) { - QStringList dirs = QStringList::split(Option::dir_sep, file); + int dirSep = currentGroup.findRev( Option::dir_sep ); + while( !file.startsWith( currentGroup ) && dirSep != -1 ) { + currentGroup.truncate( dirSep ); + dirSep = currentGroup.findRev( Option::dir_sep ); + if ( !file.startsWith( currentGroup ) && dirSep != -1 ) + t << "\n# End Group\n"; + } + if ( !file.startsWith( currentGroup ) ) { + t << "\n# End Group\n"; + currentGroup = ""; + } + QStringList dirs = QStringList::split(Option::dir_sep, file.right( file.length() - currentGroup.length() ) ); for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) { t << "# Begin Group \"" << (*dir_it) << "\"\n" << "# Prop Default_Filter \"" << filter << "\"\n"; } - } else { - for(int x = old_lvl - lvl; x; x--) - t << "\n# End Group\n"; - } currentGroup = file; - return lvl - old_lvl; } -int +void DspMakefileGenerator::endGroups(QTextStream &t) { if(project->isActiveConfig("flat")) - return 0; + return; else if(currentGroup.isEmpty()) - return 0; + return; QStringList dirs = QStringList::split(Option::dir_sep, currentGroup); for(QStringList::Iterator dir_it = dirs.end(); dir_it != dirs.begin(); --dir_it) { t << "\n# End Group\n"; } currentGroup = ""; - return dirs.count(); } bool DspMakefileGenerator::openOutput(QFile &file) const { QString outdir; if(!file.name().isEmpty()) { QFileInfo fi(file); if(fi.isDir()) outdir = file.name() + QDir::separator(); } if(!outdir.isEmpty() || file.name().isEmpty()) file.setName(outdir + project->first("TARGET") + project->first("DSP_EXTENSION")); if(QDir::isRelativePath(file.name())) { QString ofile; ofile = file.name(); int slashfind = ofile.findRev('\\'); if (slashfind == -1) { ofile = ofile.replace(QRegExp("-"), "_"); } else { int hypenfind = ofile.find('-', slashfind); while (hypenfind != -1 && slashfind < hypenfind) { ofile = ofile.replace(hypenfind, 1, "_"); hypenfind = ofile.find('-', hypenfind + 1); } } file.setName(Option::fixPathToLocalOS(QDir::currentDirPath() + Option::dir_sep + ofile)); } return Win32MakefileGenerator::openOutput(file); } |