Example #1
0
bool IosManager::supportsIos(ProjectExplorer::Target *target)
{
    if (!qobject_cast<QmakeProjectManager::QmakeProject *>(target->project()))
        return false;
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
    return version && version->type() == QLatin1String(Ios::Constants::IOSQT);
}
Utils::FileName GenericEmbeddedLinuxTarget::mkspec(const Qt4ProjectManager::Qt4BuildConfiguration *bc) const
{
   QtSupport::BaseQtVersion *version = bc->qtVersion();
   if (!version)
       return Utils::FileName();
   return version->mkspec();
}
void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
{
    if (m_isUsingDyldImageSuffix)
        env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));

    // The user could be linking to a library found via a -L/some/dir switch
    // to find those libraries while actually running we explicitly prepend those
    // dirs to the library search path
    const QmakeProFileNode *node = static_cast<QmakeProject *>(target()->project())->rootQmakeProjectNode()->findProFileFor(m_proFilePath);
    if (node) {
        const QStringList libDirectories = node->variableValue(LibDirectoriesVar);
        if (!libDirectories.isEmpty()) {
            const QString proDirectory = node->buildDir();
            foreach (QString dir, libDirectories) {
                // Fix up relative entries like "LIBS+=-L.."
                const QFileInfo fi(dir);
                if (!fi.isAbsolute())
                    dir = QDir::cleanPath(proDirectory + QLatin1Char('/') + dir);
                env.prependOrSetLibrarySearchPath(dir);
            } // foreach
        } // libDirectories
    } // node

    QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
    if (qtVersion)
        env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
}
QList<Core::Id> MaemoDeployStepFactory::availableCreationIds(BuildStepList *parent) const
{
    QList<Core::Id> ids;
    if (!qobject_cast<Qt4MaemoDeployConfiguration *>(parent->parent()))
        return ids;

    QString platform;
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(parent->target()->kit());
    if (version)
        platform = version->platformName();

    if (platform == QtSupport::Constants::MAEMO_FREMANTLE_PLATFORM) {
        ids << MaemoMakeInstallToSysrootStep::Id
            << MaemoInstallDebianPackageToSysrootStep::Id
            << MaemoUploadAndInstallPackageStep::stepId()
            << MaemoInstallPackageViaMountStep::stepId()
            << MaemoCopyFilesViaMountStep::stepId()
            << MaddeQemuStartStep::stepId();
    } else if (platform == QtSupport::Constants::MEEGO_HARMATTAN_PLATFORM) {
        ids << MaemoMakeInstallToSysrootStep::Id
            << MaemoInstallDebianPackageToSysrootStep::Id
            << MaemoUploadAndInstallPackageStep::stepId()
            << GenericDirectUploadStep::stepId()
            << MaddeQemuStartStep::stepId();
    }

    return ids;
}
Example #5
0
QMakeStepConfig QMakeStep::deducedArguments()
{
    ProjectExplorer::Kit *kit = target()->kit();
    QMakeStepConfig config;
    ProjectExplorer::ToolChain *tc
            = ProjectExplorer::ToolChainKitInformation::toolChain(kit);
    ProjectExplorer::Abi targetAbi;
    if (tc)
        targetAbi = tc->targetAbi();

    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());

    config.archConfig = QMakeStepConfig::targetArchFor(targetAbi, version);
    config.osType = QMakeStepConfig::osTypeFor(targetAbi, version);
    if (linkQmlDebuggingLibrary() && version && version->qtVersion().majorVersion >= 5)
        config.linkQmlDebuggingQQ2 = true;

    if (useQtQuickCompiler() && version)
        config.useQtQuickCompiler = true;

    if (separateDebugInfo())
        config.separateDebugInfo = true;

    return config;
}
QString QmlProjectRunConfiguration::viewerPath() const
{
    QtSupport::BaseQtVersion *version = qtVersion();
    if (!version)
        return QString();
    else
        return version->qmlviewerCommand();
}
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
{
    // TODO: Use environment from Qbs!

    QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
    if (qtVersion)
        env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
}
Example #8
0
QString PuppetCreator::qmakeCommand() const
{
    QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitInformation::qtVersion(m_kit);
    if (currentQtVersion)
        return currentQtVersion->qmakeCommand().toString();

    return QString();
}
Example #9
0
QString DesignDocumentController::pathToQt() const
{
    QtSupport::BaseQtVersion *activeQtVersion = QtSupport::QtVersionManager::instance()->version(d->qt_versionId);
    if (activeQtVersion && (activeQtVersion->qtVersion().majorVersion > 3)
            && (activeQtVersion->supportsTargetId(Qt4ProjectManager::Constants::QT_SIMULATOR_TARGET_ID)
                || activeQtVersion->supportsTargetId(Qt4ProjectManager::Constants::DESKTOP_TARGET_ID)))
        return activeQtVersion->versionInfo().value("QT_INSTALL_DATA");
    return QString();
}
QString DesignDocumentController::pathToQt() const
{
    QtSupport::BaseQtVersion *activeQtVersion = QtSupport::QtVersionManager::instance()->version(d->qt_versionId);
    if (activeQtVersion && (activeQtVersion->qtVersion().majorVersion > 3)
            && (activeQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
                || activeQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)))
        return activeQtVersion->qmakeProperty("QT_INSTALL_DATA");
    return QString();
}
Example #11
0
QString DesignDocument::pathToQt() const
{
    QtSupport::BaseQtVersion *activeQtVersion = QtSupport::QtVersionManager::version(m_qtVersionId);
    if (activeQtVersion && (activeQtVersion->qtVersion() >= QtSupport::QtVersionNumber(4, 7, 1))
            && (activeQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
                || activeQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)))
        return activeQtVersion->qmakeProperty("QT_INSTALL_DATA");

    return QString();
}
Example #12
0
QByteArray PuppetCreator::qtHash() const
{
    if (m_kit) {
        QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitInformation::qtVersion(m_kit);
        if (currentQtVersion)
            return QCryptographicHash::hash(currentQtVersion->qmakeProperty("QT_INSTALL_DATA").toUtf8(), QCryptographicHash::Sha1).toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
    }

    return QByteArray();
}
bool AndroidGdbServerKitInformation::isAndroidKit(const Kit *kit)
{
    QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(kit);
    ToolChain *tc = ToolChainKitInformation::toolChain(kit);
    if (qt && tc)
        return qt->type() == QLatin1String(Constants::ANDROIDQT)
                && tc->type() == QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE);
    return false;

}
Example #14
0
QDateTime PuppetCreator::qtLastModified() const
{
    if (m_kit) {
        QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitInformation::qtVersion(m_kit);
        if (currentQtVersion)
            return QFileInfo(currentQtVersion->qmakeProperty("QT_INSTALL_LIBS")).lastModified();
    }

    return QDateTime();
}
QString QmlProjectRunConfiguration::executable() const
{
    QtSupport::BaseQtVersion *version = qtVersion();
    if (!version)
        return QString();

    if (id() == Constants::QML_SCENE_RC_ID)
        return version->qmlsceneCommand();
    return version->qmlviewerCommand();
}
void Qt4TargetSetupWidget::addBuildConfigurationInfo(const BuildConfigurationInfo &info, bool importing)
{
    if (importing) {
        if (!m_haveImported) {
            // disable everything on first import
            for (int i = 0; i < m_enabled.count(); ++i) {
                m_enabled[i] = false;
                m_checkboxes[i]->setChecked(false);
            }
            m_selected = 0;
        }

        m_haveImported = true;
    }
    int pos = m_pathChoosers.count();
    m_enabled.append(true);
    ++m_selected;

    m_infoList.append(info);

    QCheckBox *checkbox = new QCheckBox;
    checkbox->setText(Qt4BuildConfigurationFactory::buildConfigurationDisplayName(info));
    checkbox->setChecked(m_enabled.at(pos));
    checkbox->setAttribute(Qt::WA_LayoutUsesWidgetRect);
    m_newBuildsLayout->addWidget(checkbox, pos * 2, 0);

    Utils::PathChooser *pathChooser = new Utils::PathChooser();
    pathChooser->setExpectedKind(Utils::PathChooser::Directory);
    pathChooser->setPath(info.directory);
    QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(m_profile);
    if (!version)
        return;
    pathChooser->setReadOnly(!version->supportsShadowBuilds() || importing);
    m_newBuildsLayout->addWidget(pathChooser, pos * 2, 1);

    QLabel *reportIssuesLabel = new QLabel;
    reportIssuesLabel->setIndent(32);
    m_newBuildsLayout->addWidget(reportIssuesLabel, pos * 2 + 1, 0, 1, 2);
    reportIssuesLabel->setVisible(false);

    connect(checkbox, SIGNAL(toggled(bool)),
            this, SLOT(checkBoxToggled(bool)));

    connect(pathChooser, SIGNAL(changed(QString)),
            this, SLOT(pathChanged()));

    m_checkboxes.append(checkbox);
    m_pathChoosers.append(pathChooser);
    m_reportIssuesLabels.append(reportIssuesLabel);

    m_issues.append(false);
    reportIssues(pos);

    emit selectedToggled();
}
QString Qt4UiCodeModelSupport::uicCommand() const
{
    QtSupport::BaseQtVersion *version;
    if (m_project->needsConfiguration()) {
        version = QtSupport::QtKitInformation::qtVersion(ProjectExplorer::KitManager::instance()->defaultKit());
    } else {
        ProjectExplorer::Target *target = m_project->activeTarget();
        version = QtSupport::QtKitInformation::qtVersion(target->kit());
    }
    return version ? version->uicCommand() : QString();
}
QString QmlProjectRunConfiguration::observerPath() const
{
    QtSupport::BaseQtVersion *version = qtVersion();
    if (!version) {
        return QString();
    } else {
        if (!version->needsQmlDebuggingLibrary())
            return version->qmlviewerCommand();
        return version->qmlObserverTool();
    }
}
Example #19
0
///
/// moreArguments,
/// -unix for Maemo
/// QMAKE_VAR_QMLJSDEBUGGER_PATH
QStringList QMakeStep::deducedArguments()
{
    QStringList arguments;
    ProjectExplorer::ToolChain *tc
            = ProjectExplorer::ToolChainProfileInformation::toolChain(target()->profile());
    ProjectExplorer::Abi targetAbi;
    if (tc)
        targetAbi = tc->targetAbi();
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
    if ((targetAbi.osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor
               || targetAbi.osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor))
        arguments << QLatin1String("-unix");
#endif

    // explicitly add architecture to CONFIG
    if ((targetAbi.os() == ProjectExplorer::Abi::MacOS)
            && (targetAbi.binaryFormat() == ProjectExplorer::Abi::MachOFormat)) {
        if (targetAbi.architecture() == ProjectExplorer::Abi::X86Architecture) {
            if (targetAbi.wordWidth() == 32)
                arguments << QLatin1String("CONFIG+=x86");
            else if (targetAbi.wordWidth() == 64)
                arguments << QLatin1String("CONFIG+=x86_64");
        } else if (targetAbi.architecture() == ProjectExplorer::Abi::PowerPCArchitecture) {
            if (targetAbi.wordWidth() == 32)
                arguments << QLatin1String("CONFIG+=ppc");
            else if (targetAbi.wordWidth() == 64)
                arguments << QLatin1String("CONFIG+=ppc64");
        }
    }

    QtSupport::BaseQtVersion *version = QtSupport::QtProfileInformation::qtVersion(target()->profile());
    if (linkQmlDebuggingLibrary() && version) {
        if (!version->needsQmlDebuggingLibrary()) {
            // This Qt version has the QML debugging services built in, however
            // they still need to be enabled at compile time
            arguments << (version->qtVersion().majorVersion >= 5 ?
                          QLatin1String(Constants::QMAKEVAR_DECLARATIVE_DEBUG5) :
                          QLatin1String(Constants::QMAKEVAR_DECLARATIVE_DEBUG4));
        } else {
            const QString qmlDebuggingHelperLibrary = version->qmlDebuggingHelperLibrary(true);
            if (!qmlDebuggingHelperLibrary.isEmpty()) {
                // Do not turn debugger path into native path separators: Qmake does not like that!
                const QString debuggingHelperPath
                        = QFileInfo(qmlDebuggingHelperLibrary).dir().path();

                arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)
                             + QLatin1Char('=') + debuggingHelperPath;
            }
        }
    }


    return arguments;
}
QList<BuildInfo *> QmakeBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
{
    QList<ProjectExplorer::BuildInfo *> result;
    QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k);
    if (!qtVersion || !qtVersion->isValid())
        return result;
    result << createBuildInfo(k, projectPath, ProjectExplorer::BuildConfiguration::Debug);
    result << createBuildInfo(k, projectPath, ProjectExplorer::BuildConfiguration::Profile);
    result << createBuildInfo(k, projectPath, ProjectExplorer::BuildConfiguration::Release);
    return result;
}
Utils::FileName QmakeAndroidSupport::androiddeployqtPath(const ProjectExplorer::Target *target) const
{
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
    if (!version)
        return Utils::FileName();

    QString command = version->qmakeProperty("QT_HOST_BINS");
    if (!command.endsWith(QLatin1Char('/')))
        command += QLatin1Char('/');
    command += Utils::HostOsInfo::withExecutableSuffix(QLatin1String("androiddeployqt"));
    return Utils::FileName::fromString(command);
}
QString CreateAndroidManifestWizard::sourceFileName() const
{
    QString result;
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit());
    if (!version)
        return result;
    Utils::FileName srcPath
            = Utils::FileName::fromString(version->qmakeProperty("QT_INSTALL_PREFIX"))
            .appendPath(QLatin1String("src/android/java"));
    srcPath.appendPath(QLatin1String("AndroidManifest.xml"));
    return srcPath.toString();
}
QList<Core::Id> AndroidDeployQtStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
{
    if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
        return QList<Core::Id>();
    if (!AndroidManager::supportsAndroid(parent->target()))
        return QList<Core::Id>();
    if (parent->contains(AndroidDeployQtStep::Id))
        return QList<Core::Id>();
    QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(parent->target()->kit());
    if (!qtVersion || qtVersion->qtVersion() < QtSupport::QtVersionNumber(5, 2, 0))
        return QList<Core::Id>();
    return QList<Core::Id>() << AndroidDeployQtStep::Id;
}
Example #24
0
bool PuppetCreator::qtIsSupported() const
{
    QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitInformation::qtVersion(m_kit);

    if (currentQtVersion
            && currentQtVersion->isValid()
            && currentQtVersion->qtVersion() >= QtSupport::QtVersionNumber(5, 2, 0)
            && (currentQtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT)
                || currentQtVersion->type() == QLatin1String(QtSupport::Constants::SIMULATORQT)))
        return true;

    return false;
}
bool MaemoDebianPackageCreationStep::init()
{
    if (!AbstractMaemoPackageCreationStep::init())
        return false;
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
    m_maddeRoot = MaemoGlobal::maddeRoot(version->qmakeCommand().toString());
    m_projectDirectory = project()->projectDirectory();
    m_pkgFileName = DebianManager::packageFileName(DebianManager::debianDirectory(target())).toString();
    m_packageName = DebianManager::packageName(DebianManager::debianDirectory(target()));
    m_templatesDirPath = DebianManager::debianDirectory(target()).toString();
    m_debugBuild = qt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
    checkProjectName();
    return true;
}
Example #26
0
Utils::FileName UicGenerator::command() const
{
    QtSupport::BaseQtVersion *version = nullptr;
    Target *target;
    if ((target = project()->activeTarget()))
        version = QtSupport::QtKitInformation::qtVersion(target->kit());
    else
        version = QtSupport::QtKitInformation::qtVersion(KitManager::defaultKit());

    if (!version)
        return Utils::FileName();

    return Utils::FileName::fromString(version->uicCommand());
}
QList<Task> QmakeKitInformation::validate(const Kit *k) const
{
    QList<Task> result;
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);

    FileName mkspec = QmakeKitInformation::mkspec(k);
    if (!version && !mkspec.isEmpty())
        result << Task(Task::Warning, tr("No Qt version set, so mkspec is ignored."),
                       FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
    if (version && !version->hasMkspec(mkspec))
        result << Task(Task::Error, tr("Mkspec not found for Qt version."),
                       FileName(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
    return result;
}
IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp,
    RunConfiguration *runConfiguration)
{
    QmlProfilerEngine *engine = new QmlProfilerEngine(this, sp, runConfiguration);

    engine->registerProfilerStateManager(d->m_profilerState);

    bool isTcpConnection = true;

    if (runConfiguration) {
        // Check minimum Qt Version. We cannot really be sure what the Qt version
        // at runtime is, but guess that the active build configuraiton has been used.
        QtSupport::QtVersionNumber minimumVersion(4, 7, 4);
        QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(runConfiguration->target()->kit());
        if (version) {
            if (version->isValid() && version->qtVersion() < minimumVersion) {
                int result = QMessageBox::warning(QApplication::activeWindow(), tr("QML Profiler"),
                     tr("The QML profiler requires Qt 4.7.4 or newer.\n"
                     "The Qt version configured in your active build configuration is too old.\n"
                     "Do you want to continue?"), QMessageBox::Yes, QMessageBox::No);
                if (result == QMessageBox::No)
                    return 0;
            }
        }
    }

    // FIXME: Check that there's something sensible in sp.connParams
    if (isTcpConnection) {
        d->m_profilerConnections->setTcpConnection(sp.connParams.host, sp.connParams.port);
    }

    d->m_runConfiguration = runConfiguration;

    //
    // Initialize m_projectFinder
    //

    QString projectDirectory;
    if (d->m_runConfiguration) {
        Project *project = d->m_runConfiguration->target()->project();
        projectDirectory = project->projectDirectory();
    }

    populateFileFinder(projectDirectory, sp.sysroot);

    connect(engine, SIGNAL(processRunning(quint16)), d->m_profilerConnections, SLOT(connectClient(quint16)));
    connect(d->m_profilerConnections, SIGNAL(connectionFailed()), engine, SLOT(cancelProcess()));

    return engine;
}
Example #29
0
/*!
    Returns the minimum Android API level required by the kit to compile. -1 is
    returned if the kit does not support Android.
*/
int AndroidManager::minimumSDK(const ProjectExplorer::Kit *kit)
{
    int minSDKVersion = -1;
    QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
    if (version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE)) {
        Utils::FileName stockManifestFilePath =
                Utils::FileName::fromUserInput(version->qmakeProperty("QT_INSTALL_PREFIX") +
                                               QLatin1String("/src/android/templates/AndroidManifest.xml"));
        QDomDocument doc;
        if (openXmlFile(doc, stockManifestFilePath)) {
            minSDKVersion = parseMinSdk(doc.documentElement());
        }
    }
    return minSDKVersion;
}
Example #30
0
PortList MaemoGlobal::freePorts(const Kit *k)
{
    IDevice::ConstPtr device = DeviceKitInformation::device(k);
    QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(k);

    if (!device || !qtVersion)
        return PortList();
    if (device->machineType() == IDevice::Emulator) {
        MaemoQemuRuntime rt;
        const int id = qtVersion->uniqueId();
        if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt))
            return rt.m_freePorts;
    }
    return device->freePorts();
}