当前位置: 首页>>代码示例>>C++>>正文


C++ QmakeProFileNode::targetInformation方法代码示例

本文整理汇总了C++中QmakeProFileNode::targetInformation方法的典型用法代码示例。如果您正苦于以下问题:C++ QmakeProFileNode::targetInformation方法的具体用法?C++ QmakeProFileNode::targetInformation怎么用?C++ QmakeProFileNode::targetInformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QmakeProFileNode的用法示例。


在下文中一共展示了QmakeProFileNode::targetInformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: snippet

QString InternalLibraryDetailsController::snippet() const
{
    const int currentIndex = libraryDetailsWidget()->libraryComboBox->currentIndex();

    if (currentIndex < 0)
        return QString();

    if (m_rootProjectPath.isEmpty())
        return QString();


    // dir of the root project
    QDir rootDir(m_rootProjectPath);

    // relative path for the project for which we insert the snippet,
    // it's relative to the root project
    const QString proRelavitePath = rootDir.relativeFilePath(proFile());

    // project for which we insert the snippet
    const Project *project = SessionManager::projectForFile(proFile());

    // the build directory of the active build configuration
    QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
    if (ProjectExplorer::Target *t = project->activeTarget())
        if (ProjectExplorer::BuildConfiguration *bc = t->activeBuildConfiguration())
            rootBuildDir = bc->buildDirectory().toString();

    // the project for which we insert the snippet inside build tree
    QFileInfo pfi(rootBuildDir.filePath(proRelavitePath));
    // the project dir for which we insert the snippet inside build tree
    QDir projectBuildDir(pfi.absolutePath());

    // current project node from combobox
    QFileInfo fi(proFile());
    QDir projectSrcDir(fi.absolutePath());

    // project node which we want to link against
    QmakeProFileNode *proFileNode = m_proFileNodes.at(currentIndex);
    TargetInformation targetInfo = proFileNode->targetInformation();

    const QString targetRelativePath = appendSeparator(projectBuildDir.relativeFilePath(targetInfo.buildDir));
    const QString includeRelativePath = projectSrcDir.relativeFilePath(libraryDetailsWidget()->includePathChooser->path());

    const bool useSubfolders = libraryDetailsWidget()->useSubfoldersCheckBox->isChecked();
    const bool addSuffix = libraryDetailsWidget()->addSuffixCheckBox->isChecked();

    QString snippetMessage;
    QTextStream str(&snippetMessage);
    str << "\n";

    // replace below to "PRI_OUT_PWD" when task QTBUG-13057 is done
    // (end enable adding libraries into .pri files as well).
    const QString outPwd = QLatin1String("OUT_PWD");
    str << generateLibsSnippet(platforms(), macLibraryType(), targetInfo.target,
                               targetRelativePath, outPwd,
                               useSubfolders, addSuffix, true);
    str << generateIncludePathSnippet(includeRelativePath);
    str << generatePreTargetDepsSnippet(platforms(), linkageType(), targetInfo.target,
                               targetRelativePath, outPwd,
                               useSubfolders, addSuffix);
    return snippetMessage;
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:62,代码来源:librarydetailscontroller.cpp


注:本文中的QmakeProFileNode::targetInformation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。