aboutsummaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2013-11-28 15:38:07 +0100
committerJoerg Bornemann <joerg.bornemann@digia.com>2013-11-28 15:40:55 +0100
commit81e02ab202ea257e6c12f44291ffe69baf39790b (patch)
tree86f3eb3d95e56c6376d255f119375746f964d72d /src/app
parentdbb39fc1fce3686a5161d68e89e96086fc664556 (diff)
parent3b6b1b7fbc50bca101ad89a8acd80774bc668dde (diff)
Merge remote-tracking branch 'origin/1.1'
Conflicts: qbs_version.pri src/app/detect-toolchains/msvcprobe.cpp src/app/detect-toolchains/probe.cpp src/lib/language/language.cpp version.js Change-Id: I21c1e9a8bf0175d392cd2ff9fa5254a073ed0af8
Diffstat (limited to 'src/app')
-rw-r--r--src/app/config/configcommandlineparser.cpp11
-rw-r--r--src/app/detect-toolchains/msvcprobe.cpp39
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp48
-rw-r--r--src/app/qbs-setup-qt/setupqt.h5
-rw-r--r--src/app/qbs/parser/commandlineoption.cpp51
-rw-r--r--src/app/qbs/parser/commandlineparser.cpp3
6 files changed, 103 insertions, 54 deletions
diff --git a/src/app/config/configcommandlineparser.cpp b/src/app/config/configcommandlineparser.cpp
index b21561e6a..f240915a0 100644
--- a/src/app/config/configcommandlineparser.cpp
+++ b/src/app/config/configcommandlineparser.cpp
@@ -52,17 +52,16 @@ void ConfigCommandLineParser::parse(const QStringList &commandLine)
while (!args.isEmpty() && args.first().startsWith("--")) {
const QString arg = args.takeFirst().mid(2);
- if (arg == "list") {
+ if (arg == "list")
setCommand(ConfigCommand::CfgList);
- } else if (arg == "unset") {
+ else if (arg == "unset")
setCommand(ConfigCommand::CfgUnset);
- } else if (arg == "export") {
+ else if (arg == "export")
setCommand(ConfigCommand::CfgExport);
- } else if (arg == "import") {
+ else if (arg == "import")
setCommand(ConfigCommand::CfgImport);
- } else {
+ else
throw ErrorInfo("Unknown option for config command.");
- }
}
switch (command().command) {
diff --git a/src/app/detect-toolchains/msvcprobe.cpp b/src/app/detect-toolchains/msvcprobe.cpp
index fa7915d6b..ba7c007b6 100644
--- a/src/app/detect-toolchains/msvcprobe.cpp
+++ b/src/app/detect-toolchains/msvcprobe.cpp
@@ -65,8 +65,9 @@ Q_DECLARE_TYPEINFO(WinSDK, Q_MOVABLE_TYPE);
Q_DECLARE_TYPEINFO(MSVC, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
-static void addMSVCPlatform(Settings *settings, QList<Profile> &profiles, QString name,
- const QString &installPath, const QString &winSDKPath, const QString &architecture)
+static void addMSVCPlatform(const MSVC &msvc, Settings *settings, QList<Profile> &profiles,
+ QString name, const QString &installPath, const QString &winSDKPath,
+ const QString &architecture)
{
name.append(QLatin1Char('_') + architecture);
qbsInfo() << Tr::tr("Setting up profile '%1'.").arg(name);
@@ -78,6 +79,11 @@ static void addMSVCPlatform(Settings *settings, QList<Profile> &profiles, QStrin
p.setValue("cpp.windowsSDKPath", winSDKPath);
p.setValue("qbs.architecture", Internal::HostOsInfo::canonicalArchitecture(architecture));
p.setValue("qbs.endianness", Internal::HostOsInfo::defaultEndianness(architecture));
+ if (msvc.version.toInt() >= 2013) {
+ const QStringList flags(QLatin1String("/FS"));
+ p.setValue("cpp.platformCFlags", flags);
+ p.setValue("cpp.platformCxxFlags", flags);
+ }
profiles << p;
}
@@ -89,6 +95,15 @@ static void findSupportedArchitectures(MSVC *msvc, const QString &pathPrefix = Q
msvc->architectures += QLatin1String("x86_64");
}
+static QString wow6432Key()
+{
+#ifdef Q_OS_WIN64
+ return QLatin1String("\\Wow6432Node");
+#else
+ return QString();
+#endif
+}
+
void msvcProbe(Settings *settings, QList<Profile> &profiles)
{
qbsInfo() << Tr::tr("Detecting MSVC toolchains...");
@@ -96,13 +111,15 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles)
// 1) Installed SDKs preferred over standalone Visual studio
QVector<WinSDK> winSDKs;
WinSDK defaultWinSDK;
- const QSettings sdkRegistry(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows"),
+
+ const QSettings sdkRegistry(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE") + wow6432Key()
+ + QLatin1String("\\Microsoft\\Microsoft SDKs\\Windows"),
QSettings::NativeFormat);
const QString defaultSdkPath = sdkRegistry.value(QLatin1String("CurrentInstallFolder")).toString();
if (!defaultSdkPath.isEmpty()) {
foreach (const QString &sdkKey, sdkRegistry.childGroups()) {
WinSDK sdk;
- sdk.version = sdkRegistry.value(sdkKey + QLatin1String("/ProductVersion")).toString();
+ sdk.version = sdkKey;
sdk.installPath = sdkRegistry.value(sdkKey + QLatin1String("/InstallationFolder")).toString();
sdk.isDefault = (sdk.installPath == defaultSdkPath);
if (sdk.installPath.isEmpty())
@@ -117,8 +134,7 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles)
}
foreach (const WinSDK &sdk, winSDKs) {
- qbsInfo() << Tr::tr(" Windows SDK detected:\n"
- " version %1\n"
+ qbsInfo() << Tr::tr(" Windows SDK %1 detected:\n"
" installed in %2").arg(sdk.version, sdk.installPath);
if (!sdk.architectures.isEmpty())
qbsInfo() << Tr::tr(" This SDK contains C++ compiler(s).");
@@ -129,11 +145,8 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles)
// 2) Installed MSVCs
QVector<MSVC> msvcs;
const QSettings vsRegistry(
-#ifdef Q_OS_WIN64
- QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7"),
-#else
- QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7"),
-#endif
+ QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE") + wow6432Key()
+ + QLatin1String("\\Microsoft\\VisualStudio\\SxS\\VC7"),
QSettings::NativeFormat);
foreach (const QString &vsName, vsRegistry.allKeys()) {
// Scan for version major.minor
@@ -194,14 +207,14 @@ void msvcProbe(Settings *settings, QList<Profile> &profiles)
foreach (const WinSDK &sdk, winSDKs) {
foreach (const QString &arch, sdk.architectures) {
- addMSVCPlatform(settings, profiles, QLatin1String("WinSDK") + sdk.version,
+ addMSVCPlatform(sdk, settings, profiles, QLatin1String("WinSDK") + sdk.version,
sdk.installPath + QLatin1String("\\bin"), defaultWinSDK.installPath, arch);
}
}
foreach (const MSVC &msvc, msvcs) {
foreach (const QString &arch, msvc.architectures) {
- addMSVCPlatform(settings, profiles, QLatin1String("MSVC") + msvc.version,
+ addMSVCPlatform(msvc, settings, profiles, QLatin1String("MSVC") + msvc.version,
msvc.installPath, defaultWinSDK.installPath, arch);
}
}
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index e59bf92dc..4b4a8b13c 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -41,6 +41,7 @@
#include <QFileInfo>
#include <QLibrary>
#include <QProcess>
+#include <QRegExp>
#include <QStringList>
#include <QtDebug>
@@ -195,12 +196,18 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
qtEnvironment.qtPatchVersion = configVariable(qconfigContent, "QT_PATCH_VERSION").toInt();
qtEnvironment.qtNameSpace = configVariable(qconfigContent, "QT_NAMESPACE");
qtEnvironment.qtLibInfix = configVariable(qconfigContent, "QT_LIBINFIX");
+ qtEnvironment.architecture = configVariable(qconfigContent, "QT_TARGET_ARCH");
+ if (qtEnvironment.architecture.isEmpty())
+ qtEnvironment.architecture = configVariable(qconfigContent, "QT_ARCH");
+ if (qtEnvironment.architecture.isEmpty())
+ qtEnvironment.architecture = QLatin1String("x86");
qtEnvironment.configItems = configVariableItems(qconfigContent, QLatin1String("CONFIG"));
qtEnvironment.qtConfigItems = configVariableItems(qconfigContent, QLatin1String("QT_CONFIG"));
// retrieve the mkspec
if (qtVersion.majorVersion >= 5) {
const QString mkspecName = queryOutput.value("QMAKE_XSPEC");
+ qtEnvironment.mkspecName = mkspecName;
qtEnvironment.mkspecPath = mkspecsBasePath + QLatin1Char('/') + mkspecName;
if (!mkspecsBaseSrcPath.isEmpty() && !QFile::exists(qtEnvironment.mkspecPath))
qtEnvironment.mkspecPath = mkspecsBaseSrcPath + QLatin1Char('/') + mkspecName;
@@ -211,6 +218,10 @@ QtEnvironment SetupQt::fetchEnvironment(const QString &qmakePath)
} else {
qtEnvironment.mkspecPath = QFileInfo(mkspecsBasePath + "/default").symLinkTarget();
}
+ qtEnvironment.mkspecName = qtEnvironment.mkspecPath;
+ int idx = qtEnvironment.mkspecName.lastIndexOf(QLatin1Char('/'));
+ if (idx != -1)
+ qtEnvironment.mkspecName.remove(0, idx + 1);
}
// determine whether we have a framework build
@@ -295,13 +306,8 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
qtEnvironment.staticBuild);
// Set the minimum operating system versions appropriate for this Qt version
- QString windowsVersion, osxVersion, iosVersion, androidVersion;
-
- // ### TODO: Also dependent on the toolchain, which we can't easily access here
- // Most 32-bit Windows applications based on either Qt 5 or Qt 4 should run
- // on 2000, so this is a good baseline for now.
- if (qtEnvironment.mkspecPath.contains("win32") && qtEnvironment.qtMajorVersion >= 4)
- windowsVersion = QLatin1String("5.0");
+ const QString windowsVersion = guessMinimumWindowsVersion(qtEnvironment);
+ QString osxVersion, iosVersion, androidVersion;
if (qtEnvironment.mkspecPath.contains("macx")) {
profile.setValue(settingsTemplate.arg("frameworkBuild"), qtEnvironment.frameworkBuild);
@@ -351,9 +357,6 @@ void SetupQt::saveToQbsSettings(const QString &qtVersionName, const QtEnvironmen
androidVersion = QLatin1String("1.6"); // Necessitas
}
- if (qtEnvironment.mkspecPath.contains("winrt") && qtEnvironment.qtMajorVersion >= 5)
- windowsVersion = QLatin1String("6.2");
-
// ### TODO: wince, winphone, blackberry
if (!windowsVersion.isEmpty())
@@ -432,4 +435,29 @@ bool SetupQt::checkIfMoreThanOneQtWithTheSameVersion(const QString &qtVersion,
return false;
}
+QString SetupQt::guessMinimumWindowsVersion(const QtEnvironment &qt)
+{
+ if (qt.mkspecName.startsWith("winrt-"))
+ return QLatin1String("6.2");
+
+ if (!qt.mkspecName.startsWith("win32-"))
+ return QString();
+
+ if (qt.architecture == QLatin1String("x86_64")
+ || qt.architecture == QLatin1String("ia64")) {
+ return QLatin1String("5.2");
+ }
+
+ QRegExp rex(QLatin1String("^win32-msvc(\\d+)$"));
+ if (rex.exactMatch(qt.mkspecName)) {
+ int msvcVersion = rex.cap(1).toInt();
+ if (msvcVersion < 2012)
+ return QLatin1String("5.0");
+ else
+ return QLatin1String("5.1");
+ }
+
+ return qt.qtMajorVersion < 5 ? QLatin1String("5.0") : QLatin1String("5.1");
+}
+
} // namespace qbs
diff --git a/src/app/qbs-setup-qt/setupqt.h b/src/app/qbs-setup-qt/setupqt.h
index 781d7f189..6769929b9 100644
--- a/src/app/qbs-setup-qt/setupqt.h
+++ b/src/app/qbs-setup-qt/setupqt.h
@@ -50,9 +50,11 @@ public:
QString qtLibInfix;
QString qtNameSpace;
QString mkspecPath;
+ QString mkspecName;
QStringList buildVariant;
QStringList configItems;
QStringList qtConfigItems;
+ QString architecture;
QString qtVersion;
int qtMajorVersion;
int qtMinorVersion;
@@ -72,6 +74,9 @@ public:
Settings *settings);
static bool checkIfMoreThanOneQtWithTheSameVersion(const QString &qtVersion,
const QList<QtEnvironment> &qtEnvironments);
+
+private:
+ static QString guessMinimumWindowsVersion(const QtEnvironment &qt);
};
} // namespace qbs
diff --git a/src/app/qbs/parser/commandlineoption.cpp b/src/app/qbs/parser/commandlineoption.cpp
index 21fe05b41..a67dc97d1 100644
--- a/src/app/qbs/parser/commandlineoption.cpp
+++ b/src/app/qbs/parser/commandlineoption.cpp
@@ -60,9 +60,9 @@ QString FileOption::description(CommandType command) const
Q_UNUSED(command);
return Tr::tr("%1|%2 <file>\n"
"\tUse <file> as the project file.\n"
- "\tIf <file> is a directory and it contains a single file ending in '.qbs', "
- "that file will be used.\n"
- "\tIf this option is not given at all, the behavior is the same as for '-f .'.\n")
+ "\tIf <file> is a directory and it contains a single file ending in '.qbs',\n"
+ "\tthat file will be used.\n"
+ "\tIf this option is not given at all, behavior is the same as for '-f .'.\n")
.arg(longRepresentation(), shortRepresentation());
}
@@ -121,9 +121,10 @@ QString VerboseOption::description(CommandType command) const
Q_UNUSED(command);
return Tr::tr("%1|%2\n"
"\tBe more verbose. Increases the log level by one.\n"
- "\tThis option can be given more than once. Excessive occurrences have no effect.\n"
- "\tIf the option '%3' appears anywhere on the command line in addition to this option,\n"
- "\tits value is taken as the base which to increase.\n")
+ "\tThis option can be given more than once.\n"
+ "\tExcessive occurrences have no effect.\n"
+ "\tIf option '%3' appears anywhere on the command line in addition\n"
+ "\tto this option, its value is taken as the base which to increase.\n")
.arg(longRepresentation(), shortRepresentation(), loglevelLongRepresentation());
}
@@ -142,9 +143,10 @@ QString QuietOption::description(CommandType command) const
Q_UNUSED(command);
return Tr::tr("%1|%2\n"
"\tBe more quiet. Decreases the log level by one.\n"
- "\tThis option can be given more than once. Excessive occurrences have no effect.\n"
- "\tIf option '%3' appears anywhere on the command line in addition to this option,\n"
- "\tits value is taken as the base which to decrease.\n")
+ "\tThis option can be given more than once.\n"
+ "\tExcessive occurrences have no effect.\n"
+ "\tIf option '%3' appears anywhere on the command line in addition\n"
+ "\tto this option, its value is taken as the base which to decrease.\n")
.arg(longRepresentation(), shortRepresentation(), loglevelLongRepresentation());
}
@@ -162,8 +164,8 @@ QString JobsOption::description(CommandType command) const
{
Q_UNUSED(command);
return Tr::tr("%1|%2 <n>\n"
- "\tUse <n> concurrent build jobs. <n> must be an integer greater than zero. "
- "The default is the number of cores.\n")
+ "\tUse <n> concurrent build jobs. <n> must be an integer greater than zero.\n"
+ "\tThe default is the number of cores.\n")
.arg(longRepresentation(), shortRepresentation());
}
@@ -209,8 +211,9 @@ QString DryRunOption::description(CommandType command) const
{
Q_UNUSED(command);
return Tr::tr("%1|%2\n"
- "\tDry run. No commands will be executed and no permanent changes to the "
- "build graph will be done.\n").arg(longRepresentation(), shortRepresentation());
+ "\tDry run. No commands will be executed and no permanent changes to the\n"
+ "\tbuild graph will be done.\n")
+ .arg(longRepresentation(), shortRepresentation());
}
QString DryRunOption::shortRepresentation() const
@@ -316,7 +319,8 @@ QString LogLevelOption::description(CommandType command) const
{
Q_UNUSED(command);
return Tr::tr("%1 <level>\n"
- "\tUse the specified log level. Possible values are '%2'.\n"
+ "\tUse the specified log level.\n"
+ "\tPossible values are '%2'.\n"
"\tThe default is '%3'.\n").arg(longRepresentation(),
allLogLevelStrings().join(QLatin1String("', '")), logLevelName(defaultLogLevel()));
}
@@ -358,9 +362,9 @@ QString ForceOption::description(CommandType command) const
{
Q_UNUSED(command);
return Tr::tr("%1\n\tDisregard objections.\n"
- "\tqbs might refuse to execute a given command because "
- "certain circumstances make it seem dubious. This option switches the "
- "respective checks off.\n").arg(longRepresentation());
+ "\tqbs might refuse to execute a given command because certain\n"
+ "\tcircumstances make it seem dubious. This option switches the\n"
+ "\trespective checks off.\n").arg(longRepresentation());
}
QString ForceOption::longRepresentation() const
@@ -372,8 +376,8 @@ QString ForceTimeStampCheckOption::description(CommandType command) const
{
Q_UNUSED(command);
return Tr::tr("%1\n\tForce timestamp checks.\n"
- "\tInstead of using the file timestamps that are stored in the build graph, "
- "retrieve the timestamps from the file system.\n").arg(longRepresentation());
+ "\tInstead of using the file timestamps that are stored in the build graph,\n"
+ "\tretrieve the timestamps from the file system.\n").arg(longRepresentation());
}
QString ForceTimeStampCheckOption::longRepresentation() const
@@ -393,10 +397,11 @@ QString InstallRootOption::description(CommandType command) const
Q_ASSERT(command == InstallCommandType || command == RunCommandType);
Q_UNUSED(command);
return Tr::tr("%1 <directory>\n"
- "\tInstall into the given directory. The default value is '<build dir>/%2'.\n"
- "\tIf the directory does not exist, it will be created. Use the special value "
- "'%3' to install into the sysroot (i.e. the value of the property "
- "qbs.sysroot).\n")
+ "\tInstall into the given directory.\n"
+ "\tThe default value is '<build dir>/%2'.\n"
+ "\tIf the directory does not exist, it will be created. Use the special\n"
+ "\tvalue '%3' to install into the sysroot (i.e. the value of the\n"
+ "\tproperty qbs.sysroot).\n")
.arg(longRepresentation(), InstallOptions::defaultInstallRoot(), magicSysrootString());
}
diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp
index 46d1e6173..022415d78 100644
--- a/src/app/qbs/parser/commandlineparser.cpp
+++ b/src/app/qbs/parser/commandlineparser.cpp
@@ -367,9 +367,8 @@ void CommandLineParser::CommandLineParserPrivate::doParse()
Command *CommandLineParser::CommandLineParserPrivate::commandFromString(const QString &commandString) const
{
foreach (Command * const command, allCommands()) {
- if (command->representation() == commandString) {
+ if (command->representation() == commandString)
return command;
- }
}
return 0;
}