summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-10-07 14:12:04 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-10-07 14:12:04 (GMT)
commit5f8ef6ac44e1db842003deeed6525eea70d8d83d (patch)
tree2b67b2abe7038e97fc72967a4882bf15c38d39a1 /qmake
parentd7dd967d4a4775e70d270dbcd0623ef07128d420 (diff)
parent62a2fe9092d3b6038a08f5c5a7faa4a863b84fdc (diff)
downloadQt-5f8ef6ac44e1db842003deeed6525eea70d8d83d.zip
Qt-5f8ef6ac44e1db842003deeed6525eea70d8d83d.tar.gz
Qt-5f8ef6ac44e1db842003deeed6525eea70d8d83d.tar.bz2
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')
-rw-r--r--qmake/generators/unix/unixmake.cpp12
-rw-r--r--qmake/generators/win32/msbuild_objectmodel.cpp42
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp5
-rw-r--r--qmake/generators/win32/msvc_objectmodel.cpp49
-rw-r--r--qmake/generators/win32/msvc_objectmodel.h3
-rw-r--r--qmake/generators/win32/msvc_vcproj.cpp26
-rw-r--r--qmake/generators/win32/msvc_vcproj.h1
7 files changed, 50 insertions, 88 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index da4bbb7..71a6061 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -636,11 +636,13 @@ UnixMakefileGenerator::processPrlFiles()
if(opt.startsWith("-L") ||
(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F"))) {
- if(lit == 0 || !lflags[arch].contains(opt))
- lflags[arch].append(opt);
- } else if(opt.startsWith("-l")) {
- if(lit == l.size()-1 || !lflags[arch].contains(opt))
+ if(!lflags[arch].contains(opt))
lflags[arch].append(opt);
+ } else if(opt.startsWith("-l") || opt == "-pthread") {
+ // Make sure we keep the dependency-order of libraries
+ if (lflags[arch].contains(opt))
+ lflags[arch].removeAll(opt);
+ lflags[arch].append(opt);
} else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) {
if(opt.length() > 11)
opt = opt.mid(11);
@@ -672,7 +674,7 @@ UnixMakefileGenerator::processPrlFiles()
lflags[arch].append(opt);
}
} else if(!opt.isNull()) {
- if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1)
+ if(!lflags[arch].contains(opt))
lflags[arch].append(opt);
}
}
diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index a397ae9..76df854 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -313,6 +313,16 @@ inline XmlOutput::xml_output valueTagT( const triState v)
return valueTag(v == _True ? "true" : "false");
}
+static QString vcxCommandSeparator()
+{
+ // MSBuild puts the contents of the custom commands into a batch file and calls 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("&#x000D;&#x000A;if errorlevel 1 goto VCEnd&#x000D;&#x000A;");
+ return cmdSep;
+}
+
// Tree file generation ---------------------------------------------
void XTreeNode::generateXML(XmlOutput &xml, XmlOutput &xmlFilter, const QString &tagName, VCProject &tool, const QString &filter) {
@@ -1423,32 +1433,6 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCMIDLTool &tool)
void VCXProjectWriter::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;
- }
-
const QString &configName = tool.config->Name;
if ( !tool.AdditionalDependencies.isEmpty() )
@@ -1458,11 +1442,11 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCCustomBuildTool &tool)
<< valueTagDefX(tool.AdditionalDependencies, "AdditionalInputs", ";");
}
- if( !cmds.isEmpty() )
+ if( !tool.CommandLine.isEmpty() )
{
xml << tag("Command")
<< attrTag("Condition", QString("'$(Configuration)|$(Platform)'=='%1'").arg(configName))
- << valueTag(cmds);
+ << valueTag(tool.CommandLine.join(vcxCommandSeparator()));
}
if ( !tool.Description.isEmpty() )
@@ -1528,7 +1512,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCEventTool &tool)
{
xml
<< tag(tool.EventName)
- << attrTagS(_Command, tool.CommandLine)
+ << attrTagS(_Command, tool.CommandLine.join(vcxCommandSeparator()))
<< attrTagS(_Message, tool.Description)
<< closetag(tool.EventName);
}
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index 0adb152..d32b888 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -312,10 +312,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
t << "\n\tsigntool sign /F " << signature << " $(DESTDIR_TARGET)";
}
if(!project->isEmpty("QMAKE_POST_LINK")) {
- if (useSignature)
- t << " && " << var("QMAKE_POST_LINK");
- else
- t << "\n\t" << var("QMAKE_POST_LINK");
+ t << "\n\t" << var("QMAKE_POST_LINK");
}
t << endl;
}
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index b1de302..b20d2b7 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("&#x000D;&#x000A;if errorlevel 1 goto VCReportError&#x000D;&#x000A;");
+ 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);
diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h
index c70e897..b80d8d0 100644
--- a/qmake/generators/win32/msvc_objectmodel.h
+++ b/qmake/generators/win32/msvc_objectmodel.h
@@ -478,6 +478,7 @@ public:
for (QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++)
parseOption((*it).toLatin1());
}
+ static QStringList fixCommandLine(const QString &input);
};
class VCConfiguration;
@@ -804,7 +805,7 @@ protected:
public:
// Variables
- QString CommandLine;
+ QStringList CommandLine;
QString Description;
triState ExcludedFromBuild;
QString EventName;
diff --git a/qmake/generators/win32/msvc_vcproj.cpp b/qmake/generators/win32/msvc_vcproj.cpp
index 3c42f14..06b726f 100644
--- a/qmake/generators/win32/msvc_vcproj.cpp
+++ b/qmake/generators/win32/msvc_vcproj.cpp
@@ -1068,37 +1068,23 @@ void VcprojGenerator::initPreBuildEventTools()
{
}
-QString VcprojGenerator::fixCommandLine(DotNET version, const QString &input) const
-{
- QString result = input;
-
- if (version >= NET2005)
- result = result.replace(QLatin1Char('\n'), QLatin1String("&#x000D;&#x000A;"));
-
- return result;
-}
-
void VcprojGenerator::initPostBuildEventTools()
{
VCConfiguration &conf = vcProject.Configuration;
if(!project->values("QMAKE_POST_LINK").isEmpty()) {
- QString cmdline = fixCommandLine(conf.CompilerVersion, var("QMAKE_POST_LINK"));
+ QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_POST_LINK"));
conf.postBuild.CommandLine = cmdline;
- if (conf.CompilerVersion < NET2005)
- cmdline = cmdline.replace("\n", "&&");
- conf.postBuild.Description = cmdline;
+ conf.postBuild.Description = cmdline.join(QLatin1String("\r\n"));
}
QString signature = !project->isEmpty("SIGNATURE_FILE") ? var("SIGNATURE_FILE") : var("DEFAULT_SIGNATURE");
bool useSignature = !signature.isEmpty() && !project->isActiveConfig("staticlib") &&
!project->isEmpty("CE_SDK") && !project->isEmpty("CE_ARCH");
if(useSignature)
- conf.postBuild.CommandLine.prepend(QLatin1String("signtool sign /F ") + signature + " \"$(TargetPath)\"\n" +
- (!conf.postBuild.CommandLine.isEmpty() ? " && " : ""));
+ conf.postBuild.CommandLine.prepend(
+ QLatin1String("signtool sign /F ") + signature + QLatin1String(" \"$(TargetPath)\""));
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");
}
@@ -1227,9 +1213,9 @@ void VcprojGenerator::initPreLinkEventTools()
{
VCConfiguration &conf = vcProject.Configuration;
if(!project->values("QMAKE_PRE_LINK").isEmpty()) {
- QString cmdline = fixCommandLine(conf.CompilerVersion, var("QMAKE_PRE_LINK"));
- conf.preLink.Description = cmdline;
+ QStringList cmdline = VCToolBase::fixCommandLine(var("QMAKE_PRE_LINK"));
conf.preLink.CommandLine = cmdline;
+ conf.preLink.Description = cmdline.join(QLatin1String("\r\n"));
}
}
diff --git a/qmake/generators/win32/msvc_vcproj.h b/qmake/generators/win32/msvc_vcproj.h
index a603500..e843375 100644
--- a/qmake/generators/win32/msvc_vcproj.h
+++ b/qmake/generators/win32/msvc_vcproj.h
@@ -132,7 +132,6 @@ protected:
QList<VcprojGenerator*> mergedProjects;
private:
- QString fixCommandLine(DotNET version, const QString &input) const;
QUuid increaseUUID(const QUuid &id);
friend class VCFilter;
};