forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.1' into 4.2
Conflicts: src/plugins/qbsprojectmanager/defaultpropertyprovider.cpp src/plugins/qbsprojectmanager/qbsconstants.h Change-Id: I3800e580faaccdc1dd08da851956ba677d33df51
This commit is contained in:
10
dist/changes-4.1.1.md
vendored
10
dist/changes-4.1.1.md
vendored
@@ -45,6 +45,8 @@ Debugging
|
||||
* CDB
|
||||
* Fixed display order of vectors in vectors (QTCREATORBUG-16813)
|
||||
* Fixed display of QList contents (QTCREATORBUG-16750)
|
||||
* QML
|
||||
* Fixed that expansion state was reset when stepping
|
||||
|
||||
QML Profiler
|
||||
|
||||
@@ -69,4 +71,12 @@ Android
|
||||
|
||||
iOS
|
||||
|
||||
* Fixed simulator support with Xcode 8 (QTCREATORBUG-16942)
|
||||
Known issue: Qt Creator is blocked until simulator finishes starting
|
||||
* Fixed that standard paths reported by QStandardPaths were wrong when
|
||||
running on simulator (QTCREATORBUG-13655)
|
||||
* Fixed QML debugging on device (QTCREATORBUG-15812)
|
||||
|
||||
QNX
|
||||
|
||||
* Fixed QML debugging (QTCREATORBUG-17208)
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
|
||||
namespace QbsProjectManager {
|
||||
@@ -158,6 +159,20 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k,
|
||||
return data;
|
||||
}
|
||||
|
||||
static void filterCompilerLinkerFlags(const ProjectExplorer::Abi &targetAbi, QStringList &flags)
|
||||
{
|
||||
for (int i = 0; i < flags.size(); ) {
|
||||
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture
|
||||
&& flags[i] == QStringLiteral("-arch")
|
||||
&& i + 1 < flags.size()) {
|
||||
flags.removeAt(i);
|
||||
flags.removeAt(i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplorer::Kit *k,
|
||||
const QVariantMap &defaultData) const
|
||||
{
|
||||
@@ -208,26 +223,6 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
||||
data.insert(QLatin1String(QBS_TARGETOS), targetOS);
|
||||
|
||||
QStringList toolchain = toolchainList(mainTc);
|
||||
if (!toolchain.isEmpty())
|
||||
data.insert(QLatin1String(QBS_TOOLCHAIN), toolchain);
|
||||
|
||||
if (targetAbi.os() == ProjectExplorer::Abi::DarwinOS) {
|
||||
// Set Xcode SDK name and version - required by Qbs if a sysroot is present
|
||||
// Ideally this would be done in a better way...
|
||||
const QRegExp sdkNameRe(QLatin1String("(macosx|iphoneos|iphonesimulator)([0-9]+\\.[0-9]+)"));
|
||||
const QRegExp sdkVersionRe(QLatin1String("([0-9]+\\.[0-9]+)"));
|
||||
QDir sysrootdir(sysroot);
|
||||
const QSettings sdkSettings(sysrootdir.absoluteFilePath(QLatin1String("SDKSettings.plist")), QSettings::NativeFormat);
|
||||
const QString sdkName(sdkSettings.value(QLatin1String("CanonicalName")).toString());
|
||||
const QString sdkVersion(sdkSettings.value(QLatin1String("Version")).toString());
|
||||
if (sdkNameRe.exactMatch(sdkName) && sdkVersionRe.exactMatch(sdkVersion)) {
|
||||
for (int i = 3; i > 0; --i)
|
||||
sysrootdir.cdUp();
|
||||
data.insert(QLatin1String(CPP_PLATFORMPATH), sysrootdir.absolutePath());
|
||||
data.insert(QLatin1String(CPP_XCODESDKNAME), sdkName);
|
||||
data.insert(QLatin1String(CPP_XCODESDKVERSION), sdkVersion);
|
||||
}
|
||||
}
|
||||
|
||||
Utils::FileName cCompilerPath;
|
||||
if (tcC)
|
||||
@@ -276,10 +271,51 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
||||
data.insert(QLatin1String(CPP_TOOLCHAINPATH), mainFileInfo.absolutePath());
|
||||
|
||||
if (ProjectExplorer::GccToolChain *gcc = dynamic_cast<ProjectExplorer::GccToolChain *>(mainTc)) {
|
||||
data.insert(QLatin1String(CPP_PLATFORMCOMMONCOMPILERFLAGS), gcc->platformCodeGenFlags());
|
||||
data.insert(QLatin1String(CPP_PLATFORMLINKERFLAGS), gcc->platformLinkerFlags());
|
||||
QStringList compilerFlags = gcc->platformCodeGenFlags();
|
||||
filterCompilerLinkerFlags(targetAbi, compilerFlags);
|
||||
data.insert(QLatin1String(CPP_PLATFORMCOMMONCOMPILERFLAGS), compilerFlags);
|
||||
|
||||
QStringList linkerFlags = gcc->platformLinkerFlags();
|
||||
filterCompilerLinkerFlags(targetAbi, linkerFlags);
|
||||
data.insert(QLatin1String(CPP_PLATFORMLINKERFLAGS), linkerFlags);
|
||||
}
|
||||
|
||||
if (targetAbi.os() == ProjectExplorer::Abi::DarwinOS) {
|
||||
// Reverse engineer the Xcode developer path from the compiler path
|
||||
const QRegularExpression compilerRe(
|
||||
QStringLiteral("^(?<developerpath>.*)/Toolchains/(?:.+)\\.xctoolchain/usr/bin$"));
|
||||
const QRegularExpressionMatch compilerReMatch = compilerRe.match(cxxFileInfo.absolutePath());
|
||||
if (compilerReMatch.hasMatch()) {
|
||||
const QString developerPath = compilerReMatch.captured(QStringLiteral("developerpath"));
|
||||
data.insert(QLatin1String(XCODE_DEVELOPERPATH), developerPath);
|
||||
toolchain.insert(0, QStringLiteral("xcode"));
|
||||
|
||||
// If the sysroot is part of this developer path, set the canonical SDK name
|
||||
const QDir sysrootdir(QDir::cleanPath(sysroot));
|
||||
const QString sysrootAbs = sysrootdir.absolutePath();
|
||||
const QSettings sdkSettings(
|
||||
sysrootdir.absoluteFilePath(QStringLiteral("SDKSettings.plist")),
|
||||
QSettings::NativeFormat);
|
||||
const QString version(
|
||||
sdkSettings.value(QStringLiteral("Version")).toString());
|
||||
QString canonicalName(
|
||||
sdkSettings.value(QStringLiteral("CanonicalName")).toString());
|
||||
canonicalName.chop(version.size());
|
||||
if (!canonicalName.isEmpty() && !version.isEmpty()
|
||||
&& sysrootAbs.startsWith(developerPath)) {
|
||||
if (sysrootAbs.toLower().endsWith(QStringLiteral("/%1.sdk")
|
||||
.arg(canonicalName + version)))
|
||||
data.insert(QLatin1String(XCODE_SDK), QString(canonicalName + version));
|
||||
if (sysrootAbs.toLower().endsWith(QStringLiteral("/%1.sdk")
|
||||
.arg(canonicalName)))
|
||||
data.insert(QLatin1String(XCODE_SDK), canonicalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!toolchain.isEmpty())
|
||||
data.insert(QLatin1String(QBS_TOOLCHAIN), toolchain);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,9 +76,8 @@ const char CPP_COMPILERNAME[] = "cpp.compilerName";
|
||||
const char CPP_CXXCOMPILERNAME[] = "cpp.cxxCompilerName";
|
||||
const char CPP_PLATFORMCOMMONCOMPILERFLAGS[] = "cpp.platformCommonCompilerFlags";
|
||||
const char CPP_PLATFORMLINKERFLAGS[] = "cpp.platformLinkerFlags";
|
||||
const char CPP_PLATFORMPATH[] = "cpp.platformPath";
|
||||
const char CPP_XCODESDKNAME[] = "cpp.xcodeSdkName";
|
||||
const char CPP_XCODESDKVERSION[] = "cpp.xcodeSdkVersion";
|
||||
const char XCODE_DEVELOPERPATH[] = "xcode.developerPath";
|
||||
const char XCODE_SDK[] = "xcode.sdk";
|
||||
|
||||
// Settings page
|
||||
const char QBS_SETTINGS_CATEGORY[] = "YM.qbs";
|
||||
|
||||
Reference in New Issue
Block a user