@@ -54,6 +54,7 @@ import SimCode;
5454
5555// protected imports
5656protected
57+ import AvlSetString ;
5758import BackendDAECreate ;
5859import Builtin ;
5960import ClockIndexes ;
@@ -608,23 +609,28 @@ protected
608609 partial function PartialRunTpl
609610 output tuple< Boolean ,list< String >> res;
610611 end PartialRunTpl ;
612+ AvlSetString . Tree generatedObjects= AvlSetString . EMPTY ();
611613algorithm
612614 setGlobalRoot(Global . optionSimCode, SOME (simCode));
613615 _ := match target
614616 local
615617 String str, guid;
616618 list< PartialRunTpl > codegenFuncs;
617- Integer numThreads;
619+ Integer numThreads, n ;
618620 list< tuple< Boolean ,list< String >>> res;
619- list< String > strs, tmp;
621+ list< String > strs, tmp, matches ;
620622
621623 case "CSharp" equation
622624 Tpl . tplNoret(CodegenCSharp . translateModel, simCode);
623625 then ();
624626
625- case "Cpp" equation
626- callTargetTemplatesCPP(simCode);
627- then ();
627+ case "Cpp"
628+ algorithm
629+ callTargetTemplatesCPP(simCode);
630+ for str in {"CalcHelperMain.o \n " ,".so \n " } loop
631+ generatedObjects := AvlSetString . add(generatedObjects, "OMCpp" + simCode. fileNamePrefix + str);
632+ end for ;
633+ then ();
628634
629635 case "Adevs" equation
630636 Tpl . tplNoret(CodegenAdevs . translateModel, simCode);
@@ -668,6 +674,14 @@ algorithm
668674 } loop
669675 (func ,str) := f;
670676 codegenFuncs := (function runTplWriteFile(func = function func (a_simCode= simCode), file= simCode. fileNamePrefix + str)) :: codegenFuncs;
677+ (n,matches) := System . regex(str, " \\ (.* \\ )[.]c$" , 2 , false , false );
678+ if n== 2 then
679+ _::str::_ := matches;
680+ generatedObjects := AvlSetString . add(generatedObjects, simCode. fileNamePrefix + str + ".o \n " );
681+ end if ;
682+ end for ;
683+ for str in {"_11mix.o \n " ,"_functions.o \n " ,"_info.json \n " ,"_init.xml \n " } loop
684+ generatedObjects := AvlSetString . add(generatedObjects, simCode. fileNamePrefix + str);
671685 end for ;
672686 codegenFuncs := (function runTpl(func = function CodegenC . simulationFile_mixAndHeader(a_simCode= simCode, a_modelNamePrefix= simCode. fileNamePrefix))) :: codegenFuncs;
673687 codegenFuncs := (function runTplWriteFile(func = function CodegenC . simulationFile(in_a_simCode= simCode, in_a_guid= guid, in_a_isModelExchangeFMU= false ), file= simCode. fileNamePrefix + ".c" )) :: codegenFuncs;
@@ -687,6 +701,14 @@ algorithm
687701 strs := List . append_reverse(tmp, strs);
688702 end for ;
689703 strs := listReverse(strs);
704+ // Some files are only sometimes generated, like initialization when it has >2000 equations
705+ for str in strs loop
706+ (n,matches) := System . regex(str, " \\ (.* \\ )[.]c$" , 2 , false , false );
707+ if n== 2 then
708+ _::str::_ := matches;
709+ generatedObjects := AvlSetString . add(generatedObjects, simCode. fileNamePrefix + str + ".o \n " );
710+ end if ;
711+ end for ;
690712 // write the makefile last!
691713 Tpl . closeFile(Tpl . tplCallWithFailError3(CodegenC . simulationMakefile,Config . simulationCodeTarget(),simCode,strs,txt= Tpl . redirectToFile(Tpl . emptyTxt, simCode. fileNamePrefix+ ".makefile" )));
692714 then ();
@@ -716,6 +738,9 @@ algorithm
716738 Error . addMessage(Error . INTERNAL_ERROR , {str});
717739 then fail();
718740 end match;
741+ if Config . getRunningTestsuite() then
742+ System . appendFile(Config . getRunningTestsuiteFile(), stringAppendList(AvlSetString . listKeys(generatedObjects)));
743+ end if ;
719744 setGlobalRoot(Global . optionSimCode, NONE ());
720745end callTargetTemplates;
721746
0 commit comments