104 style[caption].SetFont(style[error].GetFont());
105 style[error].SetFont(style[info].GetFont());
117 panel->SetSizer(sizer);
147 wxString url = control->GetRange(urlStart, urlEnd);
162 static const wxString strCONSOLE_RUNNER(platform::windows ?
_T(
"cb_console_runner.exe") :
_T(
"cb_console_runner"));
165 static const wxString strQUOTE(platform::windows ?
_T(
"\"") :
_T(
"'"));
280 m_RealTargetsStartIndex(0),
281 m_RealTargetIndex(0),
293 m_RunAfterCompile(false),
295 m_NotifiedMaxErrors(false),
296 m_pBuildingProject(0),
299 m_pLastBuildingProject(0),
300 m_pLastBuildingTarget(0),
303 m_LastBuildStep(true),
304 m_RunTargetPostBuild(false),
305 m_RunProjectPostBuild(false),
306 m_IsWorkspaceOperation(false),
307 m_LogBuildProgressPercentage(false)
320 m_RealTargetsStartIndex = 0;
321 m_RealTargetIndex = 0;
323 m_ListPageIndex = -1;
333 m_RunAfterCompile =
false;
335 m_NotifiedMaxErrors =
false;
336 m_pBuildingProject = 0;
338 m_NextBuildState =
bsNone;
339 m_pLastBuildingProject = 0;
340 m_pLastBuildingTarget = 0;
341 m_RunTargetPostBuild =
false;
342 m_RunProjectPostBuild =
false;
345 m_LastBuildStep =
true;
346 m_IsWorkspaceOperation =
false;
353 DoRegisterCompilers();
361 m_PageIndex = msgMan->
SetLog(m_pLog);
362 msgMan->
Slot(m_PageIndex).
title =
_(
"Build log");
367 msgMan->
Slot(m_PageIndex).
icon = bmp;
372 titles.
Add(
_(
"File"));
373 titles.
Add(
_(
"Line"));
374 titles.
Add(
_(
"Message"));
380 m_pListLog->SetCompilerErrors(&m_Errors);
381 m_ListPageIndex = msgMan->
SetLog(m_pListLog);
382 msgMan->
Slot(m_ListPageIndex).
title =
_(
"Build messages");
385 msgMan->
Slot(m_ListPageIndex).
icon = bmp;
398 m_pLog->AddBuildProgressBar();
407 if (SquirrelVM::GetVMPtr())
443 m_pListLog->DestroyControls();
452 m_timerIdleWakeUp.Stop();
473 m_pLog->AddBuildProgressBar();
475 m_pLog->RemoveBuildProgressBar();
502 DoRecreateTargetMenu();
511 int projMenuPos = menuBar->
FindMenu(
_(
"&Debug"));
513 finalPos = projMenuPos;
516 projMenuPos = menuBar->
FindMenu(
_(
"&Project"));
518 finalPos = projMenuPos + 1;
520 menuBar->
Insert(finalPos, m_Menu,
_(
"&Build"));
523 projMenuPos = menuBar->
FindMenu(
_(
"&Project"));
530 const int idMenuProjectProperties = prj->
FindItem(
_(
"Properties..."));
578 if (IsRunning() || (otherRunning && otherRunning !=
this))
606 if (!IsAttached() || !toolBar)
612 m_pToolTarget = XRCCTRL(*toolBar,
"idToolTarget",
wxChoice);
614 toolBar->SetInitialSize();
615 DoRecreateTargetMenu();
621 int eventId =
event.GetId();
628 OnCompileAndRun(event);
634 OnCompileFile(event);
636 OnCompileFile(event);
649 OnProjectCompilerOptions(event);
651 OnTargetCompilerOptions(event);
659 OnKillProcess(event);
663 OnPreviousError(event);
665 OnClearErrors(event);
671 if ( (ed =
Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor()) )
678 m_pLog->OpenLink(event.
GetURLStart(),
event.GetURLEnd());
688 if (m_CompilerId ==
wxT(
"null"))
699 _(
"Could not read the PATH environment variable!\n" 700 "This can't be good. There may be problems running\n" 701 "system commands and the application might not behave\n" 702 "the way it was designed to..."),
710 const wxString pathApp = platform::windows ?
_T(
";") : _T(
":");
712 const bool caseSens = !(platform::windows);
724 && ((masterPath.
Last() ==
'\\') || (masterPath.
Last() ==
'/')) )
732 pathList.
Add(masterPath + pathSep + _T(
"bin"));
733 pathList.
Add(masterPath);
736 for (
size_t i=0; i<extraPaths.
GetCount(); ++i)
740 while (extraPath.
Last() ==
'\\' || extraPath.
Last() ==
'/')
745 if ( extraPathsBinPath.
IsEmpty()
747 extraPathsBinPath = extraPath;
748 pathList.
Add(extraPath);
755 pathList.
Add(pathArray);
765 if (
wxFileExists(masterPath + pathSep + _T(
"bin") + pathSep + cApp))
766 binPath = masterPath + pathSep + _T(
"bin");
768 binPath = masterPath;
769 else if (!extraPathsBinPath.
IsEmpty())
770 binPath = extraPathsBinPath;
781 _(
"Can't find compiler executable in your configured search path's for ") + compiler->
GetName() + _T(
'\n'));
791 for (
size_t i=0; i<pathList.
GetCount(); ++i)
792 envPath += ( pathApp + pathList[i] );
797 if ( !
wxSetEnv(_T(
"PATH"), envPath) )
800 _(
"Can't set PATH environment variable! That's bad and the compiler might not work."));
811 int ret =
cbMessageBox(
_(
"The debugger must be stopped to do a (re-)build.\n" 812 "Do you want to stop the debugger now?"),
852 if (platform::windows || nonPlatComp)
869 if (platform::windows || platform::Linux || nonPlatComp)
883 compilers.
Add(path + filename);
894 for (
size_t i = 0; i < compilers.
GetCount(); ++i)
896 if (compilers[i].EndsWith(filename))
903 compilers.
Add(path + filename);
907 for (
size_t i = 0; i < compilers.
GetCount(); ++i)
918 if (test ==
wxT(
"windows"))
919 val = platform::windows;
920 else if (test ==
wxT(
"macosx"))
921 val = platform::macosx;
922 else if (test ==
wxT(
"linux"))
923 val = platform::Linux;
924 else if (test ==
wxT(
"freebsd"))
925 val = platform::freebsd;
926 else if (test ==
wxT(
"netbsd"))
927 val = platform::netbsd;
928 else if (test ==
wxT(
"openbsd"))
929 val = platform::openbsd;
930 else if (test ==
wxT(
"darwin"))
931 val = platform::darwin;
932 else if (test ==
wxT(
"solaris"))
933 val = platform::solaris;
934 else if (test ==
wxT(
"unix"))
935 val = platform::Unix;
1003 AskForActiveProject();
1006 if ( m_pProject && m_pProject->GetCompilerID() != m_CompilerId)
1007 SwitchCompiler(m_pProject->GetCompilerID());
1012 return (m_pProject != 0L);
1017 m_pProject = m_pBuildingProject
1018 ? m_pBuildingProject
1026 if (!m_pProject->SaveAllFiles())
1044 AskForActiveProject();
1049 return m_pProject->GetMakefile();
1054 if (m_IsWorkspaceOperation)
1057 if (IsProcessRunning())
1080 AskForActiveProject();
1087 ProjectBuildTarget* bt = m_pBuildingProject ? m_pBuildingProject->GetBuildTarget(GetTargetIndexFromName(m_pBuildingProject, m_BuildingTargetName)) : 0;
1088 m_CurrentProgress = 0;
1090 bool isLink =
false;
1091 bool mustWait =
false;
1092 size_t count = commands.
GetCount();
1093 for (
size_t i = 0; i < count; ++i)
1122 m_CommandQueue.Add(p);
1129 if (m_pLog->progress)
1131 m_pLog->progress->SetRange(m_MaxProgress);
1132 m_pLog->progress->SetValue(m_CurrentProgress);
1140 if (parallel_processes == 0)
1142 m_CompilerProcessList.resize(parallel_processes);
1145 p.pProcess =
nullptr;
1155 m_CompilerProcessList.clear();
1168 if (m_CompilerProcessList.empty() || idx >= (int)m_CompilerProcessList.size())
1173 return (m_CompilerProcessList.at(static_cast<size_t>(idx)).pProcess != 0);
1186 for (
size_t i = 0; i < m_CompilerProcessList.size(); ++i)
1209 int procIndex = GetNextAvailableProcessIndex();
1210 if (procIndex == -1)
1214 if (IsProcessRunning())
1224 if (IsProcessRunning())
1230 BuildStateManagement();
1231 cmd = m_CommandQueue.Next();
1232 if (!cmd && m_BuildState ==
bsNone && m_NextBuildState ==
bsNone)
1234 NotifyJobDone(
true);
1236 if (m_RunAfterCompile)
1238 m_RunAfterCompile =
false;
1269 int ret = DoRunQueue();
1279 wxString msg =
_(
"The #run_script command must be followed by a script filename");
1285 wxString msg =
_(
"Running script: ") + script;
1290 int ret = DoRunQueue();
1296 wxGetEnv(CB_LIBRARY_ENVVAR, &oldLibPath);
1303 flags |= wxEXEC_NOHIDE;
1309 wxSetEnv(CB_LIBRARY_ENVVAR, newLibPath);
1319 if (!platform::windows)
1338 if (!m_CommandQueue.LastCommandWasRun())
1340 if ( !IsProcessRunning() )
1346 m_pListLog->AutoFitColumns(2);
1350 m_pLog->progress->SetValue(0);
1353 m_CommandQueue.Clear();
1357 m_timerIdleWakeUp.Start(100);
1360 wxSetEnv(CB_LIBRARY_ENVVAR, oldLibPath);
1363 return DoRunQueue();
1370 wxMenuItemList& items = m_TargetMenu->GetMenuItems();
1371 for (wxMenuItemList::iterator it = items.begin(); it != items.end(); )
1377 m_TargetMenu->Delete(item);
1392 if ( m_Targets.Index(target) == -1 )
1406 m_pToolTarget->Freeze();
1414 DoClearTargetMenu();
1416 m_pToolTarget->Clear();
1419 if (!CheckProject())
1423 if (!m_Targets.GetCount())
1426 wxString tgtStr(m_pProject->GetFirstValidBuildTargetName());
1431 const wxString preferredTarget = wsp->GetPreferredTarget();
1432 tgtStr = preferredTarget;
1433 if ( !IsValidTarget(tgtStr) )
1434 tgtStr = m_pProject->GetActiveBuildTarget();
1435 if ( !IsValidTarget(tgtStr) )
1436 tgtStr = m_pProject->GetFirstValidBuildTargetName();
1437 if ( preferredTarget.
IsEmpty() )
1438 wsp->SetPreferredTarget(tgtStr);
1444 m_TargetMenu->AppendSeparator();
1448 for (
int x = 0; x < int(m_Targets.size()); ++x)
1453 help.
Printf(
_(
"Build target '%s' in current project"), GetTargetString(x).wx_str());
1457 m_pToolTarget->Append(GetTargetString(x));
1463 _(
"Use the select target menu item to see them!"));
1469 wxEVT_COMMAND_MENU_SELECTED,
1470 (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
1474 m_TargetIndex = m_Targets.Index(tgtStr);
1475 m_RealTargetIndex = m_TargetIndex - m_RealTargetsStartIndex;
1476 if (m_RealTargetIndex < 0)
1477 m_RealTargetIndex = -1;
1479 DoUpdateTargetMenu(m_TargetIndex);
1483 m_pToolTarget->SetSelection(m_TargetIndex);
1486 SwitchCompiler(m_pProject->GetCompilerID());
1493 m_pToolTarget->Thaw();
1499 m_TargetIndex = targetIndex;
1500 m_RealTargetIndex = m_TargetIndex - m_RealTargetsStartIndex;
1501 if (m_RealTargetIndex < 0)
1502 m_RealTargetIndex = -1;
1504 if (m_TargetIndex == -1)
1508 m_pProject->SetActiveBuildTarget(GetTargetString(m_TargetIndex));
1518 item->
Check(i == m_TargetIndex);
1536 for (
size_t i = 0; i < virtuals.
GetCount(); ++i)
1537 m_Targets.
Add(virtuals[i]);
1547 m_RealTargetsStartIndex = virtuals.
GetCount();
1550 DoRecreateTargetMenu();
1556 index = m_TargetIndex;
1557 if (index >= 0 && index < (
int)m_Targets.GetCount())
1558 return m_Targets[index];
1564 if (m_CommandQueue.GetCount() == 0)
1582 if (m_CommandQueue.GetCount() == 0)
1593 if (m_CommandQueue.GetCount() == 0)
1603 if (!CheckProject())
1606 return m_pProject->GetBuildTarget(m_RealTargetIndex);
1611 if (!CheckProject())
1614 return m_pProject->SelectTarget(m_RealTargetIndex);
1620 project = m_pProject;
1634 if (m_pBuildingProject)
1635 return m_pBuildingProject->GetCompilerID();
1637 return m_pProject->GetCompilerID();
1648 wxString idx = GetCurrentCompilerID(target);
1658 wxString compilerName, compilerName2(
wxT(
"unknown"));
1662 compilerName2 = compiler->
GetName();
1669 title =
wxT(
"unknown");
1672 msg.
Printf(
_T(
"Project/Target: \"%s\":\n")
1673 _T(
" The compiler's setup %sis invalid, so Code::Blocks cannot find/run the compiler.\n")
1674 _T(
" Probably the toolchain path within the compiler options is not setup correctly?!\n")
1675 _T(
" Do you have a compiler installed?\n")
1676 _T(
"Goto \"Settings->Compiler...->Global compiler settings->%s->Toolchain executables\"")
1677 _T(
" and fix the compiler's setup.\n"),
1681 logger->
LogError(msg, m_PageIndex);
1684 logger->
LogError(finalMessage, m_PageIndex);
1689 if (!CompilerValid(target).isValid)
1702 Action =
_(
"Clean");
1708 Action =
_(
"Build file");
1712 Action =
_(
"Build");
1719 compilerName = compiler->
GetName();
1725 banner.
Printf(
_(
"%s: %s in %s (compiler: %s)"),
1728 LogMessage(
wxT(
"-------------- ") + banner +
wxT(
"---------------"),
cltNormal,
ltAll,
false,
true);
1729 m_pListLog->AutoFitColumns(2);
1738 m_pListLog->FocusError(m_Errors.GetFocusedError());
1746 m_Errors.Previous();
1747 m_pListLog->FocusError(m_Errors.GetFocusedError());
1753 m_pListLog->Clear();
1754 m_NotifiedMaxErrors =
false;
1761 if (fname.
GetExt() ==
_T(
"script"))
1772 if (!platform::windows)
1776 term.
Replace(
_T(
"$TITLE"),
_T(
"'") + exe_filename +
_T(
"'"));
1777 command << term << strSPACE;
1781 wxString crunnStr = strQUOTE + baseDir + strSLASH + strCONSOLE_RUNNER + strQUOTE;
1782 if (
wxFileExists(baseDir + strSLASH + strCONSOLE_RUNNER) )
1783 command << crunnStr << strSPACE;
1785 if (!command.
Replace(
_T(
"$SCRIPT"), exe_filename))
1786 command << strQUOTE << exe_filename << strQUOTE;
1791 int ret =
cbMessageBox(
_(
"It seems that this file has not been built yet.\n" 1792 "Do you want to build it now?"),
1799 m_RunAfterCompile =
true;
1818 if (!CheckProject())
1820 return Run(m_pProject->GetBuildTarget(target.
IsEmpty() ? m_LastTargetName : target));
1825 bool commandIsQuoted =
false;
1826 if (!CheckProject())
1828 if (
Manager::Get()->GetEditorManager()->GetActiveEditor())
1829 return RunSingleFile(
Manager::Get()->GetEditorManager()->GetActiveEditor()->GetFilename());
1834 target = m_pProject->GetBuildTarget(m_pProject->GetActiveBuildTarget());
1836 PrintBanner(
baRun, m_pProject, target);
1838 DoPrepareQueue(
false);
1845 PrintInvalidCompiler(target, result.
compiler,
_(
"Run aborted..."));
1853 if (m_RealTargetIndex == -1)
1856 int bak = m_RealTargetIndex;
1857 if (m_pProject->GetBuildTargetsCount() == 1)
1860 idx = DoGUIAskForTarget();
1862 m_RealTargetIndex = idx;
1863 target = DoAskForTarget();
1864 m_RealTargetIndex = bak;
1867 target = DoAskForTarget();
1874 m_pProject->SetCurrentlyCompilingTarget(target);
1892 wxString titleStr = platform::windows
1893 ? strQUOTE + m_pProject->GetTitle() + strQUOTE
1895 wxString dirStr = platform::windows
1896 ? strQUOTE + m_CdRun + strQUOTE
1898 wxString crunnStr = platform::windows
1899 ? strQUOTE + baseDir + strSLASH + strCONSOLE_RUNNER + strQUOTE
1900 :
EscapeSpaces(baseDir + strSLASH + strCONSOLE_RUNNER);
1901 wxString hostapStr = platform::windows
1904 wxString execStr = platform::windows
1912 if (!platform::windows)
1918 cmd << term << strSPACE;
1931 command << strQUOTE;
1932 commandIsQuoted =
true;
1938 if (
wxFileExists(baseDir + strSLASH + strCONSOLE_RUNNER))
1940 command << crunnStr << strSPACE;
1942 if (!platform::windows)
1945 command << CB_LIBRARY_ENVVAR <<
_T(
"=$") << CB_LIBRARY_ENVVAR <<
_T(
':');
1949 command << strLinkerPath << strSPACE;
1961 cbMessageBox(
_(
"You must select a host application to \"run\" a library..."));
1962 m_pProject->SetCurrentlyCompilingTarget(0);
1966 command << hostapStr << strSPACE;
1971 command << execStr << strSPACE;
1976 if (commandIsQuoted)
1977 command << strQUOTE;
1984 cbMessageBox(
_(
"You must select a host application to \"run\" a commands-only target..."));
1985 m_pProject->SetCurrentlyCompilingTarget(0);
1988 command << hostapStr << strSPACE;
1996 if (platform::macosx)
2000 script = script.
Mid(1,script.
length()-2);
2003 script.
Replace(
_T(
"\""),
_T(
"\""e&\""),
true);
2004 script.
Replace(
_T(
"\'"),
_T(
"\"&ASCII character 39&\""),
true);
2007 if (!cmd.
Replace(
_T(
"$SCRIPT"), script))
2014 int ret =
cbMessageBox(
_(
"It seems that this project has not been built yet.\n" 2015 "Do you want to build it now?"),
2022 m_pProject->SetCurrentlyCompilingTarget(0);
2023 m_RunAfterCompile =
true;
2030 m_pProject->SetCurrentlyCompilingTarget(0);
2038 m_pProject->SetCurrentlyCompilingTarget(0);
2067 for (
unsigned int i = 0; i < commands.
GetCount(); ++i)
2073 return Clean(target ? target->
GetTitle() :
_T(
""));
2078 m_LastBuildStep =
true;
2079 return DoBuild(target,
true,
false);
2093 wxT(
"Make command for 'Clean project/target' is empty. Nothing will be cleaned!"),
2118 for(
size_t i = 0; i < output.
GetCount(); i++)
2119 LogMessage(
F(
_(
"%s"), output[i].wx_str()),
cltNormal);
2120 for(
size_t i = 0; i < errors.
GetCount(); i++)
2121 LogMessage(
F(
_(
"%s"), errors[i].wx_str()),
cltNormal);
2124 return (result == 0);
2129 if (!CheckProject())
2131 return DistClean(m_pProject->GetBuildTarget(target.
IsEmpty() ? m_LastTargetName : target));
2137 if (m_pProject && !m_pProject->SaveAllFiles())
2140 if (!m_IsWorkspaceOperation)
2141 DoPrepareQueue(
true);
2142 if (!CompilerValid(target).isValid)
2154 return DoRunQueue();
2158 NotImplemented(
_T(
"CompilerGCC::DistClean() without a custom Makefile"));
2169 m_pBuildingProject = 0;
2170 m_pLastBuildingProject = 0;
2171 m_pLastBuildingTarget = 0;
2172 m_BuildingTargetName = target;
2173 m_CommandQueue.
Clear();
2178 if (m_pBuildingProject)
2179 m_pBuildingProject->SetCurrentlyCompilingTarget(0);
2180 else if (m_pProject)
2181 m_pProject->SetCurrentlyCompilingTarget(0);
2186 m_NextBuildState =
bsNone;
2187 m_pBuildingProject = 0;
2188 m_BuildingTargetName.Clear();
2190 m_pLastBuildingProject = 0;
2191 m_pLastBuildingTarget = 0;
2193 m_CommandQueue.Clear();
2200 for (
size_t i = 0; i < arr->GetCount(); ++i)
2202 arr->Item(i)->SetCurrentlyCompilingTarget(0);
2221 return _T(
"Huh!?!");
2226 bool clean = m_Clean;
2227 bool build = m_Build;
2229 switch (m_BuildState)
2233 if (clean && !build)
2276 if (clean && !build)
2288 m_pBuildingProject->SetCurrentlyCompilingTarget(0);
2298 if (m_pBuildingProject)
2299 m_pBuildingProject->SetCurrentlyCompilingTarget(0);
2302 if (DoBuild(clean, build) >= 0)
2304 if (clean && !build)
2323 if (IsProcessRunning())
2327 if (!m_pBuildingProject)
2333 ProjectBuildTarget* bt = m_pBuildingProject->GetBuildTarget(GetTargetIndexFromName(m_pBuildingProject, m_BuildingTargetName));
2340 if (m_pBuildingProject != m_pLastBuildingProject || bt != m_pLastBuildingTarget)
2346 if (m_pBuildingProject != m_pLastBuildingProject)
2348 m_pLastBuildingProject = m_pBuildingProject;
2351 if (bt != m_pLastBuildingTarget)
2352 m_pLastBuildingTarget = bt;
2355 m_pBuildingProject->SetCurrentlyCompilingTarget(bt);
2359 m_BuildState = m_NextBuildState;
2361 switch (m_NextBuildState)
2381 PrintBanner(
baClean, m_pBuildingProject, bt);
2384 if ( UseMake(m_pBuildingProject) )
2385 result = DoCleanWithMake(bt);
2395 const wxString &message =
F(
_(
"Cleaned \"%s - %s\""), m_pBuildingProject->GetTitle().
wx_str(),
2401 const wxString &message =
F(
_(
"Error cleaning \"%s - %s\""), m_pBuildingProject->GetTitle().
wx_str(),
2410 PrintBanner(
baBuild, m_pBuildingProject, bt);
2413 if ( UseMake(m_pBuildingProject) )
2422 bool runMake =
false;
2423 if (!askCmd.empty())
2433 _(
"The command that asks if a rebuild is needed is empty. Assuming rebuild is needed!"));
2437 if (runMake && tgtCompiler)
2439 bool isEmpty =
false;
2444 const wxString &cmd = GetMakeCommandFor(
mcBuild, m_pBuildingProject, bt);
2474 _(
"Make command for 'Build/Project target' is empty. Nothing will be built!"));
2482 bool hasCommands = cmds.
GetCount();
2483 m_RunTargetPostBuild = hasCommands;
2484 m_RunProjectPostBuild = hasCommands;
2486 LogMessage(
_(
"Target is up to date."));
2496 m_RunTargetPostBuild =
false;
2503 if (m_RunProjectPostBuild || m_pBuildingProject->GetAlwaysRunPostBuildSteps())
2506 m_pLastBuildingTarget = 0;
2507 m_RunProjectPostBuild =
false;
2513 m_pLastBuildingProject = 0;
2522 m_NextBuildState = GetNextStateBasedOnJob();
2523 AddToCommandQueue(cmds);
2547 result.
Add(targetName);
2558 if (!m_IsWorkspaceOperation)
2560 while (!m_BuildJobTargetsList.empty())
2561 m_BuildJobTargetsList.pop();
2567 CalculateWorkspaceDependencies(deps);
2569 CalculateProjectDependencies(project, deps);
2573 for (
size_t i = 0; i < deps.GetCount(); ++i)
2580 msg.
Printf(
_T(
"\"%s\" does not support the current platform. Skipping..."),
2586 ExpandTargets(prj, targetName, tlist);
2592 for (
size_t x = 0; x < tlist.
GetCount(); ++x)
2598 PrintInvalidCompiler(tgt, result.
compiler,
_T(
"Skipping..."));
2604 msg.
Printf(
_T(
"\"%s - %s\" does not support the current platform. Skipping..."),
2613 m_BuildJobTargetsList.push(bjt);
2620 if (m_BuildJobTargetsList.empty())
2621 NotifyJobDone(
true);
2629 if (m_BuildJobTargetsList.empty())
2631 ret = m_BuildJobTargetsList.front();
2632 m_BuildJobTargetsList.pop();
2640 if (m_BuildJobTargetsList.empty())
2642 return m_BuildJobTargetsList.front();
2655 && (bj.
project != m_pBuildingProject)
2661 m_pBuildingProject = bj.
project;
2668 if (!bt || !CompilerValid(bt).isValid)
2671 BuildStateManagement();
2680 for (
size_t i = 0; i < arr->GetCount(); ++i)
2682 CalculateProjectDependencies(arr->Item(i), deps);
2690 if (!arr || !arr->GetCount())
2701 for (
size_t i = 0; i < arr->GetCount(); ++i)
2704 if (!
Manager::Get()->GetProjectManager()->CausesCircularDependency(prj, thisprj))
2707 CalculateProjectDependencies(thisprj, deps);
2711 int idx = parr->Index(thisprj);
2738 realTarget = GetTargetString();
2740 if (!StopRunningDebugger())
2743 if (!CheckProject())
2754 if (!m_IsWorkspaceOperation)
2757 InitBuildLog(
false);
2758 DoPrepareQueue(clearLog);
2760 NotifyCleanProject(realTarget);
2763 PreprocessJob(m_pProject, realTarget);
2764 if (m_BuildJobTargetsList.empty())
2768 if (DoBuild(clean, build))
2771 return DoRunQueue();
2776 m_LastBuildStep =
true;
2777 return DoBuild(target,
false,
true);
2782 return Build(target ? target->
GetTitle() :
_T(
""));
2787 return Rebuild(target ? target->
GetTitle() :
_T(
""));
2793 if (m_LastBuildStep)
2794 return DoBuild(target,
true,
true);
2796 int result = DoBuild(target,
true,
false);
2797 m_LastBuildStep =
true;
2798 return result + DoBuild(target,
false,
true,
false);
2805 realTarget = GetTargetString();
2809 if (!StopRunningDebugger())
2812 DoPrepareQueue(clearLog);
2814 NotifyCleanWorkspace();
2815 m_IsWorkspaceOperation =
true;
2823 for (
size_t i = 0; i < arr->GetCount(); ++i)
2832 PreprocessJob(0, realTarget);
2833 if (m_BuildJobTargetsList.empty())
2838 DoBuild(clean,build);
2839 m_IsWorkspaceOperation =
false;
2841 return DoRunQueue();
2846 return DoWorkspaceBuild(target,
false,
true);
2852 if (m_LastBuildStep)
2853 return DoWorkspaceBuild(target,
true,
true);
2855 int result = DoWorkspaceBuild(target,
true,
false);
2856 m_LastBuildStep =
true;
2857 return result + DoWorkspaceBuild(target,
false,
true,
false);
2862 return DoWorkspaceBuild(target,
true,
false);
2868 m_RunAfterCompile =
false;
2869 if (!IsProcessRunning())
2871 if (!m_CommandQueue.LastCommandWasRun())
2875 m_CommandQueue.Clear();
2882 #if defined(WIN32) && defined(ENABLE_SIGTERM) 2883 ::GenerateConsoleCtrlEvent(0, p.PID);
2887 p.pProcess->CloseOutput();
2893 if (!platform::windows)
2925 return m_BuildJob !=
bjIdle || IsProcessRunning() || m_CommandQueue.GetCount();
2940 if (m_RealTargetIndex == -1)
2942 int idx = DoGUIAskForTarget();
2945 return m_pProject->GetBuildTarget(idx);
2950 const wxString &targetName = m_Targets[m_TargetIndex];
2953 return m_pProject->GetBuildTarget(targetName);
2960 DoPrepareQueue(
false);
2962 ProjectFile* pf = m_pProject ? m_pProject->GetFileByFilename(file,
true,
false) : 0;
2967 if ( !CompilerValid(bt).isValid )
2970 return CompileFileWithoutProject(file);
2973 const wxString err(
_(
"error: Cannot find target for file"));
2980 return CompileFileDefault(m_pProject, pf, bt);
2997 AddToCommandQueue(compile);
2999 return DoRunQueue();
3016 AddToCommandQueue(compile);
3018 return DoRunQueue();
3025 if (IsProcessRunning())
3029 if (p.pProcess && (static_cast<PipedProcess*>(p.pProcess))->HasInput())
3031 event.RequestMore();
3054 m_RunAfterCompile =
true;
3060 int bak = m_RealTargetIndex;
3065 DoSwitchProjectTemporarily();
3069 m_RealTargetIndex = bak;
3077 PrepareCompileFilePM(file);
3079 PrepareCompileFile(file);
3081 StartCompileFile(file);
3101 if ( !CheckProject() )
3128 _(
"Rebuilding the project will cause the deletion of all " 3129 "object files and building it from scratch.\nThis action " 3130 "might take a while, especially if your project contains " 3131 "more than a few files.\nAnother factor is your CPU " 3132 "and the available system memory.\n\n" 3133 "Are you sure you want to rebuild the entire project?"),
3138 int bak = m_RealTargetIndex;
3143 DoSwitchProjectTemporarily();
3147 m_RealTargetIndex = bak;
3158 _(
"Rebuilding ALL the open projects will cause the deletion of all " 3159 "object files and building them from scratch.\nThis action " 3160 "might take a while, especially if your projects contain " 3161 "more than a few files.\nAnother factor is your CPU " 3162 "and the available system memory.\n\n" 3163 "Are you sure you want to rebuild ALL the projects?"),
3174 _(
"Cleaning ALL the open projects will cause the deletion " 3175 "of all relevant object files.\nThis means that you will " 3176 "have to build ALL your projects from scratch next time you " 3177 "'ll want to build them.\nThat action " 3178 "might take a while, especially if your projects contain " 3179 "more than a few files.\nAnother factor is your CPU " 3180 "and the available system memory.\n\n" 3181 "Are you sure you want to proceed to cleaning?"),
3193 _(
"Cleaning the target or project will cause the deletion " 3194 "of all relevant object files.\nThis means that you will " 3195 "have to build your project from scratch next time you " 3196 "'ll want to build it.\nThat action " 3197 "might take a while, especially if your project contains " 3198 "more than a few files.\nAnother factor is your CPU " 3199 "and the available system memory.\n\n" 3200 "Are you sure you want to proceed to cleaning?"),
3205 int bak = m_RealTargetIndex;
3210 DoSwitchProjectTemporarily();
3214 m_RealTargetIndex = bak;
3228 if (currentProject == m_pProject)
3230 if (m_RealTargetIndex != -1)
3231 target = m_pProject->GetBuildTarget(m_RealTargetIndex);
3233 else if (m_RealTargetIndex != -1 && m_pProject)
3242 Configure(currentProject, target);
3253 int bak = m_RealTargetIndex;
3255 int idx = DoGUIAskForTarget();
3259 m_RealTargetIndex = idx;
3262 DoSwitchProjectTemporarily();
3265 m_RealTargetIndex = bak;
3266 Configure(m_pProject, target);
3277 bool updateTools =
false;
3281 selection =
event.GetSelection();
3288 _(
"Choose target:"));
3304 DoUpdateTargetMenu(selection);
3306 m_pToolTarget->SetSelection(selection);
3317 DoGotoPreviousError();
3330 bool running = IsRunning();
3333 bool otherRunning = runningPlugin && runningPlugin !=
this;
3372 m_pToolTarget = XRCCTRL(*tbar,
"idToolTarget",
wxChoice);
3374 m_pToolTarget->Enable(!running && prj && !otherRunning);
3424 wx_filename.
Assign(ed_filename);
3453 CompileFileDefault(prj, pf, bt);
3479 const int index =
event.GetX();
3480 OnJobEnd(index, event.GetInt());
3488 for (
size_t i = 0; i<ignore_output.
GetCount(); ++i)
3505 if (maxErrors > 0 && m_Errors.GetCount(
cltError) == maxErrors)
3508 LogMessage(output, clt,
ltFile, forceErrorColour);
3510 if (!m_NotifiedMaxErrors)
3512 m_NotifiedMaxErrors =
true;
3528 wxFileName last_error_file(last_error_filename);
3532 if (m_pLastBuildingTarget)
3533 project = m_pLastBuildingTarget->GetParentProject();
3536 AskForActiveProject();
3537 project = m_pProject;
3541 last_error_filename = last_error_file.
GetFullPath();
3546 LogWarningOrError(clt, m_pBuildingProject, last_error_filename, compiler->
GetLastErrorLine(), msg);
3550 LogMessage(output, clt,
ltAll, forceErrorColour);
3557 errors.
Add(filename);
3572 m_pListLog->Append(errors, lv, 2);
3575 m_pListLog->Append(errors, lv);
3578 m_Errors.AddError(lt, prj, filename, line.
IsEmpty() ? 0 : atoi(wxSafeConvertWX2MB(line.
wc_str())), msg);
3610 if (forceErrorColour)
3611 m_BuildLogContents <<
_T(
"<font color=\"#a00000\">");
3613 m_BuildLogContents << _T(
"<font color=\"#ff0000\">");
3615 m_BuildLogContents << _T(
"<font color=\"#0000ff\">");
3618 m_BuildLogContents << _T(
"<b>");
3626 sQuoted.
Replace(sGA, _T(
"\""),
true);
3627 sQuoted.
Replace(sAA, _T(
"\""),
true);
3629 sQuoted.
Replace(_T(
"&"), _T(
"&"),
true);
3630 sQuoted.
Replace(_T(
"<"), _T(
"<"),
true);
3631 sQuoted.
Replace(_T(
">"), _T(
">"),
true);
3632 m_BuildLogContents << sQuoted;
3635 m_BuildLogContents << _T(
"</b>");
3638 m_BuildLogContents << _T(
"</font>");
3640 m_BuildLogContents << _T(
"<br />\n");
3647 if (forceErrorColour)
3655 if (updateProgress && m_CurrentProgress < m_MaxProgress)
3657 ++m_CurrentProgress;
3658 if (m_LogBuildProgressPercentage)
3660 float p = (float)(m_CurrentProgress * 100.0f) / (float)m_MaxProgress;
3661 progressMsg.
Printf(
_T(
"[%5.1f%%] "), p);
3663 if (m_pLog->progress)
3665 m_pLog->progress->SetRange(m_MaxProgress);
3666 m_pLog->progress->SetValue(m_CurrentProgress);
3680 if (!workspaceBuild && m_pProject)
3682 title = m_pProject->GetTitle();
3683 basepath = m_pProject->GetBasePath();
3684 basename =
wxFileName(m_pProject->GetFilename()).GetName();
3686 else if (workspaceBuild)
3695 basename =
_T(
"unnamed");
3699 m_BuildLogTitle = title +
_(
" build log");
3700 m_BuildLogFilename = basepath;
3701 m_BuildLogFilename << basename <<
_T(
"_build_log.html");
3702 m_BuildLogContents.Clear();
3704 m_CurrentProgress = 0;
3710 if (!
Manager::Get()->GetConfigManager(
_T(
"compiler"))->ReadBool(
_T(
"/save_html_build_log"),
false))
3713 if (m_BuildLogFilename.IsEmpty())
3727 f.
Write(
_T(
"<title>") + m_BuildLogTitle +
_T(
"</title>\n"));
3728 f.
Write(
_T(
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"));
3737 f.
Write(
_(
"Build started on: "));
3739 f.
Write(m_BuildStartTime.Format(
_T(
"%d-%m-%Y at %H:%M.%S")));
3741 f.
Write(
_(
"Build ended on: "));
3747 f.
Write(m_BuildLogContents);
3757 wxString tempBuildLogFilename = m_BuildLogFilename;
3758 tempBuildLogFilename.
Replace(
_(
"\\"),
_(
"/"));
3759 wxURI tmpFilename = tempBuildLogFilename;
3767 m_timerIdleWakeUp.Stop();
3773 if (m_LastExitCode == 0 || exitCode != 0)
3774 m_LastExitCode = exitCode;
3775 bool success(exitCode == 0);
3778 success = (exitCode >= 0) && (exitCode <= compiler->GetSwitches().statusSuccess);
3781 if (success && !oFile.
IsEmpty())
3787 size_t size = f.
Length();
3794 displaySize = (float)size;
3797 else if (size < 1048576)
3799 displaySize = (float)size / 1024.0f;
3804 displaySize = (float)size / 1048576.0f;
3808 msg.
Printf(
_(
"Output file is %s with size %.2f %s"), oFile.
wx_str(), displaySize, units.
wx_str());
3814 if (m_CommandQueue.GetCount() != 0 && success)
3820 if (IsProcessRunning())
3828 BuildStateManagement();
3829 if (m_CommandQueue.GetCount())
3834 if (m_BuildState ==
bsNone && m_NextBuildState ==
bsNone)
3838 m_CommandQueue.Clear();
3841 while (!m_BuildJobTargetsList.empty())
3842 m_BuildJobTargetsList.pop();
3845 if (m_LastExitCode == exitCode)
3847 if (!m_CommandQueue.LastCommandWasRun())
3849 if ( !IsProcessRunning() )
3851 msg =
wxString::Format(
_(
"%s (%s)"), GetErrWarnStr().wx_str(), GetMinSecStr().wx_str());
3852 success = (m_LastExitCode >= 0) && (m_LastExitCode <= compiler->GetSwitches().statusSuccess);
3856 wxString(m_LastExitCode == 0 ?
_(
"finished") :
_(
"failed")).wx_str(), msg.
wx_str()));
3857 m_pListLog->AutoFitColumns(2);
3861 m_pLog->progress->SetValue(0);
3884 if (
Manager::Get()->GetConfigManager(
_T(
"message_manager"))->ReadBool(
_T(
"/auto_focus_build_errors"),
true))
3885 m_pListLog->FocusError(m_Errors.GetFirstError());
3889 if (m_RunAfterCompile)
3891 m_RunAfterCompile =
false;
3900 if (evtGetActive.
logger == m_pLog)
3921 m_RunAfterCompile =
false;
3932 if (!m_LastBuildStep)
3936 if (showNothingToBeDone && m_Errors.GetCount(
cltError) == 0)
3938 LogMessage(m_Clean ?
_(
"Done.\n") :
_(
"Nothing to be done (all items are up-to-date).\n"));
3944 if (!IsProcessRunning())
3955 evt.SetInt(m_LastExitCode);
3964 #ifdef NO_TRANSLATION 3971 #endif // NO_TRANSLATION 3977 int mins = elapsed / 60;
3978 int secs = (elapsed % 60);
3979 #ifdef NO_TRANSLATION 3985 #endif // NO_TRANSLATION
ProjectFile * GetFileByFilename(const wxString &filename, bool isRelative=true, bool isUnixFilename=false)
Access a file of the project.
void OnKillProcess(wxCommandEvent &event)
A simple dialog that wraps a cbConfigurationPanel.
void OnJobEnd(size_t procIndex, int exitCode)
const wxString COMPILER_SIMPLE_LOG(_T("SLOG:"))
wxString F(const wxChar *msg,...)
sprintf-like function
void OnCompileFileRequest(CodeBlocksEvent &event)
virtual bool IsRunning() const
Is the plugin currently compiling?
wxString FindAbsoluteValidPath(const wxString &file) const
static void Display(const wxString &title, const wxString &message, unsigned int delay=5000, unsigned int hysteresis=1)
CompilerLoggingType logging
virtual void OnRelease(bool appShutDown)
wxString relativeToCommonTopLevelPath
The relative filename to the common top-level path.
bool IsValidTarget(const wxString &target) const
void TextURL(wxTextUrlEvent &event)
cbDebuggerPlugin * GetActiveDebugger()
const BuildJobTarget & PeekNextJob()
void Remove(const wxString &sz)
EVTIMPORT const wxEventType cbEVT_WORKSPACE_CLOSING_COMPLETE
static wxString GetFolder(SearchDirs dir)
Access one of Code::Blocks' folders.
bool wxGetEnv(const wxString &var, wxString *value)
virtual bool Detach(wxWindow *window)
bool Matches(const wxString &mask) const
void gBuildLog(const wxString &msg)
static bool IsValidCompilerID(const wxString &id)
virtual int Clean(const wxString &target)
Same as Clean(ProjectBuildTarget*) but with a wxString argument.
PluginManager * GetPluginManager() const
void PrepareCompileFilePM(wxFileName &file)
bool wxRemoveFile(const wxString &file)
void OpenLink(long urlStart, long urlEnd)
Data folder in user's dir.
virtual wxString GetLastError()
Returns warning/error actual string.
virtual const wxString & GetMasterPath() const
Get the compiler's master path (must contain "bin", "include" and "lib")
void UpdateProjectTargets(cbProject *project)
wxString relativeFilename
The relative (to the project) filename of this file.
virtual bool GetUseConsoleRunner() const
Valid only for targets generating a console executable.
wxFileOffset Length() const
void SetIsRunning(cbPlugin *plugin)
This method should be called when the applications is started by a plugin.
static bool LoadResource(const wxString &file)
void Delete(std::vector< T > &s)
void Assign(const wxFileName &filepath)
bool IsProcessRunning(int idx=-1) const
ConfigManager * GetConfigManager(const wxString &name_space) const
wxXmlNode * GetRoot() const
void DebugLogError(const wxString &msg)
void OnProjectCompilerOptions(wxCommandEvent &event)
void DoRegisterCompilers()
int ReadInt(const wxString &name, int defaultVal=0)
Base class for debugger plugins.
void OnConfig(wxCommandEvent &event)
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
void SetBuildTargetName(const wxString &target)
BuildState
Defines the current state of the compiler.
virtual const wxString & GetExecutionParameters() const
Read the target's execution parameters.
EVTIMPORT const wxEventType cbEVT_COMPILER_FINISHED
void OnCleanFile(wxCommandEvent &event)
DLLIMPORT const wxString DEFAULT_CONSOLE_TERM
void OnCompileAll(wxCommandEvent &event)
virtual const wxString & GetHostApplication() const
Read the target's host application.
EVTIMPORT const wxEventType cbEVT_CLEAN_PROJECT_STARTED
void AddToCommandQueue(const wxArrayString &commands)
void SwitchCompiler(const wxString &id)
bool GetAttribute(const wxString &attrName, wxString *value) const
bool GetFirst(wxString *filename, const wxString &filespec=wxEmptyString, int flags=wxDIR_DEFAULT) const
DLLIMPORT wxBitmap cbLoadBitmap(const wxString &filename, wxBitmapType bitmapType=wxBITMAP_TYPE_PNG)
This function loads a bitmap from disk.
static wxTimeSpan Seconds(wxLongLong sec)
bool wxFileExists(const wxString &filename)
const wxString & GetObjName()
void OnRebuild(wxCommandEvent &event)
void LogWarning(const wxString &msg, int i=app_log)
wxFileName file
The full filename of this file.
static Compiler * GetDefaultCompiler()
void DoClean(const wxArrayString &commands)
void OnNextError(wxCommandEvent &event)
void PrintBanner(BuildAction action, cbProject *prj=0, ProjectBuildTarget *target=0)
bool mustWait
wait for all previous commands to finish (for parallel builds).
bool ReadBool(const wxString &name, bool defaultVal=false)
virtual wxString GetFilename() const
Get the workspace file's name.
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
wxWindow * CreateControl(wxWindow *parent) override
void LogToStdOut(const wxString &msg, Logger::level lv=Logger::info)
wxString MakeInvalidCompilerMessages() const
Returns messages which might be useful to the use for debugging why the compiler is invalid...
void OnTargetCompilerOptions(wxCommandEvent &event)
EVTIMPORT const wxEventType cbEVT_PROJECT_ACTIVATE
Event used to request from the main app to add a log.
bool Open(const wxString &dir)
wxString StateToString(BuildState bs)
const wxString COMPILER_ERROR_ID_LOG
virtual void OnAttach()
Any descendent plugin should override this virtual method and perform any necessary initialization...
bool wxDirExists(const wxString &dirname)
wxString GetExecutionDir()
static Compiler * GetCompiler(size_t index)
wxWindow * CreateControl(wxWindow *parent) override
void OnProjectActivated(CodeBlocksEvent &event)
BuildState GetNextStateBasedOnJob()
FileType
Known file types.
cbProject * GetProject() const
static const wxString & GetDefaultCompilerID()
int GetNextAvailableProcessIndex() const
virtual int BuildWorkspace(const wxString &target=wxEmptyString)
Build all open projects.
virtual int RunSingleFile(const wxString &filename)
void DoPrepareQueue(bool clearLog)
const wxString & GetCurrentCompilerID()
cbProjectManagerUI & GetUI()
void OnSelectTarget(wxCommandEvent &event)
wxString GetTargetString(int index=-1)
void BuildStateManagement()
This uses m_BuildJob.
virtual int CompileFileWithoutProject(const wxString &file)
void OnCleanAll(wxCommandEvent &event)
virtual int CleanWorkspace(const wxString &target=wxEmptyString)
Clean all open projects.
ProjectBuildTarget * DoAskForTarget()
bool IsAbsolute(wxPathFormat format=wxPATH_NATIVE) const
DLLIMPORT FileType FileTypeOf(const wxString &filename)
#define wxICON_INFORMATION
virtual wxTreeItemData * GetItemData(const wxTreeItemId &item) const
ProjectFile * GetProjectFile() const
wxString & Remove(size_t pos)
void CalculateWorkspaceDependencies(wxArrayInt &deps)
virtual int RebuildWorkspace(const wxString &target=wxEmptyString)
Rebuild all open projects.
const wxString COMPILER_WARNING_ID_LOG
void UpdateSettings() override
const wxString & GetName() const
void NotifyMissingFile(const wxString &name)
wxString AfterFirst(wxUniChar ch) const
Base class for mime plugins.
void NotifyJobDone(bool showNothingToBeDone=false)
virtual wxString GetLastErrorLine()
Returns warning/error line number (as a string).
static void UnregisterCompilers()
Unregister all compilers.
Represents a file in a Code::Blocks project.
const wxString COMPILER_TARGET_CHANGE(_T("TGT:"))
EVTIMPORT const wxEventType cbEVT_CLEAN_WORKSPACE_STARTED
bool isRun
if it's a command to run the target.
wxArrayString ReadArrayString(const wxString &name)
A generic Code::Blocks event.
virtual wxString GetOutputFilename()
Read the target's output filename.
wxString ProjectMakefile()
void Dispatcher(wxCommandEvent &event)
Base class for compiler plugins.
virtual wxString GetFullTitle() const
CompilerLineType
Enum categorizing compiler's output line as warning/error/info/normal.
void OnProjectLoaded(CodeBlocksEvent &event)
wxArrayString GetCompileSingleFileCommand(const wxString &filename) const
This is to be used only for files not belonging to a project!!!
cbMimePlugin * GetMIMEHandlerForFile(const wxString &filename)
FileTreeData * DoSwitchProjectTemporarily()
virtual bool GetRunHostApplicationInTerminal() const
Get the flag if the host app should be run in terminal.
EditorManager * GetEditorManager() const
wxLongLong wxGetLocalTimeMillis()
void LogError(const wxString &msg, int i=app_log)
virtual TargetType GetTargetType() const
Read the target's type.
const wxString & GetMakefile()
EVTIMPORT const wxEventType cbEVT_COMPILE_FILE_REQUEST
const wxString COMPILER_WAIT(_T("WAIT"))
ProjectManager * GetProjectManager() const
Functions returning pointers to the respective sub-manager instances.
const wxString COMPILER_ERROR_LOG(_T("SLOG:ELOG:"))
bool LoadScript(const wxString &filename)
Loads a script.
bool MakeRelativeTo(const wxString &pathBase=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
wxArrayString GetPreBuildCommands(ProjectBuildTarget *target) const
void OnRebuildAll(wxCommandEvent &event)
bool Contains(const wxString &str) const
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
DebuggerManager * GetDebuggerManager() const
virtual int KillProcess()
Abort the current build process.
virtual const wxString & GetFilename() const
Get the editor's filename (if applicable).
BuildJobTarget GetNextJob()
DLLIMPORT wxString UnixFilename(const wxString &filename, wxPathFormat format=wxPATH_NATIVE)
virtual bool IsValid()
Check if the compiler is actually valid (installed).
Represents a Code::Blocks project.
bool wxSetWorkingDirectory(const wxString &dir)
DLLIMPORT wxString cbGetDynamicLinkerPathForTarget(cbProject *project, ProjectBuildTarget *target)
Returns a string valid to be used as LD_LIBRARY_PATH (or equivalent).
EditorBase * GetActiveEditor()
void RecalcVars(cbProject *project, EditorBase *editor, ProjectBuildTarget *target)
void DoGotoPreviousError()
const wxString COMPILER_WAIT_LINK(_T("LINK"))
wxString & RemoveLast(size_t n=1)
EVTIMPORT const wxEventType cbEVT_ADD_LOG_WINDOW
cbStyledTextCtrl * GetControl() const
Returns a pointer to the underlying cbStyledTextCtrl object (which itself is the wxWindows implementa...
cbPlugin * GetIsRunning() const
Return a pointer to the plugin which is running the application.
DLLIMPORT const wxString DEFAULT_CONSOLE_SHELL
EVTIMPORT const wxEventType cbEVT_REMOVE_LOG_WINDOW
virtual wxString GetMakeCommandFor(MakeCommand cmd) const
Get the "make" command used for cmd.
ModuleType
The type of module offering a context menu.
virtual const wxString & GetTitle() const
Read the target's title.
#define EVT_PIPEDPROCESS_TERMINATED(id, fn)
bool isLink
wait for all previous commands to finish (for parallel builds) - only for linking stage...
static wxString FromUTF8(const char *s)
void OnCompileAndRun(wxCommandEvent &event)
wxArrayString GetCompileCommands(ProjectBuildTarget *target, bool force=false) const
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
int GetTargetIndexFromName(cbProject *prj, const wxString &name)
void AskForActiveProject()
wxArrayString GetCleanCommands(ProjectBuildTarget *target, bool distclean=false) const
void InitBuildState(BuildJob job, const wxString &target)
Target produces a dynamic library.
wxString wxPathOnly(const wxString &path)
size_t Replace(const wxString &strOld, const wxString &strNew, bool replaceAll=true)
wxFrame * GetAppFrame() const
a logger which prints messages to a wxTextCtrl
cbEditor * GetBuiltinActiveEditor()
const wxPoint wxDefaultPosition
static void SetDefaultCompiler(size_t index)
static void RegisterCompiler(Compiler *compiler)
Register a supported (builtin) compiler.
static bool IsBatchBuild()
virtual cbTreeCtrl * GetTree()=0
Retrieve a pointer to the project manager's tree (GUI).
virtual const CompilerPrograms & GetPrograms() const
Get the compiler's programs.
EVTIMPORT const wxEventType cbEVT_HIDE_LOG_MANAGER
Base class that all "editors" should inherit from.
LogManager * GetLogManager() const
void UpdateSettings() override
bool UseMake(cbProject *project=0)
EVTIMPORT const wxEventType cbEVT_SWITCH_TO_LOG_WINDOW
wxString & Item(size_t nIndex)
cbProject * GetActiveProject()
Retrieve the active project.
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
static void RegisterUserCompilers()
Register all user-defined compiler copies.
void SetPreferredTarget(const wxString &target)
Set the preferred target for this workspace.
virtual wxString GetBasePath() const
Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
wxString GetMakeCommandFor(MakeCommand cmd, cbProject *project, ProjectBuildTarget *target)
static void SaveSettings()
virtual wxString GetWorkingDir()
Read the target's working dir for execution (valid only for executable targets)
static wxUniChar GetPathSeparator(wxPathFormat format=wxPATH_NATIVE)
wxArrayString CompileFile(ProjectBuildTarget *target, ProjectFile *pf, bool force=false) const
const wxStringCharType * wx_str() const
bool Save(const wxString &filename)
EVTIMPORT const wxEventType cbEVT_GET_ACTIVE_LOG_WINDOW
void OnTimer(wxTimerEvent &event)
static void LoadSettings()
bool Add(const wxString &path)
void AddOutputLine(const wxString &output, bool forceErrorColour=false)
void OnWorkspaceClosed(CodeBlocksEvent &event)
virtual int CompileFile(const wxString &file)
Compile a specific file.
const wchar_t * wc_str() const
BuildJob
Helper enum for compiler's state. This state signifies the kind of build the compiler is working on...
virtual void Stop()=0
Stop the debugging process (exit debugging).
bool SaveAllFiles()
Save all project files.
EVTIMPORT const wxEventType cbEVT_PROJECT_TARGETS_MODIFIED
wxString BuildURI() const
MacrosManager * GetMacrosManager() const
int DoWorkspaceBuild(const wxString &target, bool clean, bool build, bool clearLog=true)
const wxString & _(const wxString &string)
DLLIMPORT void QuoteStringIfNeeded(wxString &str)
wxString & Trim(bool fromRight=true)
void ReplaceMacros(wxString &buffer, ProjectBuildTarget *target=nullptr, bool subrequest=false)
ProjectBuildTarget * GetBuildTargetForFile(ProjectFile *pf)
Base class for plugin configuration panels.
cbEditor * GetBuiltinEditor(EditorBase *eb)
int GetActiveProcessCount() const
int GetBuildTargetsCount()
Plugin registration object.
void StartCompileFile(wxFileName file)
void OnCompile(wxCommandEvent &event)
static void Yield()
Whenever you need to call wxYield(), call Manager::Yield(). It's safer.
void OnPreviousError(wxCommandEvent &event)
wxArray< int > wxArrayInt
wxArrayString GetVirtualBuildTargets() const
Get a list of all defined virtual build targets.
Target produces a static library.
bool WithMultiLineMsg()
Do compiler writes multi-line messages?
static wxString GetDataFolder(bool global=true)
wxArrayString GetExpandedVirtualBuildTargetGroup(const wxString &alias) const
Access a virtual build target's expanded group of build targets.
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
void OnGCCOutput(CodeBlocksEvent &event)
cbWorkspace * GetWorkspace()
Get the current workspace filename.
const DLLIMPORT wxString EXECUTABLE_EXT
Logger * logger
The logger.
wxArrayString GetPostBuildCommands(ProjectBuildTarget *target) const
Abstract base class for compilers.
void ExpandTargets(cbProject *project, const wxString &targetName, wxArrayString &result)
virtual int Rebuild(ProjectBuildTarget *target=0L)
Rebuild the project/target.
wxString & Append(const char *psz)
void SetProject(cbProject *project, bool refresh=true)
Set the active project.
#define EVT_PIPEDPROCESS_STDERR(id, fn)
static wxString getBuildTargetName(const ProjectBuildTarget *bt)
bool GetNext(wxString *filename) const
DLLIMPORT void PlaceWindow(wxTopLevelWindow *w, cbPlaceDialogMode mode=pdlBest, bool enforce=false)
virtual bool GetAlwaysRunPostBuildSteps() const
void NotifyCleanWorkspace()
cbProject * GetProject() const
void LogWarningOrError(CompilerLineType lt, cbProject *prj, const wxString &filename, const wxString &line, const wxString &msg)
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
EVTIMPORT const wxEventType cbEVT_COMPILER_STARTED
virtual CompilerLineType CheckForWarningsAndErrors(const wxString &line)
Check if the supplied string is a compiler warning/error.
The entry point singleton for working with projects.
ProjectBuildTarget * target
virtual const wxString & GetCompilerID() const
Read the target's compiler.
void ReplaceEnvVars(wxString &buffer)
Target produces a console executable (without GUI) (distinction between ttExecutable and ttConsoleOnl...
virtual int CompileFileDefault(cbProject *project, ProjectFile *pf, ProjectBuildTarget *bt)
bool IsRelative(wxPathFormat format=wxPATH_NATIVE) const
const wxString COMPILER_NOTE_ID_LOG
void Log(const wxString &msg, int i=app_log, Logger::level lv=Logger::info)
void RemoveBuildProgressBar()
FileTreeDataKind GetKind() const
void CalculateProjectDependencies(cbProject *prj, wxArrayInt &deps)
virtual const wxString & GetName() const
Get the compiler's name.
static wxString GetExecutableFolder()
#define EVT_PIPEDPROCESS_STDOUT(id, fn)
CompilerValidResult CompilerValid(ProjectBuildTarget *target=0)
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
virtual const CompilerSwitches & GetSwitches() const
Get the compiler's generic switches.
void OnIdle(wxIdleEvent &event)
bool ProcessEvent(CodeBlocksEvent &event)
void OnClearErrors(wxCommandEvent &event)
virtual int Build(ProjectBuildTarget *target=0L)
Build the project/target.
void SetExt(const wxString &ext)
void InitBuildLog(bool workspaceBuild)
EVTIMPORT const wxEventType cbEVT_PROJECT_OPEN
void OnCompileFile(wxCommandEvent &event)
void RegisterEventSink(wxEventType eventType, IEventFunctorBase< CodeBlocksEvent > *functor)
virtual bool IsRunning() const =0
Is the plugin currently debugging?
virtual wxString GetLastErrorFilename()
Returns warning/error filename.
size_t Add(const wxString &str, size_t copies=1)
void LogMessage(const wxString &message, CompilerLineType lt=cltNormal, LogTarget log=ltAll, bool forceErrorColour=false, bool isTitle=false, bool updateProgress=false)
bool DoCleanWithMake(ProjectBuildTarget *bt)
cbProject * GetParentProject()
bool Save() override
Save editor contents.
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
Represents a Code::Blocks project build target.
EVTIMPORT const wxEventType cbEVT_PROJECT_CLOSE
void OnClean(wxCommandEvent &event)
virtual bool Load(const wxString &filename, const wxString &encoding="UTF-8", int flags=wxXMLDOC_NONE)
int Find(wxUniChar ch, bool fromEnd=false) const
ProjectFile * GetProjectFile() const
Read the ProjectFile pointer associated with this editor.
void PrepareCompileFile(wxFileName &file)
Simple iterator that uses wxArrayString as data source.
wxUniChar GetChar(size_t n) const
Simple incremental select dialog that shows a single column and doesn't have much ui elements...
ProjectsArray * GetProjects()
Retrieve an array of all the opened projects.
void AddBuildProgressBar()
bool wxLaunchDefaultBrowser(const wxString &url, int flags=0)
DLLIMPORT wxString ExpandBackticks(wxString &str)
ScriptingManager * GetScriptingManager() const
void PrintInvalidCompiler(ProjectBuildTarget *target, Compiler *compiler, const wxString &finalMessage)
void OnRun(wxCommandEvent &event)
void AttachConfigurationPanel(cbConfigurationPanel *panel)
bool MakeAbsolute(const wxString &cwd=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
void PreprocessJob(cbProject *project, const wxString &targetName)
cbConfigurationPanel * GetConfigurationPanel(wxWindow *parent)
DLLIMPORT wxString EscapeSpaces(const wxString &str)
Escapes spaces and tabs (NOT quoting the string)
bool wxSetEnv(const wxString &var, const wxString &value)
int Printf(const wxString &pszFormat,...)
virtual wxString GetObjectOutput() const
Read the target's objects output dir.
int DoBuild(bool clean, bool build)
void AddEnvList(const wxString &env_variable)
bool StopRunningDebugger()
void OnGCCTerminated(CodeBlocksEvent &event)
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
virtual int OpenFile(const wxString &filename)=0
Open the file.
void OnUpdateUI(wxUpdateUIEvent &event)
void SetParentDialog(wxWindow *dialog)
Sets the panel's parent dialog.
DLLIMPORT wxString cbMergeLibPaths(const wxString &oldPath, const wxString &newPath)
Merges to LD_LIBRARY_PATH/PATH strings together to form a new valid string.
size_t SetLog(Logger *l, int index=no_index)
virtual wxString GetTitle() const
Get the workspace's title.
void OnProjectUnloaded(CodeBlocksEvent &event)
static wxString Format(const wxString &format,...)
size_t Write(const void *buffer, size_t count)
void OnGCCError(CodeBlocksEvent &event)
wxString Mid(size_t first, size_t nCount=wxString::npos) const
virtual int Run(ProjectBuildTarget *target=0L)
Run the project/target.
virtual int DistClean(ProjectBuildTarget *target=0L)
DistClean the project/target.
Dialog that contains a "Don't annoy me" checkbox.
const ProjectsArray * GetDependenciesForProject(cbProject *base)
Get the array of projects base depends on.
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
const wxString lt(_T("<"))
void NotifyCleanProject(const wxString &target)
EVTIMPORT const wxEventType cbEVT_SHOW_LOG_MANAGER
void ClearLog(bool switchToLog)
virtual wxTreeItemId GetTreeSelection()=0
Get the selection of the project manager's tree (GUI).
static wxKillError Kill(int pid, wxSignal sig=wxSIGTERM, int flags=wxKILL_NOCHILDREN)
wxArrayString buildTargets
An array of strings, containing the names of all the build targets this file belongs to...
long wxExecute(const wxString &command, int flags=wxEXEC_ASYNC, wxProcess *callback=NULL, const wxExecuteEnv *env=NULL)
Target only runs commands in pre-build and/or post-build steps.