- change: remove "Optimize for the following machine" and "Optimize less, while maintaining full compatibility" options in the compiler setting panel, which are obseleted.

- change: escape spaces in the executabe path under linux.
This commit is contained in:
Roy Qu 2022-10-29 17:21:38 +08:00
parent 054a99b690
commit 0c1402a386
6 changed files with 60 additions and 36 deletions

View File

@ -8,6 +8,8 @@ Red Panda C++ Version 2.1
- add fmtlib to the gcc compiler's lib distributed with RedPanda IDE windows version - add fmtlib to the gcc compiler's lib distributed with RedPanda IDE windows version
- add default autolink for fmtlib in Windows - add default autolink for fmtlib in Windows
- reduce size of the executable of win-git-askpass tool - reduce size of the executable of win-git-askpass tool
- change: remove "Optimize for the following machine" and "Optimize less, while maintaining full compatibility" options in the compiler setting panel, which are obseleted.
- change: escape spaces in the executabe path under linux.
Red Panda C++ Version 2.0 Red Panda C++ Version 2.0

View File

@ -94,35 +94,35 @@ void CompilerInfo::prepareCompilerOptions()
addOption(C_CMD_OPT_STD, QObject::tr("C Language standard (-std)"), groupName, true, false, false, "-std=", sl); addOption(C_CMD_OPT_STD, QObject::tr("C Language standard (-std)"), groupName, true, false, false, "-std=", sl);
// Optimization for cpu type // Optimization for cpu type
sl.clear(); // sl.clear();
sl.append(QPair<QString,QString>(QObject::tr("This CPU"),"native")); // sl.append(QPair<QString,QString>(QObject::tr("This CPU"),"native"));
sl.append(QPair<QString,QString>("i386","i386")); // sl.append(QPair<QString,QString>("i386","i386"));
sl.append(QPair<QString,QString>("i486","i486")); // sl.append(QPair<QString,QString>("i486","i486"));
sl.append(QPair<QString,QString>("i586","i586")); // sl.append(QPair<QString,QString>("i586","i586"));
sl.append(QPair<QString,QString>("i686","i686")); // sl.append(QPair<QString,QString>("i686","i686"));
sl.append(QPair<QString,QString>("Pentium","pentium")); // sl.append(QPair<QString,QString>("Pentium","pentium"));
sl.append(QPair<QString,QString>("Pentium MMX","pentium-mmx")); // sl.append(QPair<QString,QString>("Pentium MMX","pentium-mmx"));
sl.append(QPair<QString,QString>("Pentium Pro","pentiumpro")); // sl.append(QPair<QString,QString>("Pentium Pro","pentiumpro"));
sl.append(QPair<QString,QString>("Pentium 2","pentium2")); // sl.append(QPair<QString,QString>("Pentium 2","pentium2"));
sl.append(QPair<QString,QString>("Pentium 3","pentium3")); // sl.append(QPair<QString,QString>("Pentium 3","pentium3"));
sl.append(QPair<QString,QString>("Pentium 4","pentium4")); // sl.append(QPair<QString,QString>("Pentium 4","pentium4"));
sl.append(QPair<QString,QString>("Conroe","core2")); // sl.append(QPair<QString,QString>("Conroe","core2"));
sl.append(QPair<QString,QString>("Nehalem","corei7")); // sl.append(QPair<QString,QString>("Nehalem","corei7"));
sl.append(QPair<QString,QString>("Sandy","corei7-avx")); // sl.append(QPair<QString,QString>("Sandy","corei7-avx"));
sl.append(QPair<QString,QString>("K6","k6")); // sl.append(QPair<QString,QString>("K6","k6"));
sl.append(QPair<QString,QString>("K6-2","k6-2")); // sl.append(QPair<QString,QString>("K6-2","k6-2"));
sl.append(QPair<QString,QString>("K6-3","k6-3")); // sl.append(QPair<QString,QString>("K6-3","k6-3"));
sl.append(QPair<QString,QString>("Athlon","athlon")); // sl.append(QPair<QString,QString>("Athlon","athlon"));
sl.append(QPair<QString,QString>("Athlon Tbird","athlon-tbird")); // sl.append(QPair<QString,QString>("Athlon Tbird","athlon-tbird"));
sl.append(QPair<QString,QString>("Athlon 4","athlon-4")); // sl.append(QPair<QString,QString>("Athlon 4","athlon-4"));
sl.append(QPair<QString,QString>("Athlon XP","athlon-xp")); // sl.append(QPair<QString,QString>("Athlon XP","athlon-xp"));
sl.append(QPair<QString,QString>("Athlon MP","athlon-mp")); // sl.append(QPair<QString,QString>("Athlon MP","athlon-mp"));
sl.append(QPair<QString,QString>("K8","k8")); // sl.append(QPair<QString,QString>("K8","k8"));
sl.append(QPair<QString,QString>("K8 Rev.E","k8-sse3")); // sl.append(QPair<QString,QString>("K8 Rev.E","k8-sse3"));
sl.append(QPair<QString,QString>("K10","barcelona")); // sl.append(QPair<QString,QString>("K10","barcelona"));
sl.append(QPair<QString,QString>("Bulldozer","bdver1")); // sl.append(QPair<QString,QString>("Bulldozer","bdver1"));
addOption(CC_CMD_OPT_ARCH, QObject::tr("Optimize for the following machine (-march)"), groupName, true, true, false, "-march=", sl); // addOption(CC_CMD_OPT_ARCH, QObject::tr("Optimize for the following machine (-march)"), groupName, true, true, false, "-march=", sl);
addOption(CC_CMD_OPT_TUNE, QObject::tr("Optimize less, while maintaining full compatibility (-tune)"), groupName, true, true, false, "-mtune=", sl); // addOption(CC_CMD_OPT_TUNE, QObject::tr("Optimize less, while maintaining full compatibility (-tune)"), groupName, true, true, false, "-mtune=", sl);
// Enable use of the specific instructions // Enable use of the specific instructions
sl.clear(); sl.clear();

