forked from qt-creator/qt-creator
QbsProjectManager: Make DefaultPropertyProvider a bit more readable.
- Decrease indentation by exiting early. - Use switch instead of "else if". Change-Id: I74e73e087f64c16f01497854c67f581ef79aff3c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
@@ -67,7 +67,9 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
|||||||
data.insert(QLatin1String(QBS_SYSROOT), sysroot);
|
data.insert(QLatin1String(QBS_SYSROOT), sysroot);
|
||||||
|
|
||||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||||
if (tc) {
|
if (!tc)
|
||||||
|
return data;
|
||||||
|
|
||||||
// FIXME/CLARIFY: How to pass the sysroot?
|
// FIXME/CLARIFY: How to pass the sysroot?
|
||||||
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
ProjectExplorer::Abi targetAbi = tc->targetAbi();
|
||||||
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture) {
|
if (targetAbi.architecture() != ProjectExplorer::Abi::UnknownArchitecture) {
|
||||||
@@ -94,13 +96,15 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
|||||||
qbs::Internal::HostOsInfo::canonicalArchitecture(architecture));
|
qbs::Internal::HostOsInfo::canonicalArchitecture(architecture));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
|
switch (targetAbi.os()) {
|
||||||
|
case ProjectExplorer::Abi::WindowsOS:
|
||||||
data.insert(QLatin1String(QBS_TARGETOS), QLatin1String("windows"));
|
data.insert(QLatin1String(QBS_TARGETOS), QLatin1String("windows"));
|
||||||
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
data.insert(QLatin1String(QBS_TOOLCHAIN),
|
||||||
targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor
|
targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor
|
||||||
? QStringList() << QLatin1String("mingw") << QLatin1String("gcc")
|
? QStringList() << QLatin1String("mingw") << QLatin1String("gcc")
|
||||||
: QStringList() << QLatin1String("msvc"));
|
: QStringList() << QLatin1String("msvc"));
|
||||||
} else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
|
break;
|
||||||
|
case ProjectExplorer::Abi::MacOS: {
|
||||||
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // from Ios::Constants (include header?)
|
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // from Ios::Constants (include header?)
|
||||||
const char IOS_SIMULATOR_TYPE[] = "Ios.Simulator.Type";
|
const char IOS_SIMULATOR_TYPE[] = "Ios.Simulator.Type";
|
||||||
|
|
||||||
@@ -133,7 +137,9 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
|||||||
data.insert(QLatin1String(CPP_XCODESDKNAME), QString(re.cap(1).toLower() + re.cap(2)));
|
data.insert(QLatin1String(CPP_XCODESDKNAME), QString(re.cap(1).toLower() + re.cap(2)));
|
||||||
data.insert(QLatin1String(CPP_XCODESDKVERSION), re.cap(2));
|
data.insert(QLatin1String(CPP_XCODESDKVERSION), re.cap(2));
|
||||||
}
|
}
|
||||||
} else if (targetAbi.os() == ProjectExplorer::Abi::LinuxOS) {
|
break;
|
||||||
|
}
|
||||||
|
case ProjectExplorer::Abi::LinuxOS:
|
||||||
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
|
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
|
||||||
<< QLatin1String("unix"));
|
<< QLatin1String("unix"));
|
||||||
if (tc->type() != QLatin1String("clang")) {
|
if (tc->type() != QLatin1String("clang")) {
|
||||||
@@ -144,7 +150,8 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
|||||||
<< QLatin1String("llvm")
|
<< QLatin1String("llvm")
|
||||||
<< QLatin1String("gcc"));
|
<< QLatin1String("gcc"));
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
|
default:
|
||||||
// TODO: Factor out toolchain type setting.
|
// TODO: Factor out toolchain type setting.
|
||||||
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("unix"));
|
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("unix"));
|
||||||
if (tc->type() != QLatin1String("clang")) {
|
if (tc->type() != QLatin1String("clang")) {
|
||||||
@@ -156,6 +163,7 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
|||||||
<< QLatin1String("gcc"));
|
<< QLatin1String("gcc"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FileName cxx = tc->compilerCommand();
|
Utils::FileName cxx = tc->compilerCommand();
|
||||||
const QFileInfo cxxFileInfo = cxx.toFileInfo();
|
const QFileInfo cxxFileInfo = cxx.toFileInfo();
|
||||||
QString compilerName = cxxFileInfo.fileName();
|
QString compilerName = cxxFileInfo.fileName();
|
||||||
@@ -173,7 +181,6 @@ QVariantMap DefaultPropertyProvider::properties(const ProjectExplorer::Kit *k, c
|
|||||||
data.insert(QLatin1String(CPP_PLATFORMCFLAGS), flags);
|
data.insert(QLatin1String(CPP_PLATFORMCFLAGS), flags);
|
||||||
data.insert(QLatin1String(CPP_PLATFORMCXXFLAGS), flags);
|
data.insert(QLatin1String(CPP_PLATFORMCXXFLAGS), flags);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user