diff --git a/NEWS.md b/NEWS.md index e5949e58..3ba8bb18 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,9 @@ Red Panda C++ Version 1.0.3 - enhancement: don't show folders that doesn't contain files in the project view - enhancement: redesigned new project unit dialog - fix: some dialog's icon not correctly set + - fix: can't build project that has source files in subfolders + - fix: can't build project that has custom object folder + - fix: buttons in the project option dialog's output page don't work Red Panda C++ Version 1.0.2 - enhancement: press tab in column mode won't exit column mode diff --git a/RedPandaIDE/compiler/projectcompiler.cpp b/RedPandaIDE/compiler/projectcompiler.cpp index 6c2cd069..8bd8b1df 100644 --- a/RedPandaIDE/compiler/projectcompiler.cpp +++ b/RedPandaIDE/compiler/projectcompiler.cpp @@ -157,14 +157,21 @@ void ProjectCompiler::writeMakeDefines(QFile &file) QString relativeObjFile = extractRelativePath(mProject->directory(), changeFileExt(fullObjFile, OBJ_EXT)); QString ObjFile = genMakePath2(relativeObjFile); Objects += ' ' + ObjFile; - +#ifdef Q_OS_WIN + cleanObjects += ' ' + genMakePath1(relativeObjFile).replace("/",QDir::separator()); +#else cleanObjects += ' ' + genMakePath1(relativeObjFile); +#endif if (unit->link()) { LinkObjects += ' ' + genMakePath1(relativeObjFile); } } else { Objects += ' ' + genMakePath2(changeFileExt(RelativeName, OBJ_EXT)); +#ifdef Q_OS_WIN + cleanObjects += ' ' + genMakePath1(changeFileExt(RelativeName, OBJ_EXT)).replace("/",QDir::separator()); +#else cleanObjects += ' ' + genMakePath1(changeFileExt(RelativeName, OBJ_EXT)); +#endif if (unit->link()) LinkObjects = LinkObjects + ' ' + genMakePath1(changeFileExt(RelativeName, OBJ_EXT)); } @@ -213,11 +220,25 @@ void ProjectCompiler::writeMakeDefines(QFile &file) writeln(file,"RES = " + genMakePath1(ObjResFile)); writeln(file,"OBJ = " + Objects + " $(RES)"); writeln(file,"LINKOBJ = " + LinkObjects + " $(RES)"); - writeln(file,"CLEANOBJ = " + cleanObjects + " $(RES)"); +#ifdef Q_OS_WIN + writeln(file,"CLEANOBJ = " + cleanObjects + + " " + genMakePath1(ObjResFile).replace("/",QDir::separator()) + + " " + genMakePath1(extractRelativePath(mProject->makeFileName(), mProject->executable())).replace("/",QDir::separator()) ); +#else + writeln(file,"CLEANOBJ = " + cleanObjects + + " " + genMakePath1(ObjResFile) + + " " + genMakePath1(extractRelativePath(mProject->makeFileName(), mProject->executable()))); +#endif } else { writeln(file,"OBJ = " + Objects); writeln(file,"LINKOBJ = " + LinkObjects); - writeln(file,"CLEANOBJ = " + cleanObjects); +#ifdef Q_OS_WIN + writeln(file,"CLEANOBJ = " + cleanObjects + + + " " + genMakePath1(extractRelativePath(mProject->makeFileName(), mProject->executable())).replace("/",QDir::separator()) ); +#else + writeln(file,"CLEANOBJ = " + cleanObjects + + + " " + genMakePath1(extractRelativePath(mProject->makeFileName(), mProject->executable()))); +#endif }; libraryArguments.replace('\\', '/'); writeln(file,"LIBS = " + libraryArguments); @@ -249,7 +270,13 @@ void ProjectCompiler::writeMakeDefines(QFile &file) libOutputFile = extractRelativePath(mProject->makeFileName(), libOutputFile); writeln(file,"DEF = " + genMakePath1(changeFileExt(libOutputFile, DEF_EXT))); writeln(file,"STATIC = " + genMakePath1(changeFileExt(libOutputFile, LIB_EXT))); - +#ifdef Q_OS_WIN + writeln(file,"CLEAN_DEF = " + genMakePath1(changeFileExt(libOutputFile, DEF_EXT)).replace("/",QDir::separator())); + writeln(file,"CLEAN_STATIC = " + genMakePath1(changeFileExt(libOutputFile, LIB_EXT)).replace("/",QDir::separator())); +#else + writeln(file,"CLEAN_DEF = " + genMakePath1(changeFileExt(libOutputFile, DEF_EXT))); + writeln(file,"CLEAN_STATIC = " + genMakePath1(changeFileExt(libOutputFile, LIB_EXT))); +#endif } writeln(file); } @@ -284,9 +311,9 @@ void ProjectCompiler::writeMakeClean(QFile &file) { writeln(file, "clean: clean-custom"); if (mProject->options().type == ProjectType::DynamicLib) - writeln(file, QString("\t${RM} $(CLEANOBJ) $(BIN) $(DEF) $(STATIC) > %1 2>&1").arg(NULL_FILE)); + writeln(file, QString("\t${RM} $(CLEANOBJ) $(CLEAN_DEF) $(CLEAN_STATIC) > %1 2>&1").arg(NULL_FILE)); else - writeln(file, QString("\t${RM} $(CLEANOBJ) $(BIN) > %1 2>&1").arg(NULL_FILE)); + writeln(file, QString("\t${RM} $(CLEANOBJ) > %1 2>&1").arg(NULL_FILE)); writeln(file); } @@ -333,9 +360,9 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file) extractFileName(unit->fileName()); ObjFileName = genMakePath2(extractRelativePath(mProject->makeFileName(), changeFileExt(ObjFileName, OBJ_EXT))); ObjFileName2 = genMakePath1(extractRelativePath(mProject->makeFileName(), changeFileExt(ObjFileName, OBJ_EXT))); - if (!extractFileDir(ObjFileName).isEmpty()) { - objStr = genMakePath2(includeTrailingPathDelimiter(extractFileDir(ObjFileName))) + objStr; - } +// if (!extractFileDir(ObjFileName).isEmpty()) { +// objStr = genMakePath2(includeTrailingPathDelimiter(extractFileDir(ObjFileName))) + objStr; +// } } else { ObjFileName = genMakePath2(changeFileExt(shortFileName, OBJ_EXT)); ObjFileName2 = genMakePath1(changeFileExt(shortFileName, OBJ_EXT)); diff --git a/RedPandaIDE/settingsdialog/projectoutputwidget.cpp b/RedPandaIDE/settingsdialog/projectoutputwidget.cpp index 36c0fc08..14ba21dd 100644 --- a/RedPandaIDE/settingsdialog/projectoutputwidget.cpp +++ b/RedPandaIDE/settingsdialog/projectoutputwidget.cpp @@ -57,29 +57,29 @@ void ProjectOutputWidget::doSave() pMainWindow->project()->saveOptions(); } -void ProjectOutputWidget::on_btnOutputDir_triggered(QAction *) +void ProjectOutputWidget::on_btnOutputDir_clicked() { QString dirName = QFileDialog::getExistingDirectory( this, tr("Executable output directory"), pMainWindow->project()->directory()); if (!dirName.isEmpty()) - ui->txtOutputDir->setText(dirName); + ui->txtOutputDir->setText(extractRelativePath(pMainWindow->project()->folder(),dirName)); } -void ProjectOutputWidget::on_btnObjOutputDir_triggered(QAction *) +void ProjectOutputWidget::on_btnObjOutputDir_clicked() { QString dirName = QFileDialog::getExistingDirectory( this, tr("Object files output directory"), pMainWindow->project()->directory()); if (!dirName.isEmpty()) - ui->txtObjOutputDir->setText(dirName); + ui->txtObjOutputDir->setText(extractRelativePath(pMainWindow->project()->folder(),dirName)); } -void ProjectOutputWidget::on_btnCompileLog_triggered(QAction *) +void ProjectOutputWidget::on_btnCompileLog_clicked() { QString fileName = QFileDialog::getOpenFileName( this, @@ -87,7 +87,7 @@ void ProjectOutputWidget::on_btnCompileLog_triggered(QAction *) pMainWindow->project()->directory(), tr("All files (%1)").arg(ALL_FILE_WILDCARD)); if (!fileName.isEmpty() ) { - ui->txtCompileLog->setText(fileName); + ui->txtCompileLog->setText(extractRelativePath(pMainWindow->project()->folder(),fileName)); } } diff --git a/RedPandaIDE/settingsdialog/projectoutputwidget.h b/RedPandaIDE/settingsdialog/projectoutputwidget.h index b904c255..8e083944 100644 --- a/RedPandaIDE/settingsdialog/projectoutputwidget.h +++ b/RedPandaIDE/settingsdialog/projectoutputwidget.h @@ -40,11 +40,10 @@ protected: void doLoad() override; void doSave() override; private slots: - void on_btnOutputDir_triggered(QAction *arg1); - void on_btnObjOutputDir_triggered(QAction *arg1); - void on_btnCompileLog_triggered(QAction *arg1); + void on_btnOutputDir_clicked(); + void on_btnObjOutputDir_clicked(); + void on_btnCompileLog_clicked(); - // SettingsWidget interface protected: void updateIcons(const QSize &size) override; };