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);
|
2023-01-12 12:07:22 +08:00
|
|
|
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
|
|
|
|
2021-09-17 21:33:19 +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);
|
2024-03-27 15:32:30 +08:00
|
|
|
void newMakeFile(QFile& file, bool &genModuleDef);
|
2021-09-13 10:48:44 +08:00
|
|
|
void writeMakeHeader(QFile& file);
|
2024-03-27 15:32:30 +08:00
|
|
|
void writeMakeDefines(QFile& file, bool &genModuleDef);
|
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
|
2021-09-17 21:33:19 +08:00
|
|
|
private:
|
|
|
|
bool mOnlyClean;
|
2024-09-30 16:41:42 +08:00
|
|
|
|
2021-09-13 07:49:36 +08:00
|
|
|
protected:
|
|
|
|
bool prepareForCompile() override;
|
|
|
|
bool prepareForRebuild() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PROJECTCOMPILER_H
|