RedPanda-CPP/RedPandaIDE/compiler/projectcompiler.h

58 lines
1.8 KiB
C
Raw Normal View History

2021-12-26 23:18:28 +08:00
/*
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2021-09-13 07:49:36 +08:00
#ifndef PROJECTCOMPILER_H
#define PROJECTCOMPILER_H
#include "compiler.h"
#include <QObject>
2022-09-25 09:55:18 +08:00
#include <QFile>
2021-09-13 07:49:36 +08:00
class Project;
class ProjectCompiler : public Compiler
{
Q_OBJECT
public:
2023-08-17 19:24:49 +08:00
ProjectCompiler(std::shared_ptr<Project> project);
ProjectCompiler(const ProjectCompiler&)=delete;
ProjectCompiler& operator=(const ProjectCompiler&)=delete;
2023-08-17 19:24:49 +08:00
virtual void buildMakeFile();
2021-09-13 07:49:36 +08:00
bool onlyClean() const;
void setOnlyClean(bool newOnlyClean);
2021-09-13 07:49:36 +08:00
private:
2021-09-13 10:48:44 +08:00
void createStandardMakeFile();
2021-09-13 22:45:50 +08:00
void createStaticMakeFile();
void createDynamicMakeFile();
2021-09-13 10:48:44 +08:00
void newMakeFile(QFile& file);
void writeMakeHeader(QFile& file);
void writeMakeDefines(QFile& file);
2021-09-13 19:09:15 +08:00
void writeMakeTarget(QFile& file);
2021-09-13 22:45:50 +08:00
void writeMakeIncludes(QFile& file);
void writeMakeClean(QFile& file);
void writeMakeObjFilesRules(QFile& file);
2021-09-13 10:48:44 +08:00
void writeln(QFile& file, const QString& s="");
2021-09-13 07:49:36 +08:00
// Compiler interface
private:
bool mOnlyClean;
2021-09-13 07:49:36 +08:00
protected:
bool prepareForCompile() override;
bool prepareForRebuild() override;
};
#endif // PROJECTCOMPILER_H