QString AndroidToolChain::makeCommand(const Utils::Environment &env) const
{
    QStringList extraDirectories = AndroidConfigurations::currentConfig().makeExtraSearchDirectories();
    if (HostOsInfo::isWindowsHost()) {
        QString tmp = env.searchInPath(QLatin1String("ma-make.exe"), extraDirectories);
        if (!tmp.isEmpty())
            return tmp;
        tmp = env.searchInPath(QLatin1String("mingw32-make"), extraDirectories);
        return tmp.isEmpty() ? QLatin1String("mingw32-make") : tmp;
    }

    QString make = QLatin1String("make");
    QString tmp = env.searchInPath(make, extraDirectories);
    return tmp.isEmpty() ? make : tmp;
}
static inline QString detectSsh()
{
    const QByteArray gitSsh = qgetenv("GIT_SSH");
    if (!gitSsh.isEmpty())
        return QString::fromLocal8Bit(gitSsh);
#if QT_VERSION >= 0x050000
    QString ssh = QStandardPaths::findExecutable(QLatin1String(defaultSshC));
#else
    const Utils::Environment env = Utils::Environment::systemEnvironment();
    QString ssh = env.searchInPath(QLatin1String(defaultSshC));
#endif
    if (!ssh.isEmpty())
        return ssh;
    if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
        const QString git = GerritPlugin::gitBinary();
        if (!git.isEmpty()) {
            // Is 'git\cmd' in the path (folder containing .bats)?
            QString path = QFileInfo(git).absolutePath();
            if (path.endsWith(QLatin1String("cmd"), Qt::CaseInsensitive))
                path.replace(path.size() - 3, 3, QLatin1String("bin"));
            ssh = path + QLatin1Char('/') + QLatin1String(defaultSshC);
        }
    }
    return ssh;
}
QList<ToolChain *> Internal::GccToolChainFactory::autoDetectToolchains(const QString &compiler,
                                                                       const QStringList &debuggers,
                                                                       const Abi &requiredAbi)
{
    QList<ToolChain *> result;

    const Utils::Environment systemEnvironment = Utils::Environment::systemEnvironment();
    const QString compilerPath = systemEnvironment.searchInPath(compiler);
    if (compilerPath.isEmpty())
        return result;
    QString debuggerPath; // Find the first debugger
    foreach (const QString &debugger, debuggers) {
        debuggerPath = systemEnvironment.searchInPath(debugger);
        if (!debuggerPath.isEmpty())
            break;
    }
static QString defaultCommand()
{
    Utils::Environment env = Utils::Environment::systemEnvironment();
    QString rc;
    rc = QLatin1String("p4");
#if defined(Q_OS_WIN32)
    rc.append(QLatin1String(".exe"));
#endif
    return env.searchInPath(rc);
}
static inline QString detectSsh()
{
    const QByteArray gitSsh = qgetenv("GIT_SSH");
    if (!gitSsh.isEmpty())
        return QString::fromLocal8Bit(gitSsh);
#if QT_VERSION >= 0x050000
    QString ssh = QStandardPaths::findExecutable(QLatin1String(defaultSshC));
#else
    const Utils::Environment env = Utils::Environment::systemEnvironment();
    QString ssh = env.searchInPath(QLatin1String(defaultSshC));
#endif
    if (!ssh.isEmpty())
        return ssh;
    if (Utils::HostOsInfo::isWindowsHost()) { // Windows: Use ssh.exe from git if it cannot be found.
        Utils::FileName path = GerritPlugin::gitBinDirectory();
        if (!path.isEmpty())
            ssh = path.appendPath(QLatin1String(defaultSshC)).toString();
    }
    return ssh;
}
QVariant CMakeGeneratorKitInformation::defaultValue(const Kit *k) const
{
    CMakeTool *tool = CMakeKitInformation::cmakeTool(k);
    if (!tool)
        return QString();
    QStringList known = tool->supportedGenerators();
    auto it = std::find_if(known.constBegin(), known.constEnd(),
                           [](const QString &s) { return s == QLatin1String("CodeBlocks - Ninja"); });
    if (it != known.constEnd()) {
        Utils::Environment env = Utils::Environment::systemEnvironment();
        k->addToEnvironment(env);
        const Utils::FileName ninjaExec = env.searchInPath(QLatin1String("ninja"));
        if (ninjaExec.isEmpty())
            it = known.constEnd(); // Ignore ninja generator without ninja exectuable
    }
    if (Utils::HostOsInfo::isWindowsHost()) {
        // *sigh* Windows with its zoo of incompatible stuff again...
        ToolChain *tc = ToolChainKitInformation::toolChain(k, ToolChain::Language::Cxx);
        if (tc && tc->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID) {
            if (it == known.constEnd())
                it = std::find_if(known.constBegin(), known.constEnd(),
                                  [](const QString &s) { return s == QLatin1String("CodeBlocks - MinGW Makefiles"); });
        } else {
            if (it == known.constEnd())
                it = std::find_if(known.constBegin(), known.constEnd(),
                                  [](const QString &s) { return s == QLatin1String("CodeBlocks - NMake Makefiles"); });
        }

    } else {
        // Unix-oid OSes:
        if (it == known.constEnd())
            it = std::find_if(known.constBegin(), known.constEnd(),
                              [](const QString &s) { return s == QLatin1String("CodeBlocks - Unix Makefiles"); });
    }
    if (it == known.constEnd())
        it = known.constBegin(); // Fallback to the first generator...
    if (it != known.constEnd())
        return *it;
    return QString();
}
Exemple #7
0
QString GccToolChain::makeCommand(const Utils::Environment &environment) const
{
    QString make = QLatin1String("make");
    QString tmp = environment.searchInPath(make);
    return tmp.isEmpty() ? make : tmp;
}