Пример #1
0
bool AndroidSettingsWidget::checkNDK(const Utils::FileName &location)
{
    if (location.isEmpty()) {
        m_ui->ndkWarningIconLabel->setVisible(false);
        m_ui->toolchainFoundLabel->setVisible(false);
        m_ui->kitWarningIconLabel->setVisible(false);
        m_ui->kitWarningLabel->setVisible(false);
        return false;
    }
    Utils::FileName platformPath = location;
    Utils::FileName toolChainPath = location;
    Utils::FileName sourcesPath = location;
    if (!platformPath.appendPath(QLatin1String("platforms")).toFileInfo().exists()
            || !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
            || !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
        m_ui->toolchainFoundLabel->setText(tr("\"%1\" does not seem to be an Android NDK top folder.").arg(location.toUserOutput()));
        m_ui->toolchainFoundLabel->setVisible(true);
        m_ui->ndkWarningIconLabel->setVisible(true);
        return false;
    }

    // Check how many toolchains we could add...
    QList<AndroidToolChainFactory::AndroidToolChainInformation> compilerPaths = AndroidToolChainFactory::toolchainPathsForNdk(location);
    if (compilerPaths.isEmpty()) {
        m_ui->ndkWarningIconLabel->setVisible(false);
        m_ui->toolchainFoundLabel->setVisible(false);
    } else {
        m_ui->ndkWarningIconLabel->setVisible(false);
        m_ui->toolchainFoundLabel->setText(tr("Found %n toolchains for this NDK.", 0, compilerPaths.count()));
        m_ui->toolchainFoundLabel->setVisible(true);
    }

    // See if we have qt versions for those toolchains
    QSet<ProjectExplorer::Abi::Architecture> toolchainsForArch;
    foreach (const AndroidToolChainFactory::AndroidToolChainInformation &ati, compilerPaths)
        toolchainsForArch.insert(ati.architecture);

    QSet<ProjectExplorer::Abi::Architecture> qtVersionsForArch;
    foreach (QtSupport::BaseQtVersion *qtVersion, QtSupport::QtVersionManager::versions()) {
        if (qtVersion->type() != QLatin1String(Constants::ANDROIDQT) || qtVersion->qtAbis().isEmpty())
            continue;
        qtVersionsForArch.insert(qtVersion->qtAbis().first().architecture());
    }

    QSet<ProjectExplorer::Abi::Architecture> missingQtArchs = toolchainsForArch.subtract(qtVersionsForArch);
    if (missingQtArchs.isEmpty()) {
        m_ui->kitWarningIconLabel->setVisible(false);
        m_ui->kitWarningLabel->setVisible(false);
    } else {
        m_ui->kitWarningIconLabel->setVisible(true);
        m_ui->kitWarningLabel->setVisible(true);
        if (missingQtArchs.count() == 1) {
            m_ui->kitWarningLabel->setText(tr("Qt version for architecture %1 is missing.\n To add the Qt version, select Options > Build & Run > Qt Versions.")
                                           .arg(ProjectExplorer::Abi::toString((*missingQtArchs.constBegin()))));
        } else {
            QStringList missingArchs;
            foreach (ProjectExplorer::Abi::Architecture arch, missingQtArchs)
                missingArchs.append(ProjectExplorer::Abi::toString(arch));
            m_ui->kitWarningLabel->setText(tr("Qt versions for architectures %1 are missing.\n To add the Qt versions, select Options > Build & Run > Qt Versions.")
                                           .arg(missingArchs.join(QLatin1String(", "))));
        }
    }

    m_androidConfig.ndkLocation = location;
    return true;

}
bool AndroidSettingsWidget::sdkPlatformToolsInstalled() const
{
    Utils::FileName adb = m_androidConfig.sdkLocation();
    return adb.appendPath(QLatin1String("platform-tools/adb" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists();
}
Пример #3
0
QList<ProjectExplorer::ToolChain *> RvctToolChainFactory::autoDetect()
{
    Utils::Environment env = Utils::Environment::systemEnvironment();

    QMap<QString, QList<Utils::EnvironmentItem> > rvcts;
    QList<Utils::EnvironmentItem> globalItems;

    // Find all RVCT..x variables
    for (Utils::Environment::const_iterator i = env.constBegin(); i != env.constEnd(); ++i) {
        if (i.key() == QLatin1String(RVCT_LICENSE_KEY))
            globalItems.append(Utils::EnvironmentItem(i.key(), i.value()));
        if (!i.key().startsWith(QLatin1String("RVCT")))
            continue;

        const QString key = i.key().left(6);
        QList<Utils::EnvironmentItem> values = rvcts.value(key);

        values.append(Utils::EnvironmentItem(i.key(), i.value()));

        rvcts.insert(key, values);
    }

    // Set up tool chains for each RVCT.. set
    QList<ProjectExplorer::ToolChain *> result;
    for (QMap<QString, QList<Utils::EnvironmentItem> >::const_iterator i = rvcts.constBegin();
         i != rvcts.constEnd(); ++i) {
        QList<Utils::EnvironmentItem> changes = i.value();
        changes.append(globalItems);

        Utils::FileName binary = Utils::FileName::fromUserInput(valueOf(changes, QLatin1String("BIN")));
        if (binary.isEmpty())
            continue;
        binary.appendPath(QLatin1String(RVCT_BINARY));
        QFileInfo fi(binary.toFileInfo());
        if (!fi.exists() || !fi.isExecutable())
            continue;

        RvctToolChain::RvctVersion v = RvctToolChain::version(binary);
        if (v.majorVersion == 0 && v.minorVersion == 0 && v.build == 0)
            continue; // Failed to start.

        //: %1 arm version, %2 major version, %3 minor version, %4 build number
        const QString name = tr("RVCT (%1 %2.%3 Build %4)");

        RvctToolChain *tc = new RvctToolChain(true);
        tc->setCompilerCommand(binary);
        tc->setEnvironmentChanges(changes);
        tc->setDisplayName(name.arg(armVersionString(tc->armVersion()))
                           .arg(v.majorVersion).arg(v.minorVersion).arg(v.build));
        tc->setVersion(v);
        tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
        result.append(tc);

        tc = new RvctToolChain(true);
        tc->setCompilerCommand(binary);
        tc->setEnvironmentChanges(changes);
        tc->setArmVersion(RvctToolChain::ARMv6);
        tc->setDisplayName(name.arg(armVersionString(tc->armVersion()))
                           .arg(v.majorVersion).arg(v.minorVersion).arg(v.build));
        tc->setVersion(v);
        tc->setDebuggerCommand(ProjectExplorer::ToolChainManager::instance()->defaultDebugger(tc->targetAbi()));
        result.append(tc);
    }

    return result;
}
Пример #4
0
Utils::FileName CodeStylePool::settingsPath(const QByteArray &id) const
{
    Utils::FileName path = Utils::FileName::fromString(settingsDir());
    path.appendPath(QString::fromUtf8(id + ".xml"));
    return path;
}