diff options
author | Rafael Roquetto <rafael.roquetto@kdab.com> | 2012-10-17 17:06:41 -0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-08 16:59:50 +0100 |
commit | 6e8f26a64572a02b4747b5b8c052114e9a1c485f (patch) | |
tree | 251d51601429a539f0d06fbec2183284052266db /tools | |
parent | e268cf6a383a1860a4ed6b8f579eb6d9e1b34e12 (diff) |
Implement "-device" option for configure.exe
This aims to mimics the behavior of the -device option already present on the
configure shell script
Change-Id: Ia28306f5ed74b9cfa812aa3efa6b79d0bafa4994
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/configure/configureapp.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 5e73c97960..cb853b3496 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -431,16 +431,20 @@ void Configure::parseCmdLine() argCount = configCmdLine.size(); #endif + bool isDeviceMkspec = false; + // Look first for XQMAKESPEC for (int j = 0 ; j < argCount; ++j) { - if (configCmdLine.at(j) == "-xplatform") { + if ((configCmdLine.at(j) == "-xplatform") || (configCmdLine.at(j) == "-device")) { + isDeviceMkspec = (configCmdLine.at(j) == "-device"); ++j; if (j == argCount) break; dictionary["XQMAKESPEC"] = configCmdLine.at(j); if (!dictionary[ "XQMAKESPEC" ].isEmpty()) applySpecSpecifics(); + break; } } @@ -519,7 +523,8 @@ void Configure::parseCmdLine() dictionary["OBSOLETE_ARCH_ARG"] = "yes"; } else if (configCmdLine.at(i) == "-embedded") { dictionary[ "EMBEDDED" ] = "yes"; - } else if (configCmdLine.at(i) == "-xplatform") { + } else if (configCmdLine.at(i) == "-xplatform" + || configCmdLine.at(i) == "-device") { ++i; // do nothing } @@ -1269,11 +1274,32 @@ void Configure::parseCmdLine() // Tell the user how to confclean before the next configure dictionary["CONFCLEANINSTRUCTION"] = dictionary["MAKE"] + QString(" confclean"); - // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well - if (dictionary.contains("XQMAKESPEC") && - !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) { + if (isDeviceMkspec) { + const QStringList devices = mkspecs.filter("devices/", Qt::CaseInsensitive); + const QStringList family = devices.filter(dictionary["XQMAKESPEC"], Qt::CaseInsensitive); + + if (family.isEmpty()) { + dictionary["HELP"] = "yes"; + cout << "Error: No device matching '" << dictionary["XQMAKESPEC"] << "'." << endl; + } else if (family.size() > 1) { + dictionary["HELP"] = "yes"; + + cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl; + + foreach (const QString &device, family) + cout << "\t* " << device << endl; + } else { + Q_ASSERT(family.size() == 1); + dictionary["XQMAKESPEC"] = family.at(0); + } + + } else { + // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well + if (dictionary.contains("XQMAKESPEC") && + !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) { dictionary["HELP"] = "yes"; cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl; + } } // Ensure that the crt to be deployed can be found |