本文整理汇总了C++中projectexplorer::ToolChain::type方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolChain::type方法的具体用法?C++ ToolChain::type怎么用?C++ ToolChain::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类projectexplorer::ToolChain
的用法示例。
在下文中一共展示了ToolChain::type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateDetails
void MakeStepConfigWidget::updateDetails()
{
Qt4Project *pro = static_cast<Qt4Project *>(m_makeStep->project());
ProjectExplorer::BuildConfiguration *bc = pro->buildConfiguration(m_buildConfiguration);
QString workingDirectory = pro->buildDirectory(bc);
QString makeCmd = pro->makeCommand(bc);
if (!m_makeStep->value(m_buildConfiguration, "makeCmd").toString().isEmpty())
makeCmd = m_makeStep->value(m_buildConfiguration, "makeCmd").toString();
if (!QFileInfo(makeCmd).isAbsolute()) {
Environment environment = pro->environment(bc);
// Try to detect command in environment
QString tmp = environment.searchInPath(makeCmd);
if (tmp == QString::null) {
m_summaryText = tr("<b>Make Step:</b> %1 not found in the environment.").arg(makeCmd);
emit updateSummary();
return;
}
makeCmd = tmp;
}
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
// absolute file path
// FIXME doing this without the user having a way to override this is rather bad
// so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change
QStringList args = m_makeStep->value(m_buildConfiguration, "makeargs").toStringList();
ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN;
ProjectExplorer::ToolChain *toolChain = pro->toolChain(bc);
if (toolChain)
t = toolChain->type();
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {
if (m_makeStep->value(m_buildConfiguration, "makeCmd").toString().isEmpty())
args << "-w";
}
m_summaryText = tr("<b>Make:</b> %1 %2 in %3").arg(QFileInfo(makeCmd).fileName(), args.join(" "),
QDir::toNativeSeparators(workingDirectory));
emit updateSummary();
}
示例2: addProfileFromKit
void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{
QStringList usedProfileNames = profileNames();
const QString name = ProjectExplorer::Project::makeUnique(
QString::fromLatin1("qtc_") + k->fileSystemFriendlyName(), usedProfileNames);
setProfileForKit(name, k);
QVariantMap data;
QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(k);
if (qt) {
data.insert(QLatin1String(QTCORE_BINPATH), qt->binPath().toUserOutput());
QStringList builds;
if (qt->hasDebugBuild())
builds << QLatin1String("debug");
if (qt->hasReleaseBuild())
builds << QLatin1String("release");
data.insert(QLatin1String(QTCORE_BUILDVARIANT), builds);
data.insert(QLatin1String(QTCORE_DOCPATH), qt->docsPath().toUserOutput());
data.insert(QLatin1String(QTCORE_INCPATH), qt->headerPath().toUserOutput());
data.insert(QLatin1String(QTCORE_LIBPATH), qt->libraryPath().toUserOutput());
Utils::FileName mkspecPath = qt->mkspecsPath();
mkspecPath.appendPath(qt->mkspec().toString());
data.insert(QLatin1String(QTCORE_MKSPEC), mkspecPath.toUserOutput());
data.insert(QLatin1String(QTCORE_NAMESPACE), qt->qtNamespace());
data.insert(QLatin1String(QTCORE_LIBINFIX), qt->qtLibInfix());
data.insert(QLatin1String(QTCORE_VERSION), qt->qtVersionString());
if (qt->isFrameworkBuild())
data.insert(QLatin1String(QTCORE_FRAMEWORKBUILD), true);
}
if (ProjectExplorer::SysRootKitInformation::hasSysRoot(k))
data.insert(QLatin1String(QBS_SYSROOT), ProjectExplorer::SysRootKitInformation::sysRoot(k).toUserOutput());
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
if (tc) {
// FIXME/CLARIFY: How to pass the sysroot?
ProjectExplorer::Abi targetAbi = tc->targetAbi();
QString architecture = ProjectExplorer::Abi::toString(targetAbi.architecture());
if (targetAbi.wordWidth() == 64)
architecture.append(QLatin1String("_64"));
data.insert(QLatin1String(QBS_ARCHITECTURE), architecture);
if (targetAbi.endianness() == ProjectExplorer::Abi::BigEndian)
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("big"));
else
data.insert(QLatin1String(QBS_ENDIANNESS), QLatin1String("little"));
if (targetAbi.os() == ProjectExplorer::Abi::WindowsOS) {
data.insert(QLatin1String(QBS_TARGETOS), QLatin1String("windows"));
data.insert(QLatin1String(QBS_TOOLCHAIN),
targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor
? QStringList() << QLatin1String("mingw") << QLatin1String("gcc")
: QStringList() << QLatin1String("msvc"));
} else if (targetAbi.os() == ProjectExplorer::Abi::MacOS) {
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("osx")
<< QLatin1String("darwin") << QLatin1String("unix"));
if (tc->type() != QLatin1String("clang")) {
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
} else {
data.insert(QLatin1String(QBS_TOOLCHAIN),
QStringList() << QLatin1String("clang")
<< QLatin1String("llvm")
<< QLatin1String("gcc"));
}
} else if (targetAbi.os() == ProjectExplorer::Abi::LinuxOS) {
data.insert(QLatin1String(QBS_TARGETOS), QStringList() << QLatin1String("linux")
<< QLatin1String("unix"));
if (tc->type() != QLatin1String("clang")) {
data.insert(QLatin1String(QBS_TOOLCHAIN), QLatin1String("gcc"));
} else {
data.insert(QLatin1String(QBS_TOOLCHAIN),
QStringList() << QLatin1String("clang")
<< QLatin1String("llvm")
<< QLatin1String("gcc"));
}
}
Utils::FileName cxx = tc->compilerCommand();
data.insert(QLatin1String(CPP_TOOLCHAINPATH), cxx.toFileInfo().absolutePath());
data.insert(QLatin1String(CPP_COMPILERNAME), cxx.toFileInfo().fileName());
}
addProfile(name, data);
}
示例3: init
bool MakeStep::init(const QString &name)
{
m_buildConfiguration = name;
ProjectExplorer::BuildConfiguration *bc = project()->buildConfiguration(name);
Environment environment = project()->environment(bc);
setEnvironment(name, environment);
Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
QString workingDirectory = qt4project->buildDirectory(bc);
setWorkingDirectory(name, workingDirectory);
QString makeCmd = qt4project->makeCommand(bc);
if (!value(name, "makeCmd").toString().isEmpty())
makeCmd = value(name, "makeCmd").toString();
if (!QFileInfo(makeCmd).isAbsolute()) {
// Try to detect command in environment
QString tmp = environment.searchInPath(makeCmd);
if (tmp == QString::null) {
emit addToOutputWindow(tr("<font color=\"#ff0000\">Could not find make command: %1 "\
"in the build environment</font>").arg(makeCmd));
return false;
}
makeCmd = tmp;
}
setCommand(name, makeCmd);
if (!value(name, "cleanConfig").isValid() && value("clean").isValid() && value("clean").toBool()) {
// Import old settings
setValue(name, "cleanConfig", true);
setValue(name, "makeargs", QStringList() << "clean");
}
// If we are cleaning, then make can fail with a error code, but that doesn't mean
// we should stop the clean queue
// That is mostly so that rebuild works on a alrady clean project
setIgnoreReturnValue(name, value(name, "cleanConfig").isValid());
QStringList args = value(name, "makeargs").toStringList();
if (!value(name, "cleanConfig").isValid()) {
if (!qt4project->defaultMakeTarget(bc).isEmpty())
args << qt4project->defaultMakeTarget(bc);
}
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
// absolute file path
// FIXME doing this without the user having a way to override this is rather bad
// so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change
ProjectExplorer::ToolChain *toolchain = qt4project->toolChain(bc);
ProjectExplorer::ToolChain::ToolChainType type = ProjectExplorer::ToolChain::UNKNOWN;
if (toolchain)
type = toolchain->type();
if (type != ProjectExplorer::ToolChain::MSVC && type != ProjectExplorer::ToolChain::WINCE) {
if (value(name, "makeCmd").toString().isEmpty())
args << "-w";
}
setEnabled(name, true);
setArguments(name, args);
if (type == ProjectExplorer::ToolChain::MSVC || type == ProjectExplorer::ToolChain::WINCE)
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_MSVC);
else
setBuildParser(ProjectExplorer::Constants::BUILD_PARSER_GCC);
return AbstractMakeStep::init(name);
}
示例4: init
bool MakeStep::init()
{
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
Environment environment = bc->environment();
setEnvironment(environment);
QString workingDirectory;
if (bc->subNodeBuild())
workingDirectory = bc->subNodeBuild()->buildDir();
else
workingDirectory = bc->buildDirectory();
setWorkingDirectory(workingDirectory);
QString makeCmd = bc->makeCommand();
if (!m_makeCmd.isEmpty())
makeCmd = m_makeCmd;
if (!QFileInfo(makeCmd).isAbsolute()) {
// Try to detect command in environment
const QString tmp = environment.searchInPath(makeCmd);
if (tmp.isEmpty()) {
QTextCharFormat textCharFormat;
textCharFormat.setForeground(Qt::red);
emit addOutput(tr("Could not find make command: %1 in the build environment").arg(makeCmd), textCharFormat);
return false;
}
makeCmd = tmp;
}
setCommand(makeCmd);
// If we are cleaning, then make can fail with a error code, but that doesn't mean
// we should stop the clean queue
// That is mostly so that rebuild works on a already clean project
setIgnoreReturnValue(m_clean);
QStringList args = m_userArgs;
if (!m_clean) {
if (!bc->defaultMakeTarget().isEmpty())
args << bc->defaultMakeTarget();
}
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
// absolute file path
// FIXME doing this without the user having a way to override this is rather bad
// so we only do it for unix and if the user didn't override the make command
// but for now this is the least invasive change
ProjectExplorer::ToolChain *toolchain = bc->toolChain();
if (toolchain) {
if (toolchain->type() != ProjectExplorer::ToolChain::MSVC &&
toolchain->type() != ProjectExplorer::ToolChain::WINCE) {
if (m_makeCmd.isEmpty())
args << "-w";
}
}
setEnabled(true);
setArguments(args);
setOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory));
if (toolchain)
appendOutputParser(toolchain->outputParser());
return AbstractProcessStep::init();
}