streamline codes
This commit is contained in:
parent
08693b81ec
commit
72883cf8fb
|
@ -36,9 +36,8 @@
|
|||
|
||||
#define COMPILE_PROCESS_END "---//END//----"
|
||||
|
||||
Compiler::Compiler(const QString &filename, bool silent, bool onlyCheckSyntax):
|
||||
Compiler::Compiler(const QString &filename, bool onlyCheckSyntax):
|
||||
QThread(),
|
||||
mSilent(silent),
|
||||
mOnlyCheckSyntax(onlyCheckSyntax),
|
||||
mFilename(filename),
|
||||
mRebuild(false),
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
Project,
|
||||
StdIn
|
||||
};
|
||||
Compiler(const QString& filename, bool silent,bool onlyCheckSyntax);
|
||||
Compiler(const QString& filename, bool onlyCheckSyntax);
|
||||
Compiler(const Compiler&)=delete;
|
||||
Compiler& operator=(const Compiler&)=delete;
|
||||
|
||||
|
@ -88,7 +88,6 @@ protected:
|
|||
void runCommand(const QString& cmd, const QString& arguments, const QString& workingDir, const QByteArray& inputText=QByteArray(), const QString& outputFile=QString());
|
||||
|
||||
protected:
|
||||
bool mSilent;
|
||||
bool mOnlyCheckSyntax;
|
||||
QString mCompiler;
|
||||
QString mArguments;
|
||||
|
|
|
@ -92,10 +92,10 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin
|
|||
//deleted when thread finished
|
||||
#ifdef ENABLE_SDCC
|
||||
if (pSettings->compilerSets().defaultSet()->compilerType()==CompilerType::SDCC) {
|
||||
mCompiler = new SDCCFileCompiler(filename,encoding,compileType);
|
||||
mCompiler = new SDCCFileCompiler(filename,encoding,compileType,false);
|
||||
} else
|
||||
#endif
|
||||
mCompiler = new FileCompiler(filename,encoding,compileType,false,false);
|
||||
mCompiler = new FileCompiler(filename,encoding,compileType,false);
|
||||
mCompiler->setRebuild(rebuild);
|
||||
connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater);
|
||||
connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished);
|
||||
|
@ -126,7 +126,7 @@ void CompilerManager::compileProject(std::shared_ptr<Project> project, bool rebu
|
|||
mCompileErrorCount = 0;
|
||||
mCompileIssueCount = 0;
|
||||
//deleted when thread finished
|
||||
mCompiler = new ProjectCompiler(project,false,false);
|
||||
mCompiler = new ProjectCompiler(project,false);
|
||||
mCompiler->setRebuild(rebuild);
|
||||
connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater);
|
||||
connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished);
|
||||
|
@ -158,7 +158,7 @@ void CompilerManager::cleanProject(std::shared_ptr<Project> project)
|
|||
mCompileErrorCount = 0;
|
||||
mCompileIssueCount = 0;
|
||||
//deleted when thread finished
|
||||
ProjectCompiler* compiler = new ProjectCompiler(project,false,false);
|
||||
ProjectCompiler* compiler = new ProjectCompiler(project,false);
|
||||
compiler->setOnlyClean(true);
|
||||
mCompiler = compiler;
|
||||
mCompiler->setRebuild(false);
|
||||
|
@ -189,7 +189,7 @@ void CompilerManager::buildProjectMakefile(std::shared_ptr<Project> project)
|
|||
if (mCompiler!=nullptr) {
|
||||
return;
|
||||
}
|
||||
ProjectCompiler compiler(project,false,false);
|
||||
ProjectCompiler compiler(project,false);
|
||||
compiler.buildMakeFile();
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ void CompilerManager::checkSyntax(const QString &filename, const QByteArray& enc
|
|||
mSyntaxCheckIssueCount = 0;
|
||||
|
||||
//deleted when thread finished
|
||||
mBackgroundSyntaxChecker = new StdinCompiler(filename,encoding, content,true,true);
|
||||
mBackgroundSyntaxChecker = new StdinCompiler(filename,encoding, content,true);
|
||||
mBackgroundSyntaxChecker->setProject(project);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::finished, mBackgroundSyntaxChecker, &QThread::deleteLater);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue);
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include "../utils.h"
|
||||
#include "../common.h"
|
||||
|
||||
class Runner;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
#include "filecompiler.h"
|
||||
#include "utils.h"
|
||||
#include "../mainwindow.h"
|
||||
#include "compilermanager.h"
|
||||
#include "qsynedit/syntaxer/asm.h"
|
||||
#include "../systemconsts.h"
|
||||
|
@ -27,8 +26,8 @@
|
|||
|
||||
|
||||
FileCompiler::FileCompiler(const QString &filename, const QByteArray &encoding,
|
||||
CppCompileType compileType,bool silent,bool onlyCheckSyntax):
|
||||
Compiler(filename, silent,onlyCheckSyntax),
|
||||
CppCompileType compileType, bool onlyCheckSyntax):
|
||||
Compiler(filename, onlyCheckSyntax),
|
||||
mEncoding(encoding),
|
||||
mCompileType(compileType)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ class FileCompiler : public Compiler
|
|||
public:
|
||||
FileCompiler(const QString& filename, const QByteArray& encoding,
|
||||
CppCompileType compileType,
|
||||
bool silent,bool onlyCheckSyntax);
|
||||
bool onlyCheckSyntax);
|
||||
FileCompiler(const FileCompiler&)=delete;
|
||||
FileCompiler& operator=(const FileCompiler&)=delete;
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
#include <QDir>
|
||||
|
||||
ProjectCompiler::ProjectCompiler(std::shared_ptr<Project> project, bool silent, bool onlyCheckSyntax):
|
||||
Compiler("",silent,onlyCheckSyntax),
|
||||
ProjectCompiler::ProjectCompiler(std::shared_ptr<Project> project, bool onlyCheckSyntax):
|
||||
Compiler("",onlyCheckSyntax),
|
||||
mOnlyClean(false)
|
||||
{
|
||||
setProject(project);
|
||||
|
|
|
@ -26,7 +26,7 @@ class ProjectCompiler : public Compiler
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProjectCompiler(std::shared_ptr<Project> project, bool silent,bool onlyCheckSyntax);
|
||||
ProjectCompiler(std::shared_ptr<Project> project, bool onlyCheckSyntax);
|
||||
ProjectCompiler(const ProjectCompiler&)=delete;
|
||||
ProjectCompiler& operator=(const ProjectCompiler&)=delete;
|
||||
void buildMakeFile();
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
|
||||
SDCCFileCompiler::SDCCFileCompiler(const QString &filename, const QByteArray &encoding,
|
||||
CppCompileType compileType):
|
||||
Compiler(filename, false,false),
|
||||
CppCompileType compileType, bool onlyCheckSyntax):
|
||||
Compiler(filename, onlyCheckSyntax),
|
||||
mEncoding(encoding),
|
||||
mCompileType(compileType),
|
||||
mNoStartup(false)
|
||||
|
@ -36,7 +36,17 @@ SDCCFileCompiler::SDCCFileCompiler(const QString &filename, const QByteArray &en
|
|||
|
||||
bool SDCCFileCompiler::prepareForCompile()
|
||||
{
|
||||
compilerSet()->setCompilationStage(Settings::CompilerSet::CompilationStage::GenerateExecutable);
|
||||
//compilerSet()->setCompilationStage(Settings::CompilerSet::CompilationStage::GenerateExecutable);
|
||||
|
||||
if (mOnlyCheckSyntax) {
|
||||
mCompiler = compilerSet()->CCompiler();
|
||||
mArguments += getCCompileArguments(false);
|
||||
mArguments += getCIncludeArguments();
|
||||
mArguments += getProjectIncludeArguments();
|
||||
mArguments = QString("--syntax-only \"%1\"").arg(mFilename);
|
||||
mDirectory = extractFileDir(mFilename);
|
||||
return true;
|
||||
}
|
||||
log(tr("Compiling single file..."));
|
||||
log("------------------");
|
||||
log(tr("- Filename: %1").arg(mFilename));
|
||||
|
|
|
@ -24,7 +24,7 @@ class SDCCFileCompiler : public Compiler
|
|||
Q_OBJECT
|
||||
public:
|
||||
SDCCFileCompiler(const QString& filename, const QByteArray& encoding,
|
||||
CppCompileType compileType);
|
||||
CppCompileType compileType, bool onlyCheckSyntax);
|
||||
SDCCFileCompiler(const SDCCFileCompiler&)=delete;
|
||||
SDCCFileCompiler& operator=(const SDCCFileCompiler&)=delete;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <QFileInfo>
|
||||
#include <QTextCodec>
|
||||
|
||||
StdinCompiler::StdinCompiler(const QString &filename,const QByteArray& encoding, const QString& content,bool silent, bool onlyCheckSyntax):
|
||||
Compiler(filename,silent, onlyCheckSyntax),
|
||||
StdinCompiler::StdinCompiler(const QString &filename,const QByteArray& encoding, const QString& content, bool onlyCheckSyntax):
|
||||
Compiler(filename, onlyCheckSyntax),
|
||||
mContent(content),
|
||||
mEncoding(encoding)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ class StdinCompiler : public Compiler
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit StdinCompiler(const QString& filename, const QByteArray& encoding, const QString& content, bool silent,bool onlyCheckSyntax);
|
||||
explicit StdinCompiler(const QString& filename, const QByteArray& encoding, const QString& content, bool onlyCheckSyntax);
|
||||
StdinCompiler(const StdinCompiler&)=delete;
|
||||
StdinCompiler& operator=(const StdinCompiler&)=delete;
|
||||
|
||||
|
|
|
@ -3018,9 +3018,13 @@ bool Settings::CompilerSets::addSets(const QString &folder, const QString& c_pro
|
|||
PCompilerSet baseSet = addSet(folder,c_prog);
|
||||
if (!baseSet || baseSet->name().isEmpty())
|
||||
return false;
|
||||
#if ENABLE_SDCC
|
||||
if (c_prog == SDCC_PROGRAM) {
|
||||
//sdcc do nothing
|
||||
baseSet->setCompileOption(SDCC_OPT_NOSTARTUP,COMPILER_OPTION_ON);
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
QString baseName = baseSet->name();
|
||||
QString platformName;
|
||||
if (isTarget64Bit(baseSet->target())) {
|
||||
|
|
Loading…
Reference in New Issue