diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-10-07 16:12:04 +0200 |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-10-07 16:12:04 +0200 |
commit | 5f8ef6ac44e1db842003deeed6525eea70d8d83d (patch) | |
tree | 2b67b2abe7038e97fc72967a4882bf15c38d39a1 /qmake/generators/win32/msvc_objectmodel.cpp | |
parent | d7dd967d4a4775e70d270dbcd0623ef07128d420 (diff) | |
parent | 62a2fe9092d3b6038a08f5c5a7faa4a863b84fdc (diff) | |
download | qt4-tools-5f8ef6ac44e1db842003deeed6525eea70d8d83d.tar.gz |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
qmake/generators/win32/msbuild_objectmodel.cpp
qmake/generators/win32/msbuild_objectmodel.h
qmake/generators/win32/msvc_objectmodel.cpp
qmake/generators/win32/msvc_vcxproj.cpp
src/corelib/arch/qatomic_arm.h
tests/auto/qglthreads/tst_qglthreads.cpp
Diffstat (limited to 'qmake/generators/win32/msvc_objectmodel.cpp')
-rw-r--r-- | qmake/generators/win32/msvc_objectmodel.cpp | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index b1de30210d..b20d2b7fa5 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -288,6 +288,24 @@ triState operator!(const triState &rhs) return lhs; } +// VCToolBase ------------------------------------------------- +QStringList VCToolBase::fixCommandLine(const QString &input) +{ + // The splitting regexp is a bit bizarre for backwards compat reasons (why else ...). + return input.split(QRegExp(QLatin1String("\n\t|\r\\\\h|\r\n"))); +} + +static QString vcCommandSeparator() +{ + // MSVC transforms the build tree into a single batch file, simply pasting the contents + // of the custom commands into it, and putting an "if errorlevel goto" statement behind it. + // As we want every sub-command to be error-checked (as is done by makefile-based + // backends), we insert the checks ourselves, using the undocumented jump target. + static QString cmdSep = + QLatin1String("
if errorlevel 1 goto VCReportError
"); + return cmdSep; +} + // VCCLCompilerTool ------------------------------------------------- VCCLCompilerTool::VCCLCompilerTool() : AssemblerOutput(asmListingNone), @@ -2272,7 +2290,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info) if (!CustomBuildTool.Description.isEmpty()) CustomBuildTool.Description += " & "; CustomBuildTool.Description += cmd_name; - CustomBuildTool.CommandLine += cmd.trimmed().split("\n", QString::SkipEmptyParts); + CustomBuildTool.CommandLine += VCToolBase::fixCommandLine(cmd.trimmed()); int space = cmd.indexOf(' '); QFileInfo finf(cmd.left(space)); if (CustomBuildTool.ToolPath.isEmpty()) @@ -2605,35 +2623,10 @@ void VCProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool) void VCProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool) { - // The code below offers two ways to split custom build step commands. - // Normally the $$escape_expand(\n\t) is used in a project file, which is correctly translated - // in all generators. However, if you use $$escape_expand(\n\r) (or \n\h) instead, the VCPROJ - // generator will instead of binding the commands with " && " will insert a proper newline into - // the VCPROJ file. We sometimes use this method of splitting commands if the custom buildstep - // contains a command-line which is too big to run on certain OS. - QString cmds; - int end = tool.CommandLine.count(); - for(int i = 0; i < end; ++i) { - QString cmdl = tool.CommandLine.at(i); - if (cmdl.contains("\r\t")) { - if (i == end - 1) - cmdl = cmdl.trimmed(); - cmdl.replace("\r\t", " && "); - } else if (cmdl.contains("\r\n")) { - ; - } else if (cmdl.contains("\r\\h")) { - // The above \r\n should work, but doesn't, so we have this hack - cmdl.replace("\r\\h", "\r\n"); - } else { - if (i < end - 1) - cmdl += " && "; - } - cmds += cmdl; - } xml << tag(_Tool) << attrS(_Name, tool.ToolName) << attrX(_AdditionalDependencies, tool.AdditionalDependencies, ";") - << attrS(_CommandLine, cmds) + << attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator())) << attrS(_Description, tool.Description) << attrX(_Outputs, tool.Outputs, ";") << attrS(_Path, tool.ToolPath) @@ -2681,7 +2674,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCEventTool &tool) << tag(_Tool) << attrS(_Name, tool.ToolName) << attrS(_Path, tool.ToolPath) - << attrS(_CommandLine, tool.CommandLine) + << attrS(_CommandLine, tool.CommandLine.join(vcCommandSeparator())) << attrS(_Description, tool.Description) << attrT(_ExcludedFromBuild, tool.ExcludedFromBuild) << closetag(_Tool); |