wxArrayString DirectCommands::GetTargetCompileCommands(ProjectBuildTarget* target, bool force) const { wxArrayString ret; // set list of #include directories DepsSearchStart(target); // iterate all files of the project/target and add them to the build process size_t counter = ret.GetCount(); MyFilesArray files = GetProjectFilesSortedByWeight(target, true, false); size_t fcount = files.GetCount(); bool hasWeight = false; unsigned short int lastWeight = 0; for (unsigned int i = 0; i < fcount; ++i) { ProjectFile* pf = files[i]; // auto-generated files are handled automatically in GetCompileFileCommand() if (pf->AutoGeneratedBy()) continue; const pfDetails& pfd = pf->GetFileDetails(target); wxString err; if (force || IsObjectOutdated(target, pfd, &err)) { // Add a wait command if the weight of the current file is different from the previous one // Because GetCompileFileCommand() already adds a wait command if it compiled a PCH we // check the last command to prevent two consecutive wait commands if (hasWeight && lastWeight != pf->weight && (ret.IsEmpty() || ret.Last() != COMPILER_WAIT)) ret.Add(COMPILER_WAIT); // compile file wxArrayString filecmd = GetCompileFileCommand(target, pf); AppendArray(filecmd, ret); // Update the weight if (!hasWeight) hasWeight = true; lastWeight = pf->weight; } else { if (!err.IsEmpty()) ret.Add(COMPILER_WARNING_LOG + err); } if (m_doYield) Manager::Yield(); } // add link command wxArrayString link = GetLinkCommands(target, ret.GetCount() != counter); AppendArray(link, ret); return ret; }
wxArrayString DirectCommands::GetTargetCompileCommands(ProjectBuildTarget* target, bool force) { // Manager::Get()->GetLogManager()->DebugLog(wxString("-----GetTargetCompileCommands-----")); wxArrayString ret; // ret.Add(wxString(COMPILER_SIMPLE_LOG) + _("Switching to target: ") + target->GetTitle()); // NOTE: added this to notify compiler about the active target. // this is needed when targets use different compiler each // and C::B tries to parse the compiler's output. // previous behaviour, used the project's compiler for parsing // all targets output, which failed when a target's compiler // was different than the project's... // ret.Add(wxString(COMPILER_TARGET_CHANGE) + target->GetTitle()); m_pCurrTarget = target; // set list of #include directories DepsSearchStart(target); // iterate all files of the project/target and add them to the build process size_t counter = ret.GetCount(); MyFilesArray files = GetProjectFilesSortedByWeight(target, true, false); size_t fcount = files.GetCount(); bool ldcheck = false; for (unsigned int i = 0; i < fcount; ++i) { ProjectFile* pf = files[i]; // auto-generated files are handled automatically in GetCompileFileCommand() if (pf->AutoGeneratedBy()) { continue; } const pfDetails& pfd = pf->GetFileDetails(target); wxString err; if (force || IsObjectOutdated(target, pfd, &err)) { // compile file if(m_pCompiler->GetParentID().Matches(_T("lcy"))) { if(pf->file.GetExt().Lower().IsSameAs(_T("ld"))) { ldcheck= true; } } wxArrayString filecmd = GetCompileFileCommand(target, pf); AppendArray(filecmd, ret); } else { if (!err.IsEmpty()) ret.Add(wxString(COMPILER_SIMPLE_LOG) + err); } if(m_doYield) Manager::Yield(); } // add link command wxArrayString link = GetLinkCommands(target, ldcheck ? ldcheck : ret.GetCount() != counter); AppendArray(link, ret); // remove "switching to target" message if no compile needed // bool needPost = ret.GetCount() != counter; // if (!needPost) // ret.Clear(); return ret; }