aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2019-12-12 20:47:27 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2020-01-24 09:11:04 +0000
commit9c282ff7bd13b25118da3e6d7a46e75fe78caf4c (patch)
tree84bbea00869bd2902e91ffdd464b4ff27db339ce /src
parent1e7875f00e406b762065f0ea2fe30836829fdd42 (diff)
MSVC: Use compiler driver for linking
To be able to use cpp.driverFlags and cpp.driverLinkerFlags with clang- cl. This patchset makes possible to use clang-cl with "- fsanitize=address" flag without passing the sanitizer libraries manually to the linker There's also a behavior change in which linker is used - clang-cl uses native linker by default. Old behavior can be restored by setting cpp.linkerVariant to "lld" Fixes: QBS-1522 Change-Id: I9528ce40aa5fdfab987672b15fffd830fa2d6376 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/lib/corelib/buildgraph/processcommandexecutor.cpp3
-rw-r--r--src/lib/corelib/buildgraph/rulecommands.cpp7
-rw-r--r--src/lib/corelib/buildgraph/rulecommands.h10
-rw-r--r--src/lib/corelib/tools/persistence.cpp2
4 files changed, 16 insertions, 6 deletions
diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.cpp b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
index 79edda320..7cde8553c 100644
--- a/src/lib/corelib/buildgraph/processcommandexecutor.cpp
+++ b/src/lib/corelib/buildgraph/processcommandexecutor.cpp
@@ -166,6 +166,7 @@ bool ProcessCommandExecutor::doStart()
.arg(responseFile.fileName())));
return false;
}
+ const auto separator = cmd->responseFileSeparator().toUtf8();
for (int i = cmd->responseFileArgumentIndex(); i < cmd->arguments().size(); ++i) {
const QString arg = cmd->arguments().at(i);
if (arg.startsWith(cmd->responseFileUsagePrefix())) {
@@ -179,7 +180,7 @@ bool ProcessCommandExecutor::doStart()
} else {
responseFile.write(qbs::Internal::shellQuote(arg).toLocal8Bit());
}
- responseFile.write("\n");
+ responseFile.write(separator);
}
responseFile.close();
m_responseFileName = responseFile.fileName();
diff --git a/src/lib/corelib/buildgraph/rulecommands.cpp b/src/lib/corelib/buildgraph/rulecommands.cpp
index 88ab1ce06..8fa3255f1 100644
--- a/src/lib/corelib/buildgraph/rulecommands.cpp
+++ b/src/lib/corelib/buildgraph/rulecommands.cpp
@@ -70,6 +70,7 @@ static QString responseFileUsagePrefixProperty()
{
return QStringLiteral("responseFileUsagePrefix");
}
+static QString responseFileSeparatorProperty() { return QStringLiteral("responseFileSeparator"); }
static QString silentProperty() { return QStringLiteral("silent"); }
static QString stderrFilePathProperty() { return QStringLiteral("stderrFilePath"); }
static QString stderrFilterFunctionProperty() { return QStringLiteral("stderrFilterFunction"); }
@@ -216,6 +217,8 @@ static QScriptValue js_Command(QScriptContext *context, QScriptEngine *engine)
engine->toScriptValue(commandPrototype->responseFileArgumentIndex()));
cmd.setProperty(responseFileUsagePrefixProperty(),
engine->toScriptValue(commandPrototype->responseFileUsagePrefix()));
+ cmd.setProperty(responseFileSeparatorProperty(),
+ engine->toScriptValue(commandPrototype->responseFileSeparator()));
cmd.setProperty(stdoutFilePathProperty(),
engine->toScriptValue(commandPrototype->stdoutFilePath()));
cmd.setProperty(stderrFilePathProperty(),
@@ -239,6 +242,7 @@ ProcessCommand::ProcessCommand()
: m_maxExitCode(0)
, m_responseFileThreshold(defaultResponseFileThreshold())
, m_responseFileArgumentIndex(0)
+ , m_responseFileSeparator(QStringLiteral("\n"))
{
}
@@ -277,6 +281,7 @@ bool ProcessCommand::equals(const AbstractCommand *otherAbstractCommand) const
&& m_responseFileThreshold == other->m_responseFileThreshold
&& m_responseFileArgumentIndex == other->m_responseFileArgumentIndex
&& m_responseFileUsagePrefix == other->m_responseFileUsagePrefix
+ && m_responseFileSeparator == other->m_responseFileSeparator
&& m_stdoutFilePath == other->m_stdoutFilePath
&& m_stderrFilePath == other->m_stderrFilePath
&& m_relevantEnvVars == other->m_relevantEnvVars
@@ -311,6 +316,8 @@ void ProcessCommand::fillFromScriptValue(const QScriptValue *scriptValue, const
.toInt32();
m_responseFileUsagePrefix = scriptValue->property(responseFileUsagePrefixProperty())
.toString();
+ m_responseFileSeparator = scriptValue->property(responseFileSeparatorProperty())
+ .toString();
QStringList envList = scriptValue->property(environmentProperty()).toVariant()
.toStringList();
getEnvironmentFromList(envList);
diff --git a/src/lib/corelib/buildgraph/rulecommands.h b/src/lib/corelib/buildgraph/rulecommands.h
index d4d70d591..725cd6d89 100644
--- a/src/lib/corelib/buildgraph/rulecommands.h
+++ b/src/lib/corelib/buildgraph/rulecommands.h
@@ -136,6 +136,7 @@ public:
int responseFileThreshold() const { return m_responseFileThreshold; }
int responseFileArgumentIndex() const { return m_responseFileArgumentIndex; }
QString responseFileUsagePrefix() const { return m_responseFileUsagePrefix; }
+ QString responseFileSeparator() const { return m_responseFileSeparator; }
QProcessEnvironment environment() const { return m_environment; }
QStringList relevantEnvVars() const;
void clearRelevantEnvValues() { m_relevantEnvValues.clear(); }
@@ -158,10 +159,10 @@ private:
{
pool.serializationOp<opType>(m_program, m_arguments, m_environment, m_workingDir,
m_stdoutFilterFunction, m_stderrFilterFunction,
- m_responseFileUsagePrefix, m_maxExitCode,
- m_responseFileThreshold, m_responseFileArgumentIndex,
- m_relevantEnvVars, m_relevantEnvValues, m_stdoutFilePath,
- m_stderrFilePath);
+ m_responseFileUsagePrefix, m_responseFileSeparator,
+ m_maxExitCode, m_responseFileThreshold,
+ m_responseFileArgumentIndex, m_relevantEnvVars,
+ m_relevantEnvValues, m_stdoutFilePath, m_stderrFilePath);
}
QString m_program;
@@ -173,6 +174,7 @@ private:
int m_responseFileThreshold; // When to use response files? In bytes of (program name + arguments).
int m_responseFileArgumentIndex;
QString m_responseFileUsagePrefix;
+ QString m_responseFileSeparator;
QProcessEnvironment m_environment;
QStringList m_relevantEnvVars;
QProcessEnvironment m_relevantEnvValues;
diff --git a/src/lib/corelib/tools/persistence.cpp b/src/lib/corelib/tools/persistence.cpp
index c30d16518..3f2b57e01 100644
--- a/src/lib/corelib/tools/persistence.cpp
+++ b/src/lib/corelib/tools/persistence.cpp
@@ -48,7 +48,7 @@
namespace qbs {
namespace Internal {
-static const char QBS_PERSISTENCE_MAGIC[] = "QBSPERSISTENCE-127";
+static const char QBS_PERSISTENCE_MAGIC[] = "QBSPERSISTENCE-128";
NoBuildGraphError::NoBuildGraphError(const QString &filePath)
: ErrorInfo(Tr::tr("Build graph not found for configuration '%1'. Expected location was '%2'.")