- fix: can't correctly set TDM-GCC compiler

- fix: auto add 32-bit compiler sets for TDM64-GCC
This commit is contained in:
Roy Qu 2021-12-16 11:36:52 +08:00
parent 879f001d0c
commit 2d65e1d93b
4 changed files with 54 additions and 7 deletions

View File

@ -1,9 +1,12 @@
Version 0.11.2 For Dev-C++ 7 Beta
- fix: button "run all problem cases" not disabled when compiling or debugging
- enhancement: set font for problem case input/output textedits
- enhancement: when run problem cases, updates output immediately
- enhancement: when run program with problem cases, updates output immediately (note: stdout of the program running with problem cases is fully buffered,
so we need to fflush after each time output to stdout, or use setbuf(stdout,NULL) to turn the buffer off)
- fix: current line of the disassembly in the cpu window not correctly setted
- enhancement: add "step into one machine instruction" and "step over one machine instruction" in the cpu window
- fix: can't correctly set TDM-GCC compiler
- fix: auto add 32-bit compiler sets for TDM64-GCC
Version 0.11.1 For Dev-C++ 7 Beta
- enhancement: Problem's test case shouldn't accept rich text inputs

View File

@ -2232,7 +2232,15 @@ void Settings::CompilerSet::setIniOptions(const QByteArray &value)
QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const QString &binFile, const QStringList &arguments)
{
QByteArray result = runAndGetOutput(includeTrailingPathDelimiter(binDir)+binFile, binDir, arguments);
QProcessEnvironment env;
env.insert("LANG","en");
QByteArray result = runAndGetOutput(
includeTrailingPathDelimiter(binDir)+binFile,
binDir,
arguments,
QByteArray(),
false,
env);
return result.trimmed();
}
@ -2292,6 +2300,13 @@ Settings::PCompilerSet Settings::CompilerSets::addSet(const QString &folder)
return p;
}
static void set64_32Options(Settings::PCompilerSet pSet) {
PCompilerOption pOption = pSet->findOption("-");
if (pOption) {
pSet->setOption(pOption,'1');
}
}
static void setReleaseOptions(Settings::PCompilerSet pSet) {
PCompilerOption pOption = pSet->findOption("-O");
if (pOption) {
@ -2370,6 +2385,27 @@ void Settings::CompilerSets::addSets(const QString &folder)
QString baseName = baseSet->name();
QString platformName;
if (baseSet->target() == "x86_64") {
if (baseName.startsWith("TDM-GCC ")) {
platformName = "32-bit";
baseSet->setName(baseName + " " + platformName + " Release");
baseSet->setCompilerSetType(CompilerSetType::CST_RELEASE);
set64_32Options(baseSet);
setReleaseOptions(baseSet);
baseSet = addSet(folder);
baseSet->setName(baseName + " " + platformName + " Debug");
baseSet->setCompilerSetType(CompilerSetType::CST_DEBUG);
set64_32Options(baseSet);
setDebugOptions(baseSet);
baseSet = addSet(folder);
baseSet->setName(baseName + " " + platformName + " Profiling");
baseSet->setCompilerSetType(CompilerSetType::CST_PROFILING);
set64_32Options(baseSet);
setProfileOptions(baseSet);
baseSet = addSet(folder);
}
platformName = "64-bit";
} else {
platformName = "32-bit";

View File

@ -115,15 +115,21 @@ bool isGreenEdition()
return gIsGreenEdition;
}
QByteArray runAndGetOutput(const QString &cmd, const QString& workingDir, const QStringList& arguments, const QByteArray &inputContent, bool inheritEnvironment)
QByteArray runAndGetOutput(const QString &cmd, const QString& workingDir, const QStringList& arguments,
const QByteArray &inputContent, bool inheritEnvironment,
const QProcessEnvironment& env)
{
QProcess process;
QByteArray result;
if (env.isEmpty()) {
if (inheritEnvironment) {
process.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
} else {
process.setProcessEnvironment(QProcessEnvironment());
}
} else {
process.setProcessEnvironment(env);
}
process.setWorkingDirectory(workingDir);
process.connect(&process,&QProcess::readyReadStandardError,
[&](){

View File

@ -9,6 +9,7 @@
#include <QStringList>
#include <memory>
#include <QThread>
#include <QProcessEnvironment>
#include "SimpleIni.h"
using SimpleIni = CSimpleIniA;
@ -120,7 +121,8 @@ bool isTextAllAscii(const QString& text);
QByteArray runAndGetOutput(const QString& cmd, const QString& workingDir, const QStringList& arguments,
const QByteArray& inputContent = QByteArray(),
bool inheritEnvironment = false);
bool inheritEnvironment = false,
const QProcessEnvironment& env = QProcessEnvironment() );
void executeFile(const QString& fileName,
const QString& params,