aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qtapplicationmanager/appmanagercmakepackagestep.cpp
blob: 0f9ae37f7123db8ea285027e313d7c488a046765 (plain)
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
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "appmanagercmakepackagestep.h"

#include "appmanagerconstants.h"
#include "appmanagertargetinformation.h"
#include "appmanagertr.h"

#include <projectexplorer/buildstep.h>
#include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/processparameters.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>

#include <cmakeprojectmanager/cmakeprojectconstants.h>

using namespace ProjectExplorer;
using namespace Utils;

namespace AppManager::Internal {

class AppManagerCMakePackageStepFactory final : public BuildStepFactory
{
public:
    AppManagerCMakePackageStepFactory()
    {
        cloneStepCreator(CMakeProjectManager::Constants::CMAKE_BUILD_STEP_ID, Constants::CMAKE_PACKAGE_STEP_ID);
        setExtraInit([] (BuildStep *step) {
            // We update the build targets when the active run configuration changes
            const auto updaterSlot = [step] {
                const TargetInformation targetInformation(step->target());
                step->setBuildTargets({targetInformation.cmakeBuildTarget});
                step->setEnabled(!targetInformation.isBuiltin);
            };
            QObject::connect(step->target(), &Target::activeRunConfigurationChanged, step, updaterSlot);
            QObject::connect(step->target(), &Target::activeDeployConfigurationChanged, step, updaterSlot);
            QObject::connect(step->target(), &Target::parsingFinished, step, updaterSlot);
            QObject::connect(step->target(), &Target::runConfigurationsUpdated, step, updaterSlot);
            QObject::connect(step->project(), &Project::displayNameChanged, step, updaterSlot);
        });

        setDisplayName(Tr::tr("Create Application Manager package with CMake"));
        setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
        setSupportedProjectType(CMakeProjectManager::Constants::CMAKE_PROJECT_ID);
    }
};

void setupAppManagerCMakePackageStep()
{
    static AppManagerCMakePackageStepFactory theAppManagerCMakePackageStepFactory;
}

} // AppManager::Internal