From 6e8f26a64572a02b4747b5b8c052114e9a1c485f Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 17 Oct 2012 17:06:41 -0300 Subject: 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 --- tools/configure/configureapp.cpp | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'tools') 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 -- cgit v1.2.3