summaryrefslogtreecommitdiff
path: root/src/app/qbs-setup-toolchains/probe.cpp
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2016-04-22 11:20:45 -0700
committerJake Petroules <jake.petroules@qt.io>2016-05-11 05:37:11 +0000
commit87a1478921d634dcd99a4bac2ea851ad1cc93c48 (patch)
tree3916c7926954bc6285ee3398f697bcb6cda7ace7 /src/app/qbs-setup-toolchains/probe.cpp
parentfa9f4293a0d25e0890d234b1a6d8fc863aa56cac (diff)
downloadqbs-87a1478921d634dcd99a4bac2ea851ad1cc93c48.tar.gz
Automatically determine the compiler's architecture.
Also, do extensive validation on the result by ensuring that the arch specified by the user is what which the compiler will actually generate when invoked, by constructing an appropriate argument list and doing a dump of the compiler's macros. This ensures a user cannot specify a bogus architecture which is not actually the one the compiler will generate. Furthermore, compiler probes will no longer generate the wrong value for qbs.architecture for ARM-family architectures, since the triple returned by $(CC) -dumpmachine does not include the subarch which needs to be passed to the compiler. Users will also be prevented from subverting proper operation by attempting to pass raw ABI-related flags in the flags properties. Change-Id: I2aed8e0afefdf7e5a4112183f2f9ea96b1e22b51 Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Diffstat (limited to 'src/app/qbs-setup-toolchains/probe.cpp')
-rw-r--r--src/app/qbs-setup-toolchains/probe.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp
index eef8dc6f7..e21d7148f 100644
--- a/src/app/qbs-setup-toolchains/probe.cpp
+++ b/src/app/qbs-setup-toolchains/probe.cpp
@@ -124,7 +124,7 @@ static QStringList standardCompilerFileNames()
}
static void setCommonProperties(Profile &profile, const QString &compilerFilePath,
- const QStringList &toolchainTypes, const QString &architecture)
+ const QStringList &toolchainTypes)
{
const QFileInfo cfi(compilerFilePath);
const QString compilerName = cfi.fileName();
@@ -138,7 +138,6 @@ static void setCommonProperties(Profile &profile, const QString &compilerFilePat
profile.setValue(QLatin1String("cpp.toolchainInstallPath"), cfi.absolutePath());
profile.setValue(QLatin1String("qbs.toolchain"), toolchainTypes);
- profile.setValue(QLatin1String("qbs.architecture"), canonicalArchitecture(architecture));
setCompilerVersion(compilerFilePath, toolchainTypes, profile);
const QString suffix = compilerName.right(compilerName.size() - prefix.size());
@@ -183,21 +182,17 @@ static Profile createGccProfile(const QString &compilerFilePath, Settings *setti
const QString &profileName = QString())
{
const QString machineName = gccMachineName(compilerFilePath);
- const QStringList compilerTriplet = machineName.split(QLatin1Char('-'));
if (toolchainTypes.contains(QLatin1String("mingw"))) {
if (!validMinGWMachines().contains(machineName)) {
throw ErrorInfo(Tr::tr("Detected gcc platform '%1' is not supported.")
.arg(machineName));
}
- } else if (compilerTriplet.count() < 2) {
- throw qbs::ErrorInfo(Tr::tr("Architecture of compiler for platform '%1' at '%2' not understood.")
- .arg(machineName, compilerFilePath));
}
Profile profile(!profileName.isEmpty() ? profileName : machineName, settings);
profile.removeProfile();
- setCommonProperties(profile, compilerFilePath, toolchainTypes, compilerTriplet.first());
+ setCommonProperties(profile, compilerFilePath, toolchainTypes);
// Check whether auxiliary tools reside within the toolchain's install path.
// This might not be the case when using icecc or another compiler wrapper.