/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #include "desktopqmakerunconfiguration.h" #include "qmakeprojectmanagerconstants.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace ProjectExplorer; using namespace Utils; namespace QmakeProjectManager { namespace Internal { // // DesktopQmakeRunConfiguration // DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target, Core::Id id) : RunConfiguration(target, id) { auto envAspect = addAspect(target); envAspect->addModifier([this](Environment &env) { BuildTargetInfo bti = buildTargetInfo(); if (bti.runEnvModifier) bti.runEnvModifier(env, aspect()->value()); }); addAspect(); addAspect(); addAspect(); addAspect(); setOutputFormatter(); auto libAspect = addAspect(); connect(libAspect, &UseLibraryPathsAspect::changed, envAspect, &EnvironmentAspect::environmentChanged); if (HostOsInfo::isMacHost()) { auto dyldAspect = addAspect(); connect(dyldAspect, &UseLibraryPathsAspect::changed, envAspect, &EnvironmentAspect::environmentChanged); envAspect->addModifier([dyldAspect](Environment &env) { if (dyldAspect->value()) env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug")); }); } connect(target->project(), &Project::parsingFinished, this, &DesktopQmakeRunConfiguration::updateTargetInformation); } void DesktopQmakeRunConfiguration::updateTargetInformation() { setDefaultDisplayName(defaultDisplayName()); aspect()->buildEnvironmentHasChanged(); BuildTargetInfo bti = buildTargetInfo(); auto wda = aspect(); wda->setDefaultWorkingDirectory(bti.workingDirectory); if (wda->pathChooser()) wda->pathChooser()->setBaseFileName(target()->project()->projectDirectory()); auto terminalAspect = aspect(); terminalAspect->setUseTerminalHint(bti.usesTerminal); aspect()->setExecutable(bti.targetFilePath); } bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map) { if (!RunConfiguration::fromMap(map)) return false; updateTargetInformation(); return true; } void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &) { updateTargetInformation(); } FilePath DesktopQmakeRunConfiguration::proFilePath() const { return FilePath::fromString(buildKey()); } QString DesktopQmakeRunConfiguration::defaultDisplayName() { FilePath profile = proFilePath(); if (!profile.isEmpty()) return profile.toFileInfo().completeBaseName(); return tr("Qt Run Configuration"); } // // DesktopQmakeRunConfigurationFactory // DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory() { registerRunConfiguration("Qt4ProjectManager.Qt4RunConfiguration:"); addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); } } // namespace Internal } // namespace QmakeProjectManager