2015-03-10 10:22:38 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2015-03-10 10:22:38 +01:00
|
|
|
**
|
|
|
|
|
** 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
|
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.
|
2015-03-10 10:22:38 +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.
|
2015-03-10 10:22:38 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-01-27 10:14:00 +01:00
|
|
|
#pragma once
|
2015-03-10 10:22:38 +01:00
|
|
|
|
|
|
|
|
#include "cmakeproject.h"
|
2016-10-13 11:36:00 +02:00
|
|
|
#include "cmaketool.h"
|
2015-03-10 10:22:38 +01:00
|
|
|
|
2016-02-12 12:30:55 +01:00
|
|
|
#include <utils/fileutils.h>
|
2015-03-10 10:22:38 +01:00
|
|
|
|
2016-02-12 12:30:55 +01:00
|
|
|
#include <QList>
|
|
|
|
|
#include <QMap>
|
|
|
|
|
#include <QSet>
|
|
|
|
|
#include <QString>
|
|
|
|
|
#include <QXmlStreamReader>
|
2015-03-10 10:22:38 +01:00
|
|
|
|
2015-03-10 15:47:09 +01:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class FileNode;
|
2016-02-12 12:30:55 +01:00
|
|
|
} // namespace ProjectExplorer
|
2015-03-10 10:22:38 +01:00
|
|
|
|
|
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class CMakeCbpParser : public QXmlStreamReader
|
|
|
|
|
{
|
|
|
|
|
public:
|
2016-10-13 12:02:52 +02:00
|
|
|
bool parseCbpFile(CMakeTool::PathMapper mapper, const Utils::FileName &fileName,
|
|
|
|
|
const Utils::FileName &sourceDirectory);
|
2015-03-10 10:22:38 +01:00
|
|
|
QList<ProjectExplorer::FileNode *> fileList();
|
|
|
|
|
QList<ProjectExplorer::FileNode *> cmakeFileList();
|
|
|
|
|
QList<CMakeBuildTarget> buildTargets();
|
|
|
|
|
QString projectName() const;
|
|
|
|
|
QString compilerName() const;
|
|
|
|
|
bool hasCMakeFiles();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void parseCodeBlocks_project_file();
|
|
|
|
|
void parseProject();
|
|
|
|
|
void parseBuild();
|
|
|
|
|
void parseOption();
|
|
|
|
|
void parseBuildTarget();
|
|
|
|
|
void parseBuildTargetOption();
|
|
|
|
|
void parseMakeCommands();
|
|
|
|
|
void parseBuildTargetBuild();
|
|
|
|
|
void parseBuildTargetClean();
|
|
|
|
|
void parseCompiler();
|
|
|
|
|
void parseAdd();
|
|
|
|
|
void parseUnit();
|
|
|
|
|
void parseUnitOption();
|
|
|
|
|
void parseUnknownElement();
|
|
|
|
|
void sortFiles();
|
|
|
|
|
|
2016-08-17 12:45:53 +02:00
|
|
|
QMap<Utils::FileName, QStringList> m_unitTargetMap;
|
2016-10-13 11:36:00 +02:00
|
|
|
CMakeTool::PathMapper m_pathMapper;
|
2015-03-10 10:22:38 +01:00
|
|
|
QList<ProjectExplorer::FileNode *> m_fileList;
|
|
|
|
|
QList<ProjectExplorer::FileNode *> m_cmakeFileList;
|
|
|
|
|
QSet<Utils::FileName> m_processedUnits;
|
2016-11-29 15:29:39 +01:00
|
|
|
bool m_parsingCMakeUnit = false;
|
2015-03-10 10:22:38 +01:00
|
|
|
|
|
|
|
|
CMakeBuildTarget m_buildTarget;
|
|
|
|
|
QList<CMakeBuildTarget> m_buildTargets;
|
|
|
|
|
QString m_projectName;
|
|
|
|
|
QString m_compiler;
|
2016-10-13 12:02:52 +02:00
|
|
|
Utils::FileName m_sourceDirectory;
|
|
|
|
|
Utils::FileName m_buildDirectory;
|
2016-08-17 12:45:53 +02:00
|
|
|
QStringList m_unitTargets;
|
2015-03-10 10:22:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CMakeProjectManager
|