diff options
Diffstat (limited to 'qmake/generators')
-rw-r--r-- | qmake/generators/win32/msvc_vcproj.cpp | 36 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcxproj.cpp | 557 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_vcxproj.h | 30 |
3 files changed, 28 insertions, 595 deletions
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp index 55d50c0..449dcb0 100644 --- a/qmake/generators/win32/msvc_vcproj.cpp +++ b/qmake/generators/win32/msvc_vcproj.cpp @@ -873,9 +873,27 @@ void VcprojGenerator::initConfiguration() break; } + if (conf.CompilerVersion >= NET2010) { + conf.OutputDirectory = project->first("DESTDIR"); + + if(conf.OutputDirectory.isEmpty()) + conf.OutputDirectory = ".\\"; + + if(!conf.OutputDirectory.endsWith("\\")) + conf.OutputDirectory += '\\'; + + // The target name could have been changed. + conf.PrimaryOutput = project->first("TARGET"); + if ( !conf.PrimaryOutput.isEmpty() && !project->first("TARGET_VERSION_EXT").isEmpty() && project->isActiveConfig("shared")) + conf.PrimaryOutput.append(project->first("TARGET_VERSION_EXT")); + } else { + conf.PrimaryOutput = project->first("PrimaryOutput"); + } + conf.Name = project->values("BUILD_NAME").join(" "); if (conf.Name.isEmpty()) conf.Name = isDebug ? "Debug" : "Release"; + conf.ConfigurationName = conf.Name; if (project->isEmpty("CE_SDK") || project->isEmpty("CE_ARCH")) { conf.Name += (conf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32"); } else { @@ -889,7 +907,6 @@ void VcprojGenerator::initConfiguration() conf.ImportLibrary = conf.linker.ImportLibrary; conf.IntermediateDirectory = project->first("OBJECTS_DIR"); conf.OutputDirectory = "."; - conf.PrimaryOutput = project->first("PrimaryOutput"); conf.WholeProgramOptimization = conf.compiler.WholeProgramOptimization; temp = project->first("UseOfATL"); if(!temp.isEmpty()) @@ -933,13 +950,16 @@ void VcprojGenerator::initCompilerTool() conf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch; conf.compiler.PrecompiledHeaderThrough = project->first("PRECOMPILED_HEADER"); conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER"); - // Minimal build option triggers an Internal Compiler Error - // when used in conjunction with /FI and /Yu, so remove it - // ### work-around for a VS 2003 bug. Move to some prf file or remove completely. - project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm"); - project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm"); - project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm"); - project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm"); + + if (conf.CompilerVersion <= NET2003) { + // Minimal build option triggers an Internal Compiler Error + // when used in conjunction with /FI and /Yu, so remove it + // ### work-around for a VS 2003 bug. Move to some prf file or remove completely. + project->values("QMAKE_CFLAGS_DEBUG").removeAll("-Gm"); + project->values("QMAKE_CFLAGS_DEBUG").removeAll("/Gm"); + project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("-Gm"); + project->values("QMAKE_CXXFLAGS_DEBUG").removeAll("/Gm"); + } } conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS")); diff --git a/qmake/generators/win32/msvc_vcxproj.cpp b/qmake/generators/win32/msvc_vcxproj.cpp index f282deb..7ba0c65 100644 --- a/qmake/generators/win32/msvc_vcxproj.cpp +++ b/qmake/generators/win32/msvc_vcxproj.cpp @@ -70,562 +70,5 @@ VCProjectWriter *VcxprojGenerator::createProjectWriter() return new VCXProjectWriter; } -bool VcxprojGenerator::writeMakefile(QTextStream &t) -{ - initProject(); // Fills the whole project with proper data - - // Generate solution file - if(project->first("TEMPLATE") == "vcsubdirs") { - if (!project->isActiveConfig("build_pass")) { - debug_msg(1, "Generator: MSVC.NET: Writing solution file"); - writeSubDirs(t); - } else { - debug_msg(1, "Generator: MSVC.NET: Not writing solution file for build_pass configs"); - } - return true; - } else - // Generate single configuration project file - if (project->first("TEMPLATE") == "vcapp" || - project->first("TEMPLATE") == "vclib") { - if(!project->isActiveConfig("build_pass")) { - debug_msg(1, "Generator: MSVC.NET: Writing single configuration project file"); - XmlOutput xmlOut(t); - projectWriter->write(xmlOut, vcxProject); - } - return true; - } - return project->isActiveConfig("build_pass"); -} - - -void VcxprojGenerator::initProject() -{ - // Initialize XML sub elements - // - Do this first since project elements may need - // - to know of certain configuration options - initConfiguration(); - initRootFiles(); - initSourceFiles(); - initHeaderFiles(); - initGeneratedFiles(); - initLexYaccFiles(); - initTranslationFiles(); - initFormFiles(); - initResourceFiles(); - initExtraCompilerOutputs(); - - // Own elements ----------------------------- - vcxProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET")); - - vcxProject.Keyword = project->first("VCPROJ_KEYWORD"); - vcxProject.PlatformName = vcxProject.Configuration.idl.TargetEnvironment; - if (vcxProject.Configuration.idl.TargetEnvironment == midlTargetNotSet) - vcxProject.PlatformName = "Win32"; - // These are not used by Qt, but may be used by customers - vcxProject.SccProjectName = project->first("SCCPROJECTNAME"); - vcxProject.SccLocalPath = project->first("SCCLOCALPATH"); - vcxProject.flat_files = project->isActiveConfig("flat"); -} - - -void VcxprojGenerator::initConfiguration() -{ - // Initialize XML sub elements - // - Do this first since main configuration elements may need - // - to know of certain compiler/linker options - VCConfiguration &conf = vcxProject.Configuration; - - initCompilerTool(); - - // Only on configuration per build - bool isDebug = project->isActiveConfig("debug"); - - if(projectTarget == StaticLib) - initLibrarianTool(); - else { - conf.linker.GenerateDebugInformation = isDebug ? _True : _False; - initLinkerTool(); - } - initResourceTool(); - initIDLTool(); - - // Own elements ----------------------------- - QString temp = project->first("BuildBrowserInformation"); - switch (projectTarget) { - case SharedLib: - conf.ConfigurationType = typeDynamicLibrary; - break; - case StaticLib: - conf.ConfigurationType = typeStaticLibrary; - break; - case Application: - default: - conf.ConfigurationType = typeApplication; - break; - } - - conf.OutputDirectory = project->first("DESTDIR"); - - if(conf.OutputDirectory.isEmpty()) - conf.OutputDirectory = ".\\"; - - if(!conf.OutputDirectory.endsWith("\\")) - conf.OutputDirectory += '\\'; - - // The target name could have been changed. - conf.PrimaryOutput = project->first("TARGET"); - if ( !conf.PrimaryOutput.isEmpty() && !project->first("TARGET_VERSION_EXT").isEmpty() && project->isActiveConfig("shared")) - conf.PrimaryOutput.append(project->first("TARGET_VERSION_EXT")); - - conf.Name = project->values("BUILD_NAME").join(" "); - if (conf.Name.isEmpty()) - conf.Name = isDebug ? "Debug" : "Release"; - conf.ConfigurationName = conf.Name; - conf.Name += (conf.idl.TargetEnvironment == midlTargetWin64 ? "|Win64" : "|Win32"); - conf.ATLMinimizesCRunTimeLibraryUsage = (project->first("ATLMinimizesCRunTimeLibraryUsage").isEmpty() ? _False : _True); - conf.BuildBrowserInformation = triState(temp.isEmpty() ? (short)unset : temp.toShort()); - temp = project->first("CharacterSet"); - conf.CharacterSet = charSet(temp.isEmpty() ? (short)charSetNotSet : temp.toShort()); - conf.DeleteExtensionsOnClean = project->first("DeleteExtensionsOnClean"); - conf.ImportLibrary = conf.linker.ImportLibrary; - conf.IntermediateDirectory = project->first("OBJECTS_DIR"); - //conf.OutputDirectory = "."; - conf.PrimaryOutput = project->first("PrimaryOutput"); - conf.WholeProgramOptimization = conf.compiler.WholeProgramOptimization; - temp = project->first("UseOfATL"); - if(!temp.isEmpty()) - conf.UseOfATL = useOfATL(temp.toShort()); - temp = project->first("UseOfMfc"); - if(!temp.isEmpty()) - conf.UseOfMfc = useOfMfc(temp.toShort()); - - // Configuration does not need parameters from - // these sub XML items; - initCustomBuildTool(); - initPreBuildEventTools(); - initPostBuildEventTools(); - initPreLinkEventTools(); - - // Set definite values in both configurations - if (isDebug) { - conf.compiler.PreprocessorDefinitions.removeAll("NDEBUG"); - } else { - conf.compiler.PreprocessorDefinitions += "NDEBUG"; - } -} - -void VcxprojGenerator::initCompilerTool() -{ - QString placement = project->first("OBJECTS_DIR"); - if(placement.isEmpty()) - placement = ".\\"; - - VCConfiguration &conf = vcxProject.Configuration; - conf.compiler.AssemblerListingLocation = placement ; - conf.compiler.ProgramDataBaseFileName = ".\\" ; - conf.compiler.ObjectFile = placement ; - conf.compiler.ExceptionHandling = ehNone; - // PCH - if (usePCH) { - conf.compiler.UsePrecompiledHeader = pchUseUsingSpecific; - conf.compiler.PrecompiledHeaderFile = "$(IntDir)\\" + precompPch; - conf.compiler.PrecompiledHeaderThrough = project->first("PRECOMPILED_HEADER"); - conf.compiler.ForcedIncludeFiles = project->values("PRECOMPILED_HEADER"); - conf.compiler.GeneratePreprocessedFile = preprocessNo; - conf.compiler.PreprocessSuppressLineNumbers = _False; - } - - conf.compiler.parseOptions(project->values("QMAKE_CXXFLAGS")); - - if (project->isActiveConfig("windows")) - conf.compiler.PreprocessorDefinitions += "_WINDOWS"; - else if (project->isActiveConfig("console")) - conf.compiler.PreprocessorDefinitions += "_CONSOLE"; - - conf.compiler.PreprocessorDefinitions += project->values("DEFINES"); - conf.compiler.PreprocessorDefinitions += project->values("PRL_EXPORT_DEFINES"); - conf.compiler.parseOptions(project->values("MSVCPROJ_INCPATH")); -} - -void VcxprojGenerator::initLinkerTool() -{ - findLibraries(); // Need to add the highest version of the libs - VCConfiguration &conf = vcxProject.Configuration; - conf.linker.parseOptions(project->values("MSVCPROJ_LFLAGS")); - - foreach(QString libs, project->values("MSVCPROJ_LIBS")) { - if (libs.left(9).toUpper() == "/LIBPATH:") { - QStringList l = QStringList(libs); - conf.linker.parseOptions(l); - } else { - conf.linker.AdditionalDependencies += libs; - } - } - - switch (projectTarget) { - case Application: - conf.linker.OutputFile = project->first("DESTDIR"); - break; - case SharedLib: - conf.linker.parseOptions(project->values("MSVCPROJ_LIBOPTIONS")); - conf.linker.OutputFile = project->first("DESTDIR"); - break; - case StaticLib: //unhandled - added to remove warnings.. - break; - } - - if(conf.linker.OutputFile.isEmpty()) - conf.linker.OutputFile = ".\\"; - - if(!conf.linker.OutputFile.endsWith("\\")) - conf.linker.OutputFile += '\\'; - - conf.linker.OutputFile += project->first("MSVCPROJ_TARGET"); - - if(project->isActiveConfig("dll")){ - conf.linker.parseOptions(project->values("QMAKE_LFLAGS_QT_DLL")); - } -} - -void VcxprojGenerator::initResourceTool() -{ - VCConfiguration &conf = vcxProject.Configuration; - conf.resource.PreprocessorDefinitions = conf.compiler.PreprocessorDefinitions; - - // We need to add _DEBUG for the debug version of the project, since the normal compiler defines - // do not contain it. (The compiler defines this symbol automatically, which is wy we don't need - // to add it for the compiler) However, the resource tool does not do this. - if(project->isActiveConfig("debug")) - conf.resource.PreprocessorDefinitions += "_DEBUG"; - if(project->isActiveConfig("staticlib")) - conf.resource.ResourceOutputFileName = project->first("DESTDIR") + "/$(InputName).res"; -} - - -void VcxprojGenerator::initPostBuildEventTools() -{ - VCConfiguration &conf = vcxProject.Configuration; - if(!project->values("QMAKE_POST_LINK").isEmpty()) { - QString cmdline = var("QMAKE_POST_LINK"); - conf.postBuild.CommandLine = cmdline; - conf.postBuild.Description = cmdline; - conf.postBuild.ExcludedFromBuild = _False; - } - - if(!project->values("MSVCPROJ_COPY_DLL").isEmpty()) { - if(!conf.postBuild.CommandLine.isEmpty()) - conf.postBuild.CommandLine += " && "; - conf.postBuild.Description += var("MSVCPROJ_COPY_DLL_DESC"); - conf.postBuild.CommandLine += var("MSVCPROJ_COPY_DLL"); - conf.postBuild.ExcludedFromBuild = _False; - } -} - -void VcxprojGenerator::initPreLinkEventTools() -{ - VCConfiguration &conf = vcxProject.Configuration; - if(!project->values("QMAKE_PRE_LINK").isEmpty()) { - QString cmdline = var("QMAKE_PRE_LINK"); - conf.preLink.Description = cmdline; - conf.preLink.CommandLine = cmdline; - conf.preLink.ExcludedFromBuild = _False; - } -} - -void VcxprojGenerator::initRootFiles() -{ - vcxProject.RootFiles.addFiles(project->values("RC_FILE")); - vcxProject.RootFiles.Project = this; - vcxProject.RootFiles.Config = &(vcxProject.Configuration); - vcxProject.RootFiles.CustomBuild = none; -} - -void VcxprojGenerator::initSourceFiles() -{ - vcxProject.SourceFiles.Name = "Source Files"; - vcxProject.SourceFiles.Filter = "cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"; - vcxProject.SourceFiles.Guid = _GUIDSourceFiles; - - vcxProject.SourceFiles.addFiles(project->values("SOURCES")); - - vcxProject.SourceFiles.Project = this; - vcxProject.SourceFiles.Config = &(vcxProject.Configuration); - vcxProject.SourceFiles.CustomBuild = none; -} - -void VcxprojGenerator::initHeaderFiles() -{ - vcxProject.HeaderFiles.Name = "Header Files"; - vcxProject.HeaderFiles.Filter = "h;hpp;hxx;hm;inl;inc;xsd"; - vcxProject.HeaderFiles.Guid = _GUIDHeaderFiles; - - vcxProject.HeaderFiles.addFiles(project->values("HEADERS")); - if (usePCH) // Generated PCH cpp file - vcxProject.HeaderFiles.addFile(precompH); - - vcxProject.HeaderFiles.Project = this; - vcxProject.HeaderFiles.Config = &(vcxProject.Configuration); -} - -void VcxprojGenerator::initGeneratedFiles() -{ - vcxProject.GeneratedFiles.Name = "Generated Files"; - vcxProject.GeneratedFiles.Filter = "cpp;c;cxx;moc;h;def;odl;idl;res"; - vcxProject.GeneratedFiles.Guid = _GUIDGeneratedFiles; - - // ### These cannot have CustomBuild (mocSrc)!! - vcxProject.GeneratedFiles.addFiles(project->values("GENERATED_SOURCES")); - vcxProject.GeneratedFiles.addFiles(project->values("GENERATED_FILES")); - vcxProject.GeneratedFiles.addFiles(project->values("IDLSOURCES")); - vcxProject.GeneratedFiles.addFiles(project->values("RES_FILE")); - vcxProject.GeneratedFiles.addFiles(project->values("QMAKE_IMAGE_COLLECTION")); // compat - if(!extraCompilerOutputs.isEmpty()) - vcxProject.GeneratedFiles.addFiles(extraCompilerOutputs.keys()); - - vcxProject.GeneratedFiles.Project = this; - vcxProject.GeneratedFiles.Config = &(vcxProject.Configuration); -} - -void VcxprojGenerator::initLexYaccFiles() -{ - vcxProject.LexYaccFiles.Name = "Lex / Yacc Files"; - vcxProject.LexYaccFiles.ParseFiles = _False; - vcxProject.LexYaccFiles.Filter = "l;y"; - vcxProject.LexYaccFiles.Guid = _GUIDLexYaccFiles; - - vcxProject.LexYaccFiles.addFiles(project->values("LEXSOURCES")); - vcxProject.LexYaccFiles.addFiles(project->values("YACCSOURCES")); - - vcxProject.LexYaccFiles.Project = this; - vcxProject.LexYaccFiles.Config = &(vcxProject.Configuration); - vcxProject.LexYaccFiles.CustomBuild = lexyacc; -} - -void VcxprojGenerator::initTranslationFiles() -{ - vcxProject.TranslationFiles.Name = "Translation Files"; - vcxProject.TranslationFiles.ParseFiles = _False; - vcxProject.TranslationFiles.Filter = "ts;xlf"; - vcxProject.TranslationFiles.Guid = _GUIDTranslationFiles; - - vcxProject.TranslationFiles.addFiles(project->values("TRANSLATIONS")); - - vcxProject.TranslationFiles.Project = this; - vcxProject.TranslationFiles.Config = &(vcxProject.Configuration); - vcxProject.TranslationFiles.CustomBuild = none; -} - - -void VcxprojGenerator::initFormFiles() -{ - vcxProject.FormFiles.Name = "Form Files"; - vcxProject.FormFiles.ParseFiles = _False; - vcxProject.FormFiles.Filter = "ui"; - vcxProject.FormFiles.Guid = _GUIDFormFiles; - - vcxProject.FormFiles.addFiles(project->values("FORMS")); - vcxProject.FormFiles.addFiles(project->values("FORMS3")); - - vcxProject.FormFiles.Project = this; - vcxProject.FormFiles.Config = &(vcxProject.Configuration); - vcxProject.FormFiles.CustomBuild = none; -} - - -void VcxprojGenerator::initResourceFiles() -{ - vcxProject.ResourceFiles.Name = "Resource Files"; - vcxProject.ResourceFiles.ParseFiles = _False; - vcxProject.ResourceFiles.Filter = "qrc;*"; //"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;ts;xlf;qrc"; - vcxProject.ResourceFiles.Guid = _GUIDResourceFiles; - - // Bad hack, please look away ------------------------------------- - QString rcc_dep_cmd = project->values("rcc.depend_command").join(" "); - if(!rcc_dep_cmd.isEmpty()) { - QStringList qrc_files = project->values("RESOURCES"); - QStringList deps; - if(!qrc_files.isEmpty()) { - for (int i = 0; i < qrc_files.count(); ++i) { - char buff[256]; - QString dep_cmd = replaceExtraCompilerVariables(rcc_dep_cmd, qrc_files.at(i),""); - - dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false); - if(canExecute(dep_cmd)) { - if(FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), "r")) { - QString indeps; - while(!feof(proc)) { - int read_in = (int)fread(buff, 1, 255, proc); - if(!read_in) - break; - indeps += QByteArray(buff, read_in); - } - QT_PCLOSE(proc); - if(!indeps.isEmpty()) - deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' ')); - } - } - } - vcxProject.ResourceFiles.addFiles(deps); - } - } - // You may look again -------------------------------------------- - - vcxProject.ResourceFiles.addFiles(project->values("RESOURCES")); - vcxProject.ResourceFiles.addFiles(project->values("IMAGES")); - - vcxProject.ResourceFiles.Project = this; - vcxProject.ResourceFiles.Config = &(vcxProject.Configuration); - vcxProject.ResourceFiles.CustomBuild = none; -} - -void VcxprojGenerator::initExtraCompilerOutputs() -{ - QStringList otherFilters; - otherFilters << "FORMS" - << "FORMS3" - << "GENERATED_FILES" - << "GENERATED_SOURCES" - << "HEADERS" - << "IDLSOURCES" - << "IMAGES" - << "LEXSOURCES" - << "QMAKE_IMAGE_COLLECTION" - << "RC_FILE" - << "RESOURCES" - << "RES_FILE" - << "SOURCES" - << "TRANSLATIONS" - << "YACCSOURCES"; - const QStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); - for(QStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { - QString extracompilerName = project->first((*it) + ".name"); - if (extracompilerName.isEmpty()) - extracompilerName = (*it); - - // Create an extra compiler filter and add the files - VCFilter extraCompile; - extraCompile.Name = extracompilerName; - extraCompile.ParseFiles = _False; - extraCompile.Filter = ""; - extraCompile.Guid = QString(_GUIDExtraCompilerFiles) + "-" + (*it); - - // If the extra compiler has a variable_out set the output file - // is added to an other file list, and does not need its own.. - bool addOnInput = hasBuiltinCompiler(project->first((*it) + ".output")); - QString tmp_other_out = project->first((*it) + ".variable_out"); - if (!tmp_other_out.isEmpty() && !addOnInput) - continue; - - if (!addOnInput) { - QString tmp_out = project->first((*it) + ".output"); - if (project->values((*it) + ".CONFIG").indexOf("combine") != -1) { - // Combined output, only one file result - extraCompile.addFile( - Option::fixPathToTargetOS(replaceExtraCompilerVariables(tmp_out, QString(), QString()), false)); - } else { - // One output file per input - QStringList tmp_in = project->values(project->first((*it) + ".input")); - for (int i = 0; i < tmp_in.count(); ++i) { - const QString &filename = tmp_in.at(i); - if (extraCompilerSources.contains(filename)) - extraCompile.addFile( - Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, tmp_out, QString()), false)); - } - } - } else { - // In this case we the outputs have a built-in compiler, so we cannot add the custom - // build steps there. So, we turn it around and add it to the input files instead, - // provided that the input file variable is not handled already (those in otherFilters - // are handled, so we avoid them). - QStringList inputVars = project->values((*it) + ".input"); - foreach(QString inputVar, inputVars) { - if (!otherFilters.contains(inputVar)) { - QStringList tmp_in = project->values(inputVar); - for (int i = 0; i < tmp_in.count(); ++i) { - const QString &filename = tmp_in.at(i); - if (extraCompilerSources.contains(filename)) - extraCompile.addFile( - Option::fixPathToTargetOS(replaceExtraCompilerVariables(filename, QString(), QString()), false)); - } - } - } - } - extraCompile.Project = this; - extraCompile.Config = &(vcxProject.Configuration); - extraCompile.CustomBuild = none; - - vcxProject.ExtraCompilersFiles.append(extraCompile); - } -} - - - -bool VcxprojGenerator::writeProjectMakefile() -{ - usePlatformDir(); - QTextStream t(&Option::output); - - // Check if all requirements are fulfilled - if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { - fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n", - var("QMAKE_FAILED_REQUIREMENTS").toLatin1().constData()); - return true; - } - - // Generate project file - if(project->first("TEMPLATE") == "vcapp" || - project->first("TEMPLATE") == "vclib") { - if (!mergedProjects.count()) { - warn_msg(WarnLogic, "Generator: MSVC.NET: no single configuration created, cannot output project!"); - return false; - } - - debug_msg(1, "Generator: MSVC.NET: Writing project file"); - VCProject mergedProject; - for (int i = 0; i < mergedProjects.count(); ++i) { - VCProjectSingleConfig *singleProject = &(mergedProjects.at(i)->vcxProject); - mergedProject.SingleProjects += *singleProject; - for (int j = 0; j < singleProject->ExtraCompilersFiles.count(); ++j) { - const QString &compilerName = singleProject->ExtraCompilersFiles.at(j).Name; - if (!mergedProject.ExtraCompilers.contains(compilerName)) - mergedProject.ExtraCompilers += compilerName; - } - } - - if(mergedProjects.count() > 1 && - mergedProjects.at(0)->vcxProject.Name == - mergedProjects.at(1)->vcxProject.Name) - mergedProjects.at(0)->writePrlFile(); - mergedProject.Name = unescapeFilePath(project->first("QMAKE_ORIG_TARGET")); - mergedProject.Version = mergedProjects.at(0)->vcxProject.Version; - mergedProject.ProjectGUID = project->isEmpty("QMAKE_UUID") ? getProjectUUID().toString().toUpper() : project->first("QMAKE_UUID"); - mergedProject.Keyword = project->first("VCPROJ_KEYWORD"); - mergedProject.SccProjectName = mergedProjects.at(0)->vcxProject.SccProjectName; - mergedProject.SccLocalPath = mergedProjects.at(0)->vcxProject.SccLocalPath; - mergedProject.PlatformName = mergedProjects.at(0)->vcxProject.PlatformName; - - XmlOutput xmlOut(t); - projectWriter->write(xmlOut, mergedProject); - return true; - } else if(project->first("TEMPLATE") == "vcsubdirs") { - return writeMakefile(t); - } - return false; -} - - - - -bool VcxprojGenerator::mergeBuildProject(MakefileGenerator *other) -{ - VcxprojGenerator *otherVC = static_cast<VcxprojGenerator*>(other); - if (!otherVC) { - warn_msg(WarnLogic, "VcxprojGenerator: Cannot merge other types of projects! (ignored)"); - return false; - } - mergedProjects += otherVC; - return true; -} - QT_END_NAMESPACE diff --git a/qmake/generators/win32/msvc_vcxproj.h b/qmake/generators/win32/msvc_vcxproj.h index 16e02b1..45e6b95 100644 --- a/qmake/generators/win32/msvc_vcxproj.h +++ b/qmake/generators/win32/msvc_vcxproj.h @@ -50,42 +50,12 @@ QT_BEGIN_NAMESPACE class VcxprojGenerator : public VcprojGenerator { - bool writeMakefile(QTextStream &); - bool writeProjectMakefile(); - public: VcxprojGenerator(); ~VcxprojGenerator(); protected: virtual VCProjectWriter *createProjectWriter(); - virtual bool supportsMetaBuild() { return true; } - virtual bool supportsMergedBuilds() { return true; } - virtual bool mergeBuildProject(MakefileGenerator *other); - - virtual void initProject(); - - void initConfiguration(); - void initCompilerTool(); - void initLinkerTool(); - void initPreLinkEventTools(); - void initPostBuildEventTools(); - void initRootFiles(); - void initResourceTool(); - void initSourceFiles(); - void initHeaderFiles(); - void initGeneratedFiles(); - void initTranslationFiles(); - void initFormFiles(); - void initResourceFiles(); - void initLexYaccFiles(); - void initExtraCompilerOutputs(); - - // Used for single project - VCProjectSingleConfig vcxProject; - - // Holds all configurations for glue (merged) project - QList<VcxprojGenerator*> mergedProjects; private: friend class VCFilter; |