- enhancement: Add "assembler" tab in the project options dialog's custom compiler parameters.

This commit is contained in:
Roy Qu 2023-02-09 16:33:25 +08:00
parent 0b7761fbc2
commit cc1e42193d
10 changed files with 535 additions and 436 deletions

View File

@ -14,6 +14,7 @@ Red Panda C++ Version 2.11
- fix: Correctly handle custom obj folder in the generated makefile. - fix: Correctly handle custom obj folder in the generated makefile.
- enhancement: Support compile asm files using nasm in the project. - enhancement: Support compile asm files using nasm in the project.
- fix: Project parser should not parse non-c/cpp files. - fix: Project parser should not parse non-c/cpp files.
- enhancement: Add "assembler" tab in the project options dialog's custom compiler parameters.
Red Panda C++ Version 2.10 Red Panda C++ Version 2.10

View File

@ -289,11 +289,11 @@ void ProjectCompiler::writeMakeDefines(QFile &file)
if (compilerSet()->canAssemble() && if (compilerSet()->canAssemble() &&
Settings::CompilerSets::isTarget64Bit(compilerSet()->target())) { Settings::CompilerSets::isTarget64Bit(compilerSet()->target())) {
if (mProject->getCompileOption(CC_CMD_OPT_POINTER_SIZE)=="32") if (mProject->getCompileOption(CC_CMD_OPT_POINTER_SIZE)=="32")
writeln(file,"ASMFLAGS = -f win32"); writeln(file,"ASMFLAGS = -f win32 " + mProject->options().assemblerArgs);
else else
writeln(file,"ASMFLAGS = -f win64"); writeln(file,"ASMFLAGS = -f win64 " + mProject->options().assemblerArgs);
} else { } else {
writeln(file,"ASMFLAGS = -f win32"); writeln(file,"ASMFLAGS = -f win32 " + mProject->options().assemblerArgs);
} }
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
writeln(file,"ASMFLAGS = -f elf64"); writeln(file,"ASMFLAGS = -f elf64");
@ -496,7 +496,7 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
} }
} else if (fileType==FileType::ASM) { } else if (fileType==FileType::ASM) {
if (!mOnlyCheckSyntax) { if (!mOnlyCheckSyntax) {
writeln(file, "\t$(ASM) $(ASMFLAGS) " + genMakePath1(shortFileName) + " -o " + objFileName2); writeln(file, "\t$(ASM) " + genMakePath1(shortFileName) + " -o " + objFileName2 + " $(ASMFLAGS) ");
} }
} }
} }

View File

@ -1035,6 +1035,8 @@ bool Project::saveAsTemplate(const QString &templateFolder,
ini->SetValue("Project", "Linker",mOptions.linkerCmd.toUtf8()); ini->SetValue("Project", "Linker",mOptions.linkerCmd.toUtf8());
if (!mOptions.resourceCmd.isEmpty()) if (!mOptions.resourceCmd.isEmpty())
ini->SetValue("Project", "ResourceCommand",mOptions.resourceCmd.toUtf8()); ini->SetValue("Project", "ResourceCommand",mOptions.resourceCmd.toUtf8());
if (!mOptions.assemblerArgs.isEmpty())
ini->SetValue("Project", "AssemblerArgs",mOptions.assemblerArgs.toUtf8());
ini->SetBoolValue("Project", "IsCpp", mOptions.isCpp); ini->SetBoolValue("Project", "IsCpp", mOptions.isCpp);
if (mOptions.includeVersionInfo) if (mOptions.includeVersionInfo)
ini->SetBoolValue("Project", "IncludeVersionInfo", true); ini->SetBoolValue("Project", "IncludeVersionInfo", true);
@ -1133,6 +1135,7 @@ void Project::saveOptions()
ini.SetValue("Project","PrivateResource", toByteArray(mOptions.privateResource)); ini.SetValue("Project","PrivateResource", toByteArray(mOptions.privateResource));
ini.SetValue("Project","Compiler", toByteArray(mOptions.compilerCmd)); ini.SetValue("Project","Compiler", toByteArray(mOptions.compilerCmd));
ini.SetValue("Project","CppCompiler", toByteArray(mOptions.cppCompilerCmd)); ini.SetValue("Project","CppCompiler", toByteArray(mOptions.cppCompilerCmd));
ini.SetValue("Project","AssemblerArgs",toByteArray(mOptions.assemblerArgs));
ini.SetValue("Project","Linker", toByteArray(mOptions.linkerCmd)); ini.SetValue("Project","Linker", toByteArray(mOptions.linkerCmd));
ini.SetValue("Project", "ResourceCommand", toByteArray(mOptions.resourceCmd)); ini.SetValue("Project", "ResourceCommand", toByteArray(mOptions.resourceCmd));
ini.SetLongValue("Project","IsCpp", mOptions.isCpp); ini.SetLongValue("Project","IsCpp", mOptions.isCpp);
@ -1940,6 +1943,7 @@ void Project::loadOptions(SimpleIni& ini)
mOptions.cppCompilerCmd = fromByteArray(ini.GetValue("Project", "CppCompiler", "")); mOptions.cppCompilerCmd = fromByteArray(ini.GetValue("Project", "CppCompiler", ""));
mOptions.linkerCmd = fromByteArray(ini.GetValue("Project", "Linker", "")); mOptions.linkerCmd = fromByteArray(ini.GetValue("Project", "Linker", ""));
mOptions.resourceCmd = fromByteArray(ini.GetValue("Project", "ResourceCommand", "")); mOptions.resourceCmd = fromByteArray(ini.GetValue("Project", "ResourceCommand", ""));
mOptions.assemblerArgs = fromByteArray(ini.GetValue("Project","AssemblerArgs",""));
mOptions.binDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Bins", "")).split(";", mOptions.binDirs = absolutePaths(fromByteArray(ini.GetValue("Project", "Bins", "")).split(";",
#if QT_VERSION >= QT_VERSION_CHECK(5,15,0) #if QT_VERSION >= QT_VERSION_CHECK(5,15,0)
Qt::SkipEmptyParts Qt::SkipEmptyParts

View File

@ -67,6 +67,7 @@ struct ProjectOptions{
QString cppCompilerCmd; QString cppCompilerCmd;
QString linkerCmd; QString linkerCmd;
QString resourceCmd; QString resourceCmd;
QString assemblerArgs;
QStringList binDirs; QStringList binDirs;
QStringList includeDirs; QStringList includeDirs;
QStringList libDirs; QStringList libDirs;

View File

@ -138,6 +138,7 @@ void ProjectTemplate::readTemplateFile(const QString &fileName)
mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", "")); mOptions.cppCompilerCmd = fromByteArray(mIni->GetValue("Project", "CppCompiler", ""));
mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker","")); mOptions.linkerCmd = fromByteArray(mIni->GetValue("Project", "Linker",""));
mOptions.resourceCmd = fromByteArray(mIni->GetValue("Project", "ResourceCommand", "")); mOptions.resourceCmd = fromByteArray(mIni->GetValue("Project", "ResourceCommand", ""));
mOptions.assemblerArgs = fromByteArray(mIni->GetValue("Project","AssemblerArgs",""));
mOptions.isCpp = mIni->GetBoolValue("Project", "IsCpp", false); mOptions.isCpp = mIni->GetBoolValue("Project", "IsCpp", false);
mOptions.includeVersionInfo = mIni->GetBoolValue("Project", "IncludeVersionInfo", false); mOptions.includeVersionInfo = mIni->GetBoolValue("Project", "IncludeVersionInfo", false);
mOptions.supportXPThemes = mIni->GetBoolValue("Project", "SupportXPThemes", false); mOptions.supportXPThemes = mIni->GetBoolValue("Project", "SupportXPThemes", false);

View File

@ -52,6 +52,7 @@ void ProjectCompileParamatersWidget::doLoad()
ui->txtCPPCompiler->setPlainText(pMainWindow->project()->options().cppCompilerCmd); ui->txtCPPCompiler->setPlainText(pMainWindow->project()->options().cppCompilerCmd);
ui->txtLinker->setPlainText(pMainWindow->project()->options().linkerCmd); ui->txtLinker->setPlainText(pMainWindow->project()->options().linkerCmd);
ui->txtResource->setPlainText(pMainWindow->project()->options().resourceCmd); ui->txtResource->setPlainText(pMainWindow->project()->options().resourceCmd);
ui->txtAssembler->setPlainText(pMainWindow->project()->options().assemblerArgs);
ui->grpAllowParallelBuilding->setChecked(pMainWindow->project()->options().allowParallelBuilding); ui->grpAllowParallelBuilding->setChecked(pMainWindow->project()->options().allowParallelBuilding);
ui->spinParallelJobs->setValue(pMainWindow->project()->options().parellelBuildingJobs); ui->spinParallelJobs->setValue(pMainWindow->project()->options().parellelBuildingJobs);
} }
@ -62,6 +63,7 @@ void ProjectCompileParamatersWidget::doSave()
pMainWindow->project()->options().cppCompilerCmd = ui->txtCPPCompiler->toPlainText(); pMainWindow->project()->options().cppCompilerCmd = ui->txtCPPCompiler->toPlainText();
pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText(); pMainWindow->project()->options().linkerCmd = ui->txtLinker->toPlainText();
pMainWindow->project()->options().resourceCmd = ui->txtResource->toPlainText(); pMainWindow->project()->options().resourceCmd = ui->txtResource->toPlainText();
pMainWindow->project()->options().assemblerArgs = ui->txtAssembler->toPlainText();
pMainWindow->project()->options().allowParallelBuilding = ui->grpAllowParallelBuilding->isChecked(); pMainWindow->project()->options().allowParallelBuilding = ui->grpAllowParallelBuilding->isChecked();
pMainWindow->project()->options().parellelBuildingJobs = ui->spinParallelJobs->value(); pMainWindow->project()->options().parellelBuildingJobs = ui->spinParallelJobs->value();
pMainWindow->project()->saveOptions(); pMainWindow->project()->saveOptions();

View File

@ -52,7 +52,7 @@
<item> <item>
<widget class="QTabWidget" name="tabCommands"> <widget class="QTabWidget" name="tabCommands">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>4</number>
</property> </property>
<widget class="QWidget" name="tabCCompiler"> <widget class="QWidget" name="tabCCompiler">
<attribute name="title"> <attribute name="title">
@ -181,6 +181,28 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabAssembler">
<attribute name="title">
<string>Assembler</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QTextEdit" name="txtAssembler"/>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -755,6 +755,14 @@
<source>Locate gprof</source> <source>Locate gprof</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Assembler</source>
<translation type="unfinished">Assembler</translation>
</message>
<message>
<source>Locate nasm</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CppRefacter</name> <name>CppRefacter</name>
@ -770,6 +778,14 @@
<source>New symbol already exists!</source> <source>New symbol already exists!</source>
<translation>Novo símbolo existente!</translation> <translation>Novo símbolo existente!</translation>
</message> </message>
<message>
<source>Searching...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Abort</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CustomMakefileInfoDialog</name> <name>CustomMakefileInfoDialog</name>
@ -5413,6 +5429,10 @@
<source>Resource</source> <source>Resource</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Assembler</source>
<translation type="unfinished">Assembler</translation>
</message>
</context> </context>
<context> <context>
<name>ProjectCompiler</name> <name>ProjectCompiler</name>

File diff suppressed because it is too large Load Diff

View File

@ -664,6 +664,14 @@
<source>Locate gprof</source> <source>Locate gprof</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Assembler</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Locate nasm</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CppRefacter</name> <name>CppRefacter</name>
@ -679,6 +687,14 @@
<source>New symbol already exists!</source> <source>New symbol already exists!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Searching...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Abort</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>CustomMakefileInfoDialog</name> <name>CustomMakefileInfoDialog</name>
@ -5190,6 +5206,10 @@
<source>Resource</source> <source>Resource</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Assembler</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ProjectCompiler</name> <name>ProjectCompiler</name>