2424#include " properties.h"
2525#include " asideconfig.h"
2626#include " hintdialog.h"
27+ #include " directory.h"
2728
2829BuildC::BuildC (ProjectOptions *projopts, QPlainTextEdit *compstat, QLabel *stat, QLabel *progsize, QProgressBar *progbar, QComboBox *cb, Properties *p)
2930 : Build(projopts, compstat, stat, progsize, progbar, cb, p)
@@ -40,14 +41,19 @@ int BuildC::runBuild(QString option, QString projfile, QString compiler)
4041 aSideCompiler = compiler;
4142 aSideCompilerPath = sourcePath (compiler);
4243
43- if (ensureOutputDirectory () != 0 )
44- return -1 ;
45-
44+ setMemModel (projectOptions->getMemModel ());
4645
4746 projName = shortFileName (projectFile).replace (" .side" , " .c" );
4847 exeName = projName.mid (0 , projName.lastIndexOf (" ." )) + " .elf" ;
48+ if (option.indexOf (BUILDALL_MEMTYPE) == 0 ) {
49+ model = option.mid (option.indexOf (" =" )+1 );
50+ setMemModel (model);
51+ }
4952 exePath = outputPath + exeName;
5053
54+ if (ensureOutputDirectory () != 0 )
55+ return -1 ;
56+
5157 QStringList clist;
5258 QFile file (projectFile);
5359 QString proj = " " ;
@@ -105,10 +111,10 @@ int BuildC::runBuild(QString option, QString projfile, QString compiler)
105111 compileStatus->appendPlainText (workspace+" \n " );
106112 }
107113
108- bool rebuild = false ;
114+ bool rebuild = true ;
109115
110- if (projectOptions->getDependentBuild ().length () == 0 )
111- rebuild = true ;
116+ // if (projectOptions->getDependentBuild().length() == 0)
117+ // rebuild = true;
112118
113119 Qt::KeyboardModifiers keymods = QApplication::keyboardModifiers ();
114120 if ((keymods & Qt::AltModifier) != 0 )
@@ -118,14 +124,27 @@ int BuildC::runBuild(QString option, QString projfile, QString compiler)
118124
119125 if (!rebuild) {
120126 rebuild = isOutdated (localList, sourcePath (projectFile), sourcePath (projectFile)+exePath);
121- status->setText (tr (" Build not needed. Just loading ... " ));
127+ status->setText (tr (" Build not needed." ));
122128 }
123129
124130 /* if a local source is out of date, rebuild all */
125131 if (rebuild)
126132 {
127133 status->setText (tr (" Building ..." ));
128134
135+ QString model = projectOptions->getMemModel ();
136+ if (option.indexOf (BUILDALL_MEMTYPE) == 0 ) {
137+ model = option.mid (option.indexOf (" =" )+1 );
138+ model = " >memtype=" +model;
139+ option = " " ;
140+ for (int n = 0 ; n < list.length (); n++) {
141+ if (list[n].contains (" >memtype" )) {
142+ list[n] = model;
143+ break ;
144+ }
145+ }
146+ }
147+
129148 showCompilerVersion ();
130149
131150 foreach (QString item, list) {
@@ -1203,6 +1222,12 @@ int BuildC::getCompilerParameters(QStringList copts, QStringList *args)
12031222 // boardName = cbBoard->itemText(cbBoard->currentIndex());
12041223
12051224 QString model = projectOptions->getMemModel ();
1225+ QString newmodel;
1226+ if (copts.at (0 ).contains (BUILDALL_MEMTYPE)) {
1227+ QString mopt = copts.at (0 );
1228+ newmodel = mopt.mid (mopt.indexOf (" =" )+1 );
1229+ copts.removeAt (0 );
1230+ }
12061231 model = model.mid (0 ,model.indexOf (" " )); // anything after the first word is just description
12071232
12081233 if (copts.length () > 0 ) {
@@ -1372,12 +1397,34 @@ int BuildC::getCompilerParameters(QStringList copts, QStringList *args)
13721397 if (projectOptions->getStripElf ().length ())
13731398 args->append (projectOptions->getStripElf ());
13741399
1400+ if (newmodel.length () > 0 ) {
1401+ for (int n = 0 ; n < args->length (); n++) {
1402+ QString item = args->at (n);
1403+ if (item.indexOf (model) == 0 ) {
1404+ item.replace (model,newmodel);
1405+ args->removeAt (n);
1406+ args->insert (n,item);
1407+ }
1408+ }
1409+ }
1410+
13751411 return args->length ();
13761412}
13771413
1414+ void BuildC::setMemModel (QString model)
1415+ {
1416+ memModel = model;
1417+ }
1418+
1419+ QString BuildC::getMemModel ()
1420+ {
1421+ return memModel;
1422+ }
1423+
13781424int BuildC::ensureOutputDirectory ()
13791425{
1380- QString modelOption = projectOptions->getMemModel ();
1426+ // QString modelOption = projectOptions->getMemModel();
1427+ QString modelOption = getMemModel ();
13811428 model = modelOption.mid (0 , modelOption.indexOf (" " ));
13821429 model = model.replace (" -" ," _" );
13831430 outputPath = model + separator;
@@ -1414,8 +1461,6 @@ void BuildC::appendLoaderParameters(QString copts, QString file, QStringList *ar
14141461 // qDebug() << args;
14151462}
14161463
1417- #include < directory.h>
1418-
14191464bool BuildC::isOutdated (QStringList srclist, QString srcpath, QString target)
14201465{
14211466 QFile outfile (target);
0 commit comments