2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2016-08-25 14:33:44 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-05-30 19:04:54 +02:00
|
|
|
#include "presetsparser.h"
|
|
|
|
|
|
2016-08-25 14:33:44 +02:00
|
|
|
#include <qtsupport/qtprojectimporter.h>
|
|
|
|
|
|
2023-03-21 19:20:55 +01:00
|
|
|
#include <utils/temporarydirectory.h>
|
|
|
|
|
|
2016-08-25 14:33:44 +02:00
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
|
2023-05-09 18:22:47 +02:00
|
|
|
class CMakeProject;
|
2016-08-25 14:33:44 +02:00
|
|
|
class CMakeTool;
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2022-10-07 15:08:33 +02:00
|
|
|
struct DirectoryData;
|
|
|
|
|
|
2016-08-25 14:33:44 +02:00
|
|
|
class CMakeProjectImporter : public QtSupport::QtProjectImporter
|
|
|
|
|
{
|
|
|
|
|
public:
|
2023-05-09 18:22:47 +02:00
|
|
|
CMakeProjectImporter(const Utils::FilePath &path,
|
|
|
|
|
const CMakeProjectManager::CMakeProject *project);
|
2016-08-25 14:33:44 +02:00
|
|
|
|
2022-09-26 14:21:12 +02:00
|
|
|
Utils::FilePaths importCandidates() final;
|
2023-05-09 18:22:47 +02:00
|
|
|
ProjectExplorer::Target *preferredTarget(const QList<ProjectExplorer::Target *> &possibleTargets) final;
|
2016-08-25 14:33:44 +02:00
|
|
|
|
|
|
|
|
private:
|
2020-12-02 19:16:40 +01:00
|
|
|
QList<void *> examineDirectory(const Utils::FilePath &importPath,
|
|
|
|
|
QString *warningMessage) const final;
|
2016-08-25 14:33:44 +02:00
|
|
|
bool matchKit(void *directoryData, const ProjectExplorer::Kit *k) const final;
|
|
|
|
|
ProjectExplorer::Kit *createKit(void *directoryData) const final;
|
2020-01-09 18:42:28 +01:00
|
|
|
const QList<ProjectExplorer::BuildInfo> buildInfoList(void *directoryData) const final;
|
2016-08-25 14:33:44 +02:00
|
|
|
|
|
|
|
|
struct CMakeToolData {
|
|
|
|
|
bool isTemporary = false;
|
|
|
|
|
CMakeTool *cmakeTool = nullptr;
|
|
|
|
|
};
|
2019-05-28 13:49:26 +02:00
|
|
|
CMakeToolData findOrCreateCMakeTool(const Utils::FilePath &cmakeToolPath) const;
|
2016-08-25 14:33:44 +02:00
|
|
|
|
|
|
|
|
void deleteDirectoryData(void *directoryData) const final;
|
|
|
|
|
|
|
|
|
|
void cleanupTemporaryCMake(ProjectExplorer::Kit *k, const QVariantList &vl);
|
|
|
|
|
void persistTemporaryCMake(ProjectExplorer::Kit *k, const QVariantList &vl);
|
2022-05-30 19:04:54 +02:00
|
|
|
|
2022-10-07 15:08:33 +02:00
|
|
|
void ensureBuildDirectory(DirectoryData &data, const ProjectExplorer::Kit *k) const;
|
|
|
|
|
|
2023-05-09 18:22:47 +02:00
|
|
|
const CMakeProject *m_project;
|
2022-05-30 19:04:54 +02:00
|
|
|
Utils::TemporaryDirectory m_presetsTempDir;
|
2016-08-25 14:33:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CMakeProjectManager
|