本文整理汇总了C++中utils::Environment::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Environment::set方法的具体用法?C++ Environment::set怎么用?C++ Environment::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils::Environment
的用法示例。
在下文中一共展示了Environment::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processEnvironment
QProcessEnvironment PuppetCreator::processEnvironment() const
{
Utils::Environment environment = Utils::Environment::systemEnvironment();
m_kit->addToEnvironment(environment);
environment.set("QML_BAD_GUI_RENDER_LOOP", "true");
environment.set("QML_USE_MOCKUPS", "true");
return environment.toProcessEnvironment();
}
示例2: addToEnvironment
void SymbianQtVersion::addToEnvironment(const ProjectExplorer::Profile *p, Utils::Environment &env) const
{
BaseQtVersion::addToEnvironment(p, env);
// Generic Symbian environment:
QString epocRootPath = ProjectExplorer::SysRootProfileInformation::sysRoot(p).toString();
QDir epocDir(epocRootPath);
// Clean up epoc root path for the environment:
if (!epocRootPath.endsWith(QLatin1Char('/')))
epocRootPath.append(QLatin1Char('/'));
if (!isBuildWithSymbianSbsV2()) {
#ifdef Q_OS_WIN
if (epocRootPath.count() > 2
&& epocRootPath.at(0).toLower() >= QLatin1Char('a')
&& epocRootPath.at(0).toLower() <= QLatin1Char('z')
&& epocRootPath.at(1) == QLatin1Char(':')) {
epocRootPath = epocRootPath.mid(2);
}
#endif
}
env.set(QLatin1String("EPOCROOT"), QDir::toNativeSeparators(epocRootPath));
env.prependOrSetPath(epocDir.filePath(QLatin1String("epoc32/tools"))); // e.g. make.exe
// Windows only:
if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) {
QString winDir = QLatin1String(qgetenv("WINDIR"));
if (!winDir.isEmpty())
env.prependOrSetPath(QDir(winDir).filePath(QLatin1String("system32")));
if (epocDir.exists(QLatin1String("epoc32/gcc/bin")))
env.prependOrSetPath(epocDir.filePath(QLatin1String("epoc32/gcc/bin"))); // e.g. cpp.exe, *NOT* gcc.exe
// Find perl in the special Symbian flavour:
if (epocDir.exists(QLatin1String("../../tools/perl/bin"))) {
epocDir.cd(QLatin1String("../../tools/perl/bin"));
env.prependOrSetPath(epocDir.absolutePath());
} else {
env.prependOrSetPath(epocDir.filePath(QLatin1String("perl/bin")));
}
}
// SBSv2:
if (isBuildWithSymbianSbsV2()) {
QString sbsHome(env.value(QLatin1String("SBS_HOME")));
QString sbsConfig = sbsV2Directory();
if (!sbsConfig.isEmpty()) {
env.prependOrSetPath(sbsConfig);
// SBS_HOME is the path minus the trailing /bin:
env.set(QLatin1String("SBS_HOME"),
QDir::toNativeSeparators(sbsConfig.left(sbsConfig.count() - 4))); // We need this for Qt 4.6.3 compatibility
} else if (!sbsHome.isEmpty()) {
env.prependOrSetPath(sbsHome + QLatin1String("/bin"));
}
}
}
示例3: init
bool DMakeStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
m_tasks.clear();
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ToolChain::Language::Cxx);
if (!tc) {
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
return true; // otherwise the tasks will not get reported
}
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommand(makeCommand(bc->environment()));
pp->setArguments(allArguments());
pp->resolveAll();
setOutputParser(new GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init(earlierSteps);
}
示例4: init
bool AndroidPackageInstallationStep::init()
{
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
QString dirPath = bc->buildDirectory().appendPath(QLatin1String(Constants::ANDROID_BUILDDIRECTORY)).toString();
if (Utils::HostOsInfo::isWindowsHost())
if (bc->environment().searchInPath(QLatin1String("sh.exe")).isEmpty())
dirPath = QDir::toNativeSeparators(dirPath);
ProjectExplorer::ToolChain *tc
= ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
ProjectExplorer::ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
pp->setCommand(tc->makeCommand(bc->environment()));
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setArguments(QString::fromLatin1("INSTALL_ROOT=\"%1\" install").arg(dirPath));
pp->resolveAll();
setOutputParser(new ProjectExplorer::GnuMakeParser());
ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
m_androidDirToClean = dirPath;
return AbstractProcessStep::init();
}
示例5: readEnvironmentSetting
Utils::Environment MsvcToolChain::readEnvironmentSetting(Utils::Environment& env) const
{
Utils::Environment result = env;
if (!QFileInfo::exists(m_vcvarsBat))
return result;
QMap<QString, QString> envPairs;
if (!generateEnvironmentSettings(env, m_vcvarsBat, m_varsBatArg, envPairs))
return result;
// Now loop through and process them
QMap<QString,QString>::const_iterator envIter;
for (envIter = envPairs.constBegin(); envIter!=envPairs.constEnd(); ++envIter) {
const QString expandedValue = winExpandDelayedEnvReferences(envIter.value(), env);
if (!expandedValue.isEmpty())
result.set(envIter.key(), expandedValue);
}
if (debug) {
const QStringList newVars = result.toStringList();
const QStringList oldVars = env.toStringList();
QDebug nsp = qDebug().nospace();
foreach (const QString &n, newVars) {
if (!oldVars.contains(n))
nsp << n << '\n';
}
}
return result;
}
示例6: CertificatesModel
// Note this functions is duplicated between AndroidDeployStep and AndroidDeployQtStep
// since it does modify the stored password in AndroidDeployQtStep it's not easily
// extractable. The situation will clean itself up once AndroidDeployStep is no longer
// necessary
QAbstractItemModel *AndroidDeployQtStep::keystoreCertificates()
{
QString rawCerts;
QProcess keytoolProc;
while (!rawCerts.length() || !m_keystorePasswd.length()) {
QStringList params;
params << QLatin1String("-list") << QLatin1String("-v") << QLatin1String("-keystore") << m_keystorePath.toUserOutput() << QLatin1String("-storepass");
if (!m_keystorePasswd.length())
keystorePassword();
if (!m_keystorePasswd.length())
return 0;
params << m_keystorePasswd;
Utils::Environment env = Utils::Environment::systemEnvironment();
env.set(QLatin1String("LANG"), QLatin1String("C"));
keytoolProc.setProcessEnvironment(env.toProcessEnvironment());
keytoolProc.start(AndroidConfigurations::instance().keytoolPath().toString(), params);
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
QMessageBox::critical(0, tr("Error"),
tr("Failed to run keytool"));
return 0;
}
if (keytoolProc.exitCode()) {
QMessageBox::critical(0, tr("Error"),
tr("Invalid password"));
m_keystorePasswd.clear();
}
rawCerts = QString::fromLatin1(keytoolProc.readAllStandardOutput());
}
return new CertificatesModel(rawCerts, this);
}
示例7: init
bool IosPresetBuildStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommand(command());
pp->setArguments(Utils::QtcProcess::joinArgs(arguments()));
pp->resolveAll();
// If we are cleaning, then build can fail with an error code, but that doesn't mean
// we should stop the clean queue
// That is mostly so that rebuild works on an already clean project
setIgnoreReturnValue(m_clean);
setOutputParser(target()->kit()->createOutputParser());
if (outputParser())
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init(earlierSteps);
}
示例8: init
bool MakeStep::init()
{
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
if (!bc)
bc = targetsActiveBuildConfiguration();
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!bc || !tc) {
emitFaultyConfigurationMessage();
return false;
}
m_useNinja = bc->useNinja();
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
Utils::QtcProcess::addArgs(&arguments, additionalArguments());
setIgnoreReturnValue(m_clean);
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
if (m_useNinja && !env.value(QLatin1String("NINJA_STATUS")).startsWith(m_ninjaProgressString))
env.set(QLatin1String("NINJA_STATUS"), m_ninjaProgressString + QLatin1String("%o/sec] "));
pp->setEnvironment(env);
pp->setWorkingDirectory(bc->buildDirectory().toString());
pp->setCommand(makeCommand(tc, bc->environment()));
pp->setArguments(arguments);
pp->resolveAll();
setOutputParser(new CMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
}
示例9: addToEnvironment
void AndroidQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const
{
// this env vars are used by qmake mkspecs to generate makefiles (check QTDIR/mkspecs/android-g++/qmake.conf for more info)
env.set(QLatin1String("ANDROID_NDK_HOST"), AndroidConfigurations::currentConfig().toolchainHost());
env.set(QLatin1String("ANDROID_NDK_ROOT"), AndroidConfigurations::currentConfig().ndkLocation().toUserOutput());
Project *project = ProjectExplorerPlugin::instance()->currentProject();
if (!project || !project->activeTarget()
|| QtSupport::QtKitInformation::qtVersion(k)->type() != QLatin1String(Constants::ANDROIDQT))
return;
Target *target = project->activeTarget();
if (DeviceTypeKitInformation::deviceTypeId(target->kit()) != Constants::ANDROID_DEVICE_TYPE)
return;
if (AndroidConfigurations::currentConfig().ndkLocation().isEmpty()
|| AndroidConfigurations::currentConfig().sdkLocation().isEmpty())
return;
env.set(QLatin1String("ANDROID_NDK_PLATFORM"),
AndroidConfigurations::currentConfig().bestNdkPlatformMatch(AndroidManager::minimumSDK(target)));
}
示例10: updateDetails
void MakeStepConfigWidget::updateDetails()
{
ToolChain *tc
= ToolChainKitInformation::toolChain(m_makeStep->target()->kit());
QmakeBuildConfiguration *bc = m_makeStep->qmakeBuildConfiguration();
if (!bc)
bc = qobject_cast<QmakeBuildConfiguration *>(m_makeStep->target()->activeBuildConfiguration());
if (tc && bc)
m_ui->makeLabel->setText(tr("Override %1:").arg(QDir::toNativeSeparators(tc->makeCommand(bc->environment()))));
else
m_ui->makeLabel->setText(tr("Make:"));
if (!tc) {
setSummaryText(tr("<b>Make:</b> %1").arg(ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget()));
return;
}
if (!bc) {
setSummaryText(tr("<b>Make:</b> No Qt build configuration."));
return;
}
ProcessParameters param;
param.setMacroExpander(bc->macroExpander());
param.setWorkingDirectory(bc->buildDirectory().toString());
QString makeCmd = tc->makeCommand(bc->environment());
if (!m_makeStep->makeCommand().isEmpty())
makeCmd = m_makeStep->makeCommand();
param.setCommand(makeCmd);
QString args = m_makeStep->userArguments();
Utils::Environment env = bc->environment();
Utils::Environment::setupEnglishOutput(&env);
// We prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
// FIXME doing this without the user having a way to override this is rather bad
if (tc && m_makeStep->makeCommand().isEmpty()) {
if (tc->targetAbi().os() == Abi::WindowsOS
&& tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor) {
const QString makeFlags = QLatin1String("MAKEFLAGS");
env.set(makeFlags, QLatin1Char('L') + env.value(makeFlags));
}
}
param.setArguments(args);
param.setEnvironment(env);
if (param.commandMissing())
setSummaryText(tr("<b>Make:</b> %1 not found in the environment.").arg(makeCmd)); // Override display text
else
setSummaryText(param.summaryInWorkdir(displayName()));
}
示例11: init
bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!tc || !bc) {
emitFaultyConfigurationMessage();
return false;
}
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
Utils::QtcProcess::addArgs(&arguments, additionalArguments());
setIgnoreReturnValue(m_clean);
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setWorkingDirectory(bc->buildDirectory().toString());
pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make"));
pp->setArguments(arguments);
pp->resolveAll();
setOutputParser(new GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init(earlierSteps);
}
示例12: init
bool IosBuildStep::init()
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!bc || !tc) {
emitFaultyConfigurationMessage();
return false;
}
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommand(buildCommand());
pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
pp->resolveAll();
// If we are cleaning, then build can fail with an error code, but that doesn't mean
// we should stop the clean queue
// That is mostly so that rebuild works on an already clean project
setIgnoreReturnValue(m_clean);
setOutputParser(new GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
}
示例13: init
bool IosBuildStep::init()
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
Task t = Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit preferences."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(t);
emit addOutput(tr("Configuration is faulty. Check the Issues output pane for details."),
BuildStep::MessageOutput);
return false;
}
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommand(buildCommand());
pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
pp->resolveAll();
// If we are cleaning, then build can fail with an error code, but that doesn't mean
// we should stop the clean queue
// That is mostly so that rebuild works on an already clean project
setIgnoreReturnValue(m_clean);
setOutputParser(new GnuMakeParser());
IOutputParser *parser = target()->kit()->createOutputParser();
if (parser)
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
}
示例14: init
bool MakeStep::init()
{
AutotoolsBuildConfiguration *bc = autotoolsBuildConfiguration();
if (!bc)
bc = static_cast<AutotoolsBuildConfiguration *>(target()->activeBuildConfiguration());
m_tasks.clear();
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
return true; // otherwise the tasks will not get reported
}
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
Utils::QtcProcess::addArgs(&arguments, additionalArguments());
setIgnoreReturnValue(m_clean);
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
Utils::Environment env = bc->environment();
// Force output to english for the parsers. Do this here and not in the toolchain's
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setWorkingDirectory(bc->buildDirectory());
pp->setCommand(tc ? tc->makeCommand(bc->environment()) : QLatin1String("make"));
pp->setArguments(arguments);
setOutputParser(new GnuMakeParser());
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
if (version)
appendOutputParser(new QtSupport::QtParser);
if (tc)
appendOutputParser(tc->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
}
示例15: addToEnvironment
void AndroidQmakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const
{
m_androidNdkPlatform = AndroidConfigurations::currentConfig().bestNdkPlatformMatch(AndroidManager::minimumSDK(target()));
env.set(QLatin1String("ANDROID_NDK_PLATFORM"), m_androidNdkPlatform);
}