1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
// Copyright (C) 2020 Alexis Jeandet.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "mesonrunconfiguration.h"
#include "mesonpluginconstants.h"
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
#include <utils/hostosinfo.h>
#include <debugger/debuggerruncontrol.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace MesonProjectManager::Internal {
class MesonRunConfiguration final : public RunConfiguration
{
public:
MesonRunConfiguration(BuildConfiguration *bc, Id id)
: RunConfiguration(bc, id)
{
environment.setSupportForBuildEnvironment(bc);
executable.setDeviceSelector(kit(), ExecutableAspect::RunDevice);
workingDir.setEnvironment(&environment);
connect(&useLibraryPaths, &BaseAspect::changed,
&environment, &EnvironmentAspect::environmentChanged);
if (HostOsInfo::isMacHost()) {
connect(&useDyldSuffix, &BaseAspect::changed,
&environment, &EnvironmentAspect::environmentChanged);
environment.addModifier([this](Environment &env) {
if (useDyldSuffix())
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
});
} else {
useDyldSuffix.setVisible(false);
}
environment.addModifier([this](Environment &env) {
BuildTargetInfo bti = buildTargetInfo();
if (bti.runEnvModifier)
bti.runEnvModifier(env, useLibraryPaths());
});
setUpdater([this] {
QTC_ASSERT(buildSystem(), return);
BuildTargetInfo bti = buildTargetInfo();
terminal.setUseTerminalHint(bti.usesTerminal);
executable.setExecutable(bti.targetFilePath);
emit environment.environmentChanged();
});
}
EnvironmentAspect environment{this};
ExecutableAspect executable{this};
ArgumentsAspect arguments{this};
WorkingDirectoryAspect workingDir{this};
TerminalAspect terminal{this};
UseLibraryPathsAspect useLibraryPaths{this};
UseDyldSuffixAspect useDyldSuffix{this};
};
// MesonRunConfigurationFactory
class MesonRunConfigurationFactory final : public RunConfigurationFactory
{
public:
MesonRunConfigurationFactory()
{
registerRunConfiguration<MesonRunConfiguration>(Constants::MESON_RUNCONFIG_ID);
addSupportedProjectType(Constants::Project::ID);
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
}
};
void setupMesonRunConfiguration()
{
static MesonRunConfigurationFactory theMesonRunConfigurationFactory;
}
void setupMesonRunAndDebugWorkers()
{
using namespace Debugger;
static ProcessRunnerFactory theMesonRunWorkerFactory({Constants::MESON_RUNCONFIG_ID});
static SimpleDebugRunnerFactory theMesonDebugRunWorkerFactory({Constants::MESON_RUNCONFIG_ID});
}
} // MesonProjectManager::Internal
|