View File

@ -270,18 +270,18 @@ void CompilerManager::run(
.arg(consolePauserPath) .arg(consolePauserPath)
.arg(consoleFlag) .arg(consoleFlag)
.arg(sharedMemoryId) .arg(sharedMemoryId)
.arg(redirectInputFilename) .arg(escapeSpacesInString(redirectInputFilename))
.arg(localizePath(filename)) .arg(localizePath(escapeSpacesInString(filename)))
.arg(arguments); .arg(arguments);
} else { } else {
newArguments = QString(" -e \"%1\" %2 %3 \"%4\" %5") newArguments = QString(" -e \"%1\" %2 %3 \"%4\" %5")
.arg(consolePauserPath) .arg(consolePauserPath)
.arg(consoleFlag) .arg(consoleFlag)
.arg(sharedMemoryId,localizePath(filename)).arg(arguments); .arg(sharedMemoryId,localizePath(escapeSpacesInString(filename))).arg(arguments);
} }
} else { } else {
newArguments = QString(" -e \"%1\" %2") newArguments = QString(" -e \"%1\" %2")
.arg(localizePath(filename)).arg(arguments); .arg(localizePath(escapeSpacesInString(filename))).arg(arguments);
} }
execRunner = new ExecutableRunner(pSettings->environment().terminalPath(),newArguments,workDir); execRunner = new ExecutableRunner(pSettings->environment().terminalPath(),newArguments,workDir);
execRunner->setShareMemoryId(sharedMemoryId); execRunner->setShareMemoryId(sharedMemoryId);

View File

@ -689,3 +689,9 @@ QString absolutePath(const QString &dirPath, const QString &relativePath)
{ {
return QDir::cleanPath(QDir(dirPath).absoluteFilePath(relativePath)); return QDir::cleanPath(QDir(dirPath).absoluteFilePath(relativePath));
} }
QString escapeSpacesInString(const QString &str)
{
QString result=str;
return result.replace(' ',"%20");
}

View File

@ -130,6 +130,7 @@ QString extractFilePath(const QString& filePath);
QString extractAbsoluteFilePath(const QString& filePath); QString extractAbsoluteFilePath(const QString& filePath);
QString cleanPath(const QString& dirPath); QString cleanPath(const QString& dirPath);
QString absolutePath(const QString& dirPath, const QString& relativePath); QString absolutePath(const QString& dirPath, const QString& relativePath);
QString escapeSpacesInString(const QString& str);
bool isReadOnly(const QString& filename); bool isReadOnly(const QString& filename);

View File

@ -68,6 +68,21 @@ vector<string> GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit)
return result; return result;
} }
string unescapeSpaces(const string& s) {
string result;
int i=0;
while(i<s.length()) {
if (s[i]=='%' && (i+2)<s.length() && s[i+1]=='2' && s[i+2]=='0') {
result.push_back(' ');
i+=3;
} else {
result.push_back(s[i]);
i++;
}
}
return result;
}
int ExecuteCommand(vector<string>& command,bool reInp) { int ExecuteCommand(vector<string>& command,bool reInp) {
pid_t pid = fork(); pid_t pid = fork();
if (pid == 0) { if (pid == 0) {
@ -80,8 +95,8 @@ int ExecuteCommand(vector<string>& command,bool reInp) {
printf("not enough arguments1!\n"); printf("not enough arguments1!\n");
exit(-1); exit(-1);
} }
freopen(command[0].c_str(),"r",stdin); freopen(unescapeSpaces(command[0]).c_str(),"r",stdin);
path_to_command = command[1]; path_to_command = unescapeSpaces(command[1]);
command_size = command.size()+1; command_size = command.size()+1;
command_begin = 1; command_begin = 1;
} else { } else {
@ -89,7 +104,7 @@ int ExecuteCommand(vector<string>& command,bool reInp) {
printf("not enough arguments2!\n"); printf("not enough arguments2!\n");
exit(-1); exit(-1);
} }
path_to_command = command[0]; path_to_command = unescapeSpaces(command[0]);
command_size = command.size()+1; command_size = command.size()+1;
command_begin = 0; command_begin = 0;
} }