SDCC feature can be disabled

This commit is contained in:
Roy Qu 2023-12-17 13:53:22 +08:00
parent a76729e90a
commit 8cdc678d38
9 changed files with 21 additions and 8 deletions

View File

@ -15,8 +15,7 @@ APP_NAME = RedPandaCPP
APP_VERSION = 2.26
TEST_VERSION = alpha7
TEST_VERSION = alpha8
contains(QMAKE_HOST.arch, x86_64):{
DEFINES += ARCH_X86_64=1
} else: {

View File

@ -502,9 +502,11 @@ void CompilerManager::onSyntaxCheckIssue(PCompileIssue issue)
ProjectCompiler *CompilerManager::createProjectCompiler(std::shared_ptr<Project> project)
{
#ifdef ENABLE_SDCC
if (project->options().type==ProjectType::MicroController)
return new SDCCProjectCompiler(project);
else
#endif
return new ProjectCompiler(project);
}

View File

@ -84,11 +84,13 @@ bool FileCompiler::prepareForCompile()
case Settings::CompilerSet::CompilationStage::GenerateExecutable:
mOutputFile = changeFileExt(mFilename,compilerSet()->executableSuffix());
}
#ifdef ENABLE_SDCC
if (compilerSet()->compilerType()==CompilerType::SDCC) {
if (compilerSet()->executableSuffix()==SDCC_IHX_SUFFIX) {
}
}
#endif
mArguments+=QString(" -o \"%1\"").arg(mOutputFile);
#if defined(ARCH_X86_64) || defined(ARCH_X86)

View File

@ -130,6 +130,7 @@ QString Project::executable() const
exeFileName = mOptions.overridenOutput;
} else {
switch(mOptions.type) {
#ifdef ENABLE_SDCC
case ProjectType::MicroController: {
Settings::PCompilerSet pSet=pSettings->compilerSets().getSet(mOptions.compilerSet);
if (pSet)
@ -138,6 +139,7 @@ QString Project::executable() const
exeFileName = changeFileExt(extractFileName(mFilename),SDCC_HEX_SUFFIX);
}
break;
#endif
case ProjectType::StaticLib:
exeFileName = changeFileExt(extractFileName(mFilename),STATIC_LIB_EXT);
if (!exeFileName.startsWith("lib"))

View File

@ -36,7 +36,7 @@ enum class ProjectType {
Console=1,
StaticLib=2,
DynamicLib=3,
MicroController=4
MicroController=4,
};
struct ProjectVersionInfo{

View File

@ -128,6 +128,7 @@ void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
return;
}
Settings::PCompilerSet pSet=pSettings->compilerSets().getSet(index);
#ifdef ENABLE_SDCC
if (pSet) {
if (project->options().type==ProjectType::MicroController) {
if (pSet->compilerType()!=CompilerType::SDCC) {
@ -149,6 +150,7 @@ void ProjectCompilerWidget::on_cbCompilerSet_currentIndexChanged(int index)
}
}
}
#endif
if (QMessageBox::warning(
this,
tr("Change Project Compiler Set"),

View File

@ -53,9 +53,11 @@ void ProjectGeneralWidget::doLoad()
std::shared_ptr<Project> project = pMainWindow->project();
if (!project)
return;
bool isMicroControllerProject=(project->options().type==ProjectType::MicroController);
#ifdef ENABLE_SDCC
bool isMicroControllerProject = (project->options().type==ProjectType::MicroController);
#else
bool isMicroControllerProject = false;
#endif
ui->grpType->setVisible(!isMicroControllerProject);
ui->grpIcon->setVisible(!isMicroControllerProject);
ui->lblEncoding->setVisible(!isMicroControllerProject);

View File

@ -253,9 +253,10 @@ PSettingsDialog SettingsDialog::projectOptionDialog()
bool isMicroControllerProject=false;
std::shared_ptr<Project> project = pMainWindow->project();
#ifdef ENABLE_SDCC
if (project)
isMicroControllerProject=(project->options().type==ProjectType::MicroController);
#endif
dialog->setWindowTitle(tr("Project Options"));

View File

@ -123,10 +123,13 @@ void NewProjectDialog::addTemplate(const QString &filename)
t->readTemplateFile(filename);
Settings::PCompilerSet pSet=pSettings->compilerSets().defaultSet();
if (pSet) {
#ifdef ENABLE_SDCC
if (pSet->compilerType()==CompilerType::SDCC) {
if (t->options().type==ProjectType::MicroController)
mTemplates.append(t);
} else {
} else
#endif
{
if (t->options().type!=ProjectType::MicroController)
mTemplates.append(t);
}