2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "cmakeproject.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2019-04-12 14:49:59 +02:00
|
|
|
#include "cmakebuildstep.h"
|
2021-09-21 22:22:37 +02:00
|
|
|
#include "cmakebuildsystem.h"
|
2016-01-06 15:51:44 +01:00
|
|
|
#include "cmakekitinformation.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "cmakeprojectconstants.h"
|
2020-04-17 15:30:05 +02:00
|
|
|
#include "cmakeprojectimporter.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
#include "cmakeprojectnodes.h"
|
2020-04-17 15:30:05 +02:00
|
|
|
#include "cmaketool.h"
|
2008-12-02 14:09:21 +01:00
|
|
|
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <coreplugin/icontext.h>
|
|
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2019-04-12 14:49:59 +02:00
|
|
|
#include <projectexplorer/buildsteplist.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2016-01-20 12:19:16 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/target.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2009-09-24 16:02:02 +02:00
|
|
|
using namespace ProjectExplorer;
|
2015-02-01 18:44:47 +02:00
|
|
|
using namespace Utils;
|
2008-12-12 17:22:02 +01:00
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
|
|
|
|
|
using namespace Internal;
|
|
|
|
|
|
2009-09-24 16:02:02 +02:00
|
|
|
/*!
|
|
|
|
|
\class CMakeProject
|
|
|
|
|
*/
|
2019-08-05 15:56:03 +02:00
|
|
|
CMakeProject::CMakeProject(const FilePath &fileName)
|
2020-04-07 14:44:22 +02:00
|
|
|
: Project(Constants::CMAKE_MIMETYPE, fileName)
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
2020-04-07 14:44:22 +02:00
|
|
|
setId(CMakeProjectManager::Constants::CMAKE_PROJECT_ID);
|
2017-01-30 14:59:10 +01:00
|
|
|
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
2017-04-07 14:35:49 +02:00
|
|
|
setDisplayName(projectDirectory().fileName());
|
2019-06-03 17:36:02 +02:00
|
|
|
setCanBuildProducts();
|
2019-08-13 12:11:07 +02:00
|
|
|
setHasMakeInstallEquivalent(true);
|
2008-12-02 12:01:29 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-17 15:30:05 +02:00
|
|
|
CMakeProject::~CMakeProject()
|
|
|
|
|
{
|
|
|
|
|
delete m_projectImporter;
|
|
|
|
|
}
|
2016-04-18 13:06:41 +02:00
|
|
|
|
2019-05-27 16:09:44 +02:00
|
|
|
Tasks CMakeProject::projectIssues(const Kit *k) const
|
2016-01-06 15:51:44 +01:00
|
|
|
{
|
2019-05-27 16:09:44 +02:00
|
|
|
Tasks result = Project::projectIssues(k);
|
2018-04-18 13:39:05 +02:00
|
|
|
|
2019-02-06 12:50:51 +01:00
|
|
|
if (!CMakeKitAspect::cmakeTool(k))
|
2018-04-18 13:39:05 +02:00
|
|
|
result.append(createProjectTask(Task::TaskType::Error, tr("No cmake tool set.")));
|
2019-02-06 12:50:51 +01:00
|
|
|
if (ToolChainKitAspect::toolChains(k).isEmpty())
|
2018-04-18 13:39:05 +02:00
|
|
|
result.append(createProjectTask(Task::TaskType::Warning, tr("No compilers set in kit.")));
|
|
|
|
|
|
2021-09-21 22:22:37 +02:00
|
|
|
result.append(m_issues);
|
|
|
|
|
|
2018-04-18 13:39:05 +02:00
|
|
|
return result;
|
2016-01-06 15:51:44 +01:00
|
|
|
}
|
|
|
|
|
|
2016-11-14 15:18:25 +01:00
|
|
|
|
2016-08-25 14:33:44 +02:00
|
|
|
ProjectImporter *CMakeProject::projectImporter() const
|
|
|
|
|
{
|
|
|
|
|
if (!m_projectImporter)
|
2020-04-17 15:30:05 +02:00
|
|
|
m_projectImporter = new CMakeProjectImporter(projectFilePath());
|
|
|
|
|
return m_projectImporter;
|
2016-08-25 14:33:44 +02:00
|
|
|
}
|
|
|
|
|
|
2021-09-21 22:22:37 +02:00
|
|
|
void CMakeProject::addIssue(IssueType type, const QString &text)
|
|
|
|
|
{
|
|
|
|
|
m_issues.append(createProjectTask(type, text));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CMakeProject::clearIssues()
|
|
|
|
|
{
|
|
|
|
|
m_issues.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-02 17:46:19 +02:00
|
|
|
bool CMakeProject::setupTarget(Target *t)
|
|
|
|
|
{
|
2013-07-07 23:49:13 +02:00
|
|
|
t->updateDefaultBuildConfigurations();
|
2014-07-31 16:36:46 +02:00
|
|
|
if (t->buildConfigurations().isEmpty())
|
|
|
|
|
return false;
|
2013-07-07 23:49:13 +02:00
|
|
|
t->updateDefaultDeployConfigurations();
|
2012-10-02 17:46:19 +02:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-12 14:49:59 +02:00
|
|
|
ProjectExplorer::DeploymentKnowledge CMakeProject::deploymentKnowledge() const
|
|
|
|
|
{
|
2019-06-18 16:21:56 +02:00
|
|
|
return !files([](const ProjectExplorer::Node *n) {
|
|
|
|
|
return n->filePath().fileName() == "QtCreatorDeployment.txt";
|
|
|
|
|
})
|
|
|
|
|
.isEmpty()
|
|
|
|
|
? DeploymentKnowledge::Approximative
|
|
|
|
|
: DeploymentKnowledge::Bad;
|
2019-04-12 14:49:59 +02:00
|
|
|
}
|
|
|
|
|
|
2016-02-24 18:00:24 +01:00
|
|
|
} // namespace CMakeProjectManager
|