50 m_PageIndex(logPageIndex),
51 m_pCompilerPlugin(compilerPlugin),
52 m_pCompiler(compiler),
72 if ( (depsCWD.
Len()==3) && (depsCWD.
GetChar(1)==
':')
78 depsSetCWD(depsCWD.
mb_str());
82 depsCacheRead(fname.GetFullPath().mb_str());
90 struct depsStats stats;
92 if (stats.cache_updated)
96 depsCacheWrite(fname.GetFullPath().mb_str());
100 F(
_(
"Scanned %ld files for #includes, cache used %ld, cache updated %ld"),
101 stats.scanned, stats.cache_used, stats.cache_updated));
113 int idx = cmd.
Find(
_T(
"\n"));
133 int diff = (*one)->weight - (*two)->weight;
134 diff = (diff == 0 ? (*one)->relativeFilename.CmpNoCase((*two)->relativeFilename) : diff);
135 return (diff == 0 ? (*one)->relativeFilename.Cmp((*two)->relativeFilename) : diff);
148 if (link && !pf->
link)
261 #ifdef command_line_generation 263 compiler_cmd.
wx_str(), source_file.
wx_str(),
object.wx_str(), object_dir.wx_str()));
272 #ifdef command_line_generation 286 if (!is_header && compiler_cmd.
IsEmpty())
447 ret.
Add(exe_filename);
483 size_t fcount = files.GetCount();
484 bool hasWeight =
false;
485 unsigned short int lastWeight = 0;
486 for (
unsigned int i = 0; i < fcount; ++i)
532 if (!buildcmds.IsEmpty())
536 for (
size_t i = 0; i < buildcmds.GetCount(); ++i)
548 tmp.
Add(buildcmds[i]);
565 if (!buildcmds.IsEmpty())
569 for (
size_t i = 0; i < buildcmds.GetCount(); ++i)
587 tmp.
Add(buildcmds[i]);
635 depsTimeStamp(output.
mb_str(), &outputtime);
645 #ifdef NO_TRANSLATION 646 warn.
Printf(
wxT(
"WARNING: Target '%s': Unable to resolve %lu external dependenc%s:"),
649 warn.
Printf(
_(
"WARNING: Target '%s': Unable to resolve %lu external dependency/ies:"),
651 #endif // NO_TRANSLATION 653 for (
size_t i = 0; i < fileMissing.Count(); ++i)
674 wxRegEx re(
_T(
"\\$([-+]+)link_objects"));
676 prependHack = re.
GetMatch(compilerCmd, 1);
681 if (files.GetCount() == 0)
688 linkfiles <<
_T(
"file ");
690 for (
unsigned int i = 0; i < files.GetCount(); ++i)
713 resfiles << _T(
"option resource=") << Object;
726 linkfiles <<
_T(
" ");
727 FlatLinkFiles << _T(
" ");
729 linkfiles << prependHack << Object;
739 linkfiles << prependHack << Object;
758 if (objtime > outputtime)
772 wxString dstname = out.
GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
786 kind_of_output =
_(
"console executable");
791 kind_of_output =
_(
"executable");
796 kind_of_output =
_(
"dynamic library");
801 kind_of_output =
_(
"static library");
806 kind_of_output =
_(
"native");
882 for (
unsigned int i = 0; i < files.GetCount(); ++i)
908 ret.
Add(outputfilename);
916 ret.
Add(outputfilename);
936 time_t timeOutput = 0;
941 depsTimeStamp(output.
mb_str(), &timeOutput);
958 for (
size_t i = 0; i < libs.
GetCount(); ++i)
969 depsTimeStamp(lib.
mb_str(), &timeExtDep);
970 if (timeExtDep > timeOutput)
987 for (
size_t l = 0; l < libDirs.
GetCount(); ++l)
989 wxString dir = libDirs[l] + wxFILE_SEP_PATH + lib;
993 depsTimeStamp(dir.
mb_str(), &timeExtDep);
994 if (timeExtDep > timeOutput)
1011 for (
size_t i = 0; i < extDeps.
GetCount(); ++i)
1013 if (extDeps[i].IsEmpty())
1018 depsTimeStamp(extDeps[i].mb_str(), &timeExtDep);
1023 if (filesMissing) filesMissing->
Add(extDeps[i]);
1028 for (
size_t j = 0; j < addFiles.GetCount(); ++j)
1030 if (addFiles[j].IsEmpty())
1035 depsTimeStamp(addFiles[j].mb_str(), &timeAddFile);
1039 if (filesMissing) filesMissing->
Add(addFiles[j]);
1044 if (timeExtDep > timeAddFile)
1063 if (timeExtDep > timeOutput)
1095 depsTimeStamp(ObjectAbs.
mb_str(), &timeObj);
1102 if (timeSrc > timeObj)
1116 (void) depsGetNewest(ref, &timeNewest);
1117 return (timeNewest > timeObj);
1131 for (
unsigned int i = 0; i < incs.
GetCount(); ++i)
1136 depsAddSearchDir(incs[i].mb_str());
const wxString COMPILER_SIMPLE_LOG(_T("SLOG:"))
wxString F(const wxChar *msg,...)
sprintf-like function
DLLIMPORT wxArrayString GetArrayFromString(const wxString &text, const wxString &separator=DEFAULT_ARRAY_SEP, bool trimSpaces=true)
CompilerLoggingType logging
unsigned short int weight
The weight.
bool wxRemoveFile(const wxString &file)
wxString relativeFilename
The relative (to the project) filename of this file.
virtual const wxString & GetAdditionalOutputFiles() const
void Assign(const wxFileName &filepath)
ConfigManager * GetConfigManager(const wxString &name_space) const
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
wxString source_file_absolute_native
virtual FilesList & GetFilesList()
Provides an easy way to iterate all the files belonging in this target.
bool wxFileExists(const wxString &filename)
wxFileName file
The full filename of this file.
static Compiler * GetDefaultCompiler()
wxString GetShortPath() const
Link console executable command, e.g. "$linker $libdirs -o $exe_output $link_objects $libs"...
virtual const wxString & GetExternalDeps() const
bool compile
Compile flag.
bool ReadBool(const wxString &name, bool defaultVal=false)
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
Target produces an executable.
virtual const wxArrayString & GetCompilerSearchDirs(ProjectBuildTarget *target)
Get the full include dirs used in the actual command line.
wxString object_file_native
static Compiler * GetCompiler(size_t index)
void AddCommandsToArray(const wxString &cmds, wxArrayString &array, bool isWaitCmd=false, bool isLinkCmd=false) const
bool Matches(const wxString &text, int flags=0) const
FileType
Known file types.
const wxCharBuffer mb_str(const wxMBConv &conv=wxConvLibc) const
DLLIMPORT FileType FileTypeOf(const wxString &filename)
wxString object_file_flat_absolute_native
Compile object command, e.g. "$compiler $options $includes -c $file -o $object".
wxString & Remove(size_t pos)
const wxString COMPILER_WARNING_LOG(_T("SLOG:WLOG:"))
virtual void GenerateCommandLine(wxString ¯o, ProjectBuildTarget *target, ProjectFile *pf, const wxString &file, const wxString &object, const wxString &flat_object, const wxString &deps)
Get the command line to compile/link the specific file.
wxString AfterFirst(wxUniChar ch) const
wxString object_dir_native
wxArrayString GetTargetLinkCommands(ProjectBuildTarget *target, bool force=false) const
Represents a file in a Code::Blocks project.
const wxString COMPILER_TARGET_CHANGE(_T("TGT:"))
ProjectBuildTarget * GetCurrentlyCompilingTarget()
Get a pointer to the currently compiling target.
virtual wxString GetOutputFilename()
Read the target's output filename.
wxArrayString GetTargetCompileCommands(ProjectBuildTarget *target, bool force=false) const
virtual cbProject * GetParentProject()
virtual wxString GetStaticLibFilename()
Read the target's static library filename (produced if target type is ttStaticLib) ...
virtual const wxString & GetCommand(CommandType ct, const wxString &fileExtension=wxEmptyString) const
Get a command based on CommandType.
virtual wxString GetFullTitle() const
wxArrayString GetCompileSingleFileCommand(const wxString &filename) const
This is to be used only for files not belonging to a project!!!
virtual TargetType GetTargetType() const
Read the target's type.
wxString dep_file_absolute_native
wxString object_dir_flat_native
const wxString COMPILER_WAIT(_T("WAIT"))
const wxString & GetID() const
Get this compiler's unique ID.
const wxString COMPILER_ERROR_LOG(_T("SLOG:ELOG:"))
wxArrayString GetPreBuildCommands(ProjectBuildTarget *target) const
bool Contains(const wxString &str) const
DLLIMPORT wxString UnixFilename(const wxString &filename, wxPathFormat format=wxPATH_NATIVE)
void Insert(wxString lItem, size_t nIndex, size_t copies=1)
Represents a Code::Blocks project.
virtual const wxString & GetFilename() const
Link dynamic (dll) lib command, e.g. "$linker -shared -Wl,--output-def=$def_output -Wl...
const wxString COMPILER_WAIT_LINK(_T("LINK"))
wxString & RemoveLast(size_t n=1)
virtual const wxArrayString & GetLinkLibs() const
bool AreExternalDepsOutdated(ProjectBuildTarget *target, const wxString &buildOutput, wxArrayString *filesMissing) const
external deps are manually set by the user e.g.
virtual const wxString & GetTitle() const
Read the target's title.
wxString Left(size_t count) const
wxArrayString GetTargetCleanCommands(ProjectBuildTarget *target, bool distclean=false) const
wxArrayString GetCompileCommands(ProjectBuildTarget *target, bool force=false) const
wxArrayString GetCleanCommands(ProjectBuildTarget *target, bool distclean=false) const
Target produces a dynamic library.
bool IsSameAs(const wxString &s, bool caseSensitive=true) const
bool GetMatch(size_t *start, size_t *len, size_t index=0) const
Target produces a native binary.
LogManager * GetLogManager() const
pfCustomBuildMap customBuild
A map for custom builds.
bool IsObjectOutdated(ProjectBuildTarget *target, const pfDetails &pfd, wxString *errorStr=0) const
This is a helper class that caches various filenames for one ProjectFile.
const pfDetails & GetFileDetails(ProjectBuildTarget *target)
Access the file details for this project file for the specified target.
virtual wxString GetBasePath() const
Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will retur...
const wxString ref(_T("&"))
void DepsSearchStart(ProjectBuildTarget *target) const
virtual const wxArrayString & GetCommandsAfterBuild() const
wxArrayString CompileFile(ProjectBuildTarget *target, ProjectFile *pf, bool force=false) const
const wxStringCharType * wx_str() const
Link executable command, e.g. "$linker $libdirs -o $exe_output $link_objects $libs -mwindows"...
MacrosManager * GetMacrosManager() const
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)
int GetBuildTargetsCount()
const wxString COMPILER_NOTE_LOG(_T("SLOG:NLOG:"))
static void Yield()
Whenever you need to call wxYield(), call Manager::Yield(). It's safer.
CommandType
Helper enum to retrieve compiler commands.
ProjectFilesVector generatedFiles
Auto-generated files when compiling this file.
bool useCustomBuildCommand
wxString compilerVar
The compiler variable used for this file (e.g CPP, CC, etc).
Target produces a static library.
ProjectBuildTarget * GetBuildTarget(int index)
Access a build target.
const DLLIMPORT wxString EXECUTABLE_EXT
wxArrayString GetPostBuildCommands(ProjectBuildTarget *target) const
Compile Win32 resources command, e.g. "$rescomp -i $file -J rc -o $resource_output -O coff $includes"...
Abstract base class for compilers.
wxArrayString GetCompileFileCommand(ProjectBuildTarget *target, ProjectFile *pf) const
wxString object_file_absolute_native
virtual const wxArrayString & GetLibDirs() const
wxString GetPath(int flags=wxPATH_GET_VOLUME, wxPathFormat format=wxPATH_NATIVE) const
virtual const wxString & GetCompilerID() const
Read the target's compiler.
DLLIMPORT void AppendArray(const wxArrayString &from, wxArrayString &to)
Target produces a console executable (without GUI) (distinction between ttExecutable and ttConsoleOnl...
static int MySortProjectFilesByWeight(ProjectFile **one, ProjectFile **two)
void DebugLog(const wxString &msg, Logger::level lv=Logger::info)
virtual const CompilerSwitches & GetSwitches() const
Get the compiler's generic switches.
bool EndsWith(const wxString &suffix, wxString *rest=NULL) const
void SetExt(const wxString &ext)
CompilerCommandGenerator * m_pGenerator
MyFilesArray GetProjectFilesSortedByWeight(ProjectBuildTarget *target, bool compile, bool link) const
size_t Add(const wxString &str, size_t copies=1)
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
Represents a Code::Blocks project build target.
DirectCommands(DirectCommands &)
ProjectFile * AutoGeneratedBy() const
If this is an auto-generated file, which file is generating it?
int Find(wxUniChar ch, bool fromEnd=false) const
Link native binary command.
wxUniChar GetChar(size_t n) const
DLLIMPORT bool CreateDirRecursively(const wxString &full_path, int perms=0755)
Link static lib command, e.g. "ar -r $output $link_objects\n\tranlib $static_output".
const wxArrayString & GetBuildTargets() const
wxString source_file_native
bool MakeAbsolute(const wxString &cwd=wxEmptyString, wxPathFormat format=wxPATH_NATIVE)
int Printf(const wxString &pszFormat,...)
wxArrayString GetLinkCommands(ProjectBuildTarget *target, bool force=false) const
wxString GetFullPath(wxPathFormat format=wxPATH_NATIVE) const
wxArrayString GetCleanSingleFileCommand(const wxString &filename) const
This is to be used only for files not belonging to a project!!!
virtual bool GetIncludeInTargetAll() const
Deprecated, do not use at all!
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
wxArrayString buildTargets
An array of strings, containing the names of all the build targets this file belongs to...
Target only runs commands in pre-build and/or post-build steps.
wxString object_file_flat
virtual CompilerCommandGenerator * GetCommandGenerator(cbProject *project)
This is to be overridden, if compiler needs to alter the default command line generation.
virtual const wxArrayString & GetCommandsBeforeBuild() const