Code::Blocks  SVN r11506
Public Member Functions | Private Attributes | Friends | List of all members
ProjectBuildTarget Class Reference

Represents a Code::Blocks project build target. More...

#include <projectbuildtarget.h>

Inheritance diagram for ProjectBuildTarget:
Collaboration diagram for ProjectBuildTarget:

Public Member Functions

 ProjectBuildTarget (cbProject *parentProject)
 Constructor. More...
 
 ~ProjectBuildTarget () override
 Destructor. More...
 
virtual cbProjectGetParentProject ()
 
virtual wxString GetFullTitle () const
 
virtual const wxStringGetExternalDeps () const
 
virtual void SetExternalDeps (const wxString &deps)
 Set a list of all the external files this targets depends on. More...
 
virtual const wxStringGetAdditionalOutputFiles () const
 
virtual void SetAdditionalOutputFiles (const wxString &files)
 Set a list of all additional output files this targets creates, besides its main output. More...
 
virtual bool GetIncludeInTargetAll () const
 Deprecated, do not use at all! More...
 
virtual void SetIncludeInTargetAll (bool buildIt)
 Deprecated, do not use at all! Set if this target should be built when the virtual target "All" is selected. More...
 
virtual bool GetCreateDefFile () const
 Valid only for targets generating dynamic libraries (DLLs or SOs). More...
 
virtual void SetCreateDefFile (bool createIt)
 Set if the target creates a DEF imports file. More...
 
virtual bool GetCreateStaticLib ()
 Valid only for targets generating dynamic libraries (DLLs or SOs). More...
 
virtual void SetCreateStaticLib (bool createIt)
 Set if an import library should be created. More...
 
virtual bool GetUseConsoleRunner () const
 Valid only for targets generating a console executable. More...
 
virtual void SetUseConsoleRunner (bool useIt)
 Set if ConsoleRunner should be used. More...
 
void SetTargetType (TargetType pt) override
 Set the target's type to pt. More...
 
virtual void AddTargetDep (ProjectBuildTarget *target)
 Targets to be compiled (if necessary) before this one. More...
 
virtual BuildTargets & GetTargetDeps ()
 
virtual FilesList & GetFilesList ()
 Provides an easy way to iterate all the files belonging in this target. More...
 
int GetFilesCount ()
 
ProjectFileGetFile (int index)
 Access a file of the target. More...
 
bool RemoveFile (ProjectFile *pf)
 Remove a file from the target. More...
 
- Public Member Functions inherited from CompileTargetBase
 CompileTargetBase ()
 
 ~CompileTargetBase () override
 
virtual void SetTargetFilenameGenerationPolicy (TargetFilenameGenerationPolicy prefix, TargetFilenameGenerationPolicy extension)
 A target's filename can either be auto-generated based on the running platform, or completely specified by the user. More...
 
virtual void GetTargetFilenameGenerationPolicy (TargetFilenameGenerationPolicy &prefixOut, TargetFilenameGenerationPolicy &extensionOut) const
 
virtual const wxStringGetFilename () const
 
virtual const wxStringGetTitle () const
 Read the target's title. More...
 
virtual void SetTitle (const wxString &title)
 Set the target's title. More...
 
virtual void SetOutputFilename (const wxString &filename)
 Set the target's output filename. More...
 
virtual void SetImportLibraryFilename (const wxString &filename)
 Set the target's import library filename. More...
 
virtual void SetDefinitionFileFilename (const wxString &filename)
 Set the target's definition file filename. More...
 
virtual void SetWorkingDir (const wxString &dirname)
 Set the target's working dir on execution (valid only for executable targets) More...
 
virtual void SetObjectOutput (const wxString &dirname)
 Set the target's objects output dir. More...
 
virtual void SetDepsOutput (const wxString &dirname)
 Set the target's dependencies output dir. More...
 
virtual OptionsRelation GetOptionRelation (OptionsRelationType type) const
 Read the target's options relation for type. More...
 
virtual void SetOptionRelation (OptionsRelationType type, OptionsRelation rel)
 Set the target's options relation for type to rel. More...
 
virtual wxString GetWorkingDir ()
 Read the target's working dir for execution (valid only for executable targets) More...
 
virtual wxString GetObjectOutput () const
 Read the target's objects output dir. More...
 
virtual wxString GetDepsOutput () const
 Read the target's dependencies output dir. More...
 
virtual wxString GetOutputFilename ()
 Read the target's output filename. More...
 
virtual wxString SuggestOutputFilename ()
 Suggest a filename based on the target's type. More...
 
virtual wxString GetExecutableFilename () const
 Read the target's executable filename (produced if target type is ttExecutable) More...
 
virtual wxString GetDynamicLibFilename ()
 Read the target's dynamic library filename (produced if target type is ttDynamicLib) More...
 
virtual wxString GetDynamicLibImportFilename ()
 Read the target's dynamic library import filename (produced if target type is ttDynamicLib) More...
 
virtual wxString GetDynamicLibDefFilename ()
 Read the target's dynamic library definition file filename (produced if target type is ttDynamicLib) More...
 
virtual wxString GetStaticLibFilename ()
 Read the target's static library filename (produced if target type is ttStaticLib) More...
 
virtual wxString GetNativeFilename ()
 Read the target's native filename (produced if target type is ttNative) More...
 
virtual wxString GetBasePath () const
 Read the target's base path, e.g. if GetFilename() returns "/usr/local/bin/xxx", base path will return "/usr/local/bin". More...
 
virtual TargetType GetTargetType () const
 Read the target's type. More...
 
virtual const wxStringGetExecutionParameters () const
 Read the target's execution parameters. More...
 
virtual void SetExecutionParameters (const wxString &params)
 Set the target's execution parameters to params. More...
 
virtual const wxStringGetHostApplication () const
 Read the target's host application. More...
 
virtual void SetHostApplication (const wxString &app)
 Set the target's host application to app. More...
 
virtual bool GetRunHostApplicationInTerminal () const
 Get the flag if the host app should be run in terminal. More...
 
virtual void SetRunHostApplicationInTerminal (bool in_terminal)
 
virtual void SetCompilerID (const wxString &id)
 ! Set the flag if the host app should be run in terminal More...
 
virtual const wxStringGetCompilerID () const
 Read the target's compiler. More...
 
virtual wxString GetMakeCommandFor (MakeCommand cmd) const
 Get the "make" command used for cmd. More...
 
virtual void SetMakeCommandFor (MakeCommand cmd, const wxString &make)
 Set the "make" command used for cmd. More...
 
virtual bool MakeCommandsModified () const
 True if any of the "make" commands is modified. More...
 
- Public Member Functions inherited from CompileOptionsBase
 CompileOptionsBase ()
 
virtual ~CompileOptionsBase ()
 
virtual void AddPlatform (int platform)
 
virtual void RemovePlatform (int platform)
 
virtual void SetPlatforms (int platforms)
 
virtual int GetPlatforms () const
 
virtual bool SupportsCurrentPlatform () const
 
virtual void SetLinkerOptions (const wxArrayString &linkerOpts)
 
virtual const wxArrayStringGetLinkerOptions () const
 
virtual void AddLinkerOption (const wxString &option)
 
virtual void ReplaceLinkerOption (const wxString &option, const wxString &new_option)
 
virtual void RemoveLinkerOption (const wxString &option)
 
virtual void SetLinkLibs (const wxArrayString &linkLibs)
 
virtual const wxArrayStringGetLinkLibs () const
 
virtual void AddLinkLib (const wxString &option)
 
virtual void ReplaceLinkLib (const wxString &option, const wxString &new_option)
 
virtual void RemoveLinkLib (const wxString &option)
 
virtual void SetCompilerOptions (const wxArrayString &compilerOpts)
 
virtual const wxArrayStringGetCompilerOptions () const
 
virtual void AddCompilerOption (const wxString &option)
 
virtual void ReplaceCompilerOption (const wxString &option, const wxString &new_option)
 
virtual void RemoveCompilerOption (const wxString &option)
 
virtual void SetResourceCompilerOptions (const wxArrayString &resourceCompilerOpts)
 
virtual const wxArrayStringGetResourceCompilerOptions () const
 
virtual void AddResourceCompilerOption (const wxString &option)
 
virtual void ReplaceResourceCompilerOption (const wxString &option, const wxString &new_option)
 
virtual void RemoveResourceCompilerOption (const wxString &option)
 
virtual void SetIncludeDirs (const wxArrayString &includeDirs)
 
virtual const wxArrayStringGetIncludeDirs () const
 
virtual void AddIncludeDir (const wxString &option)
 
virtual void ReplaceIncludeDir (const wxString &option, const wxString &new_option)
 
virtual void RemoveIncludeDir (const wxString &option)
 
virtual void SetResourceIncludeDirs (const wxArrayString &resIncludeDirs)
 
virtual const wxArrayStringGetResourceIncludeDirs () const
 
virtual void AddResourceIncludeDir (const wxString &option)
 
virtual void ReplaceResourceIncludeDir (const wxString &option, const wxString &new_option)
 
virtual void RemoveResourceIncludeDir (const wxString &option)
 
virtual void SetLibDirs (const wxArrayString &libDirs)
 
virtual const wxArrayStringGetLibDirs () const
 
virtual void AddLibDir (const wxString &option)
 
virtual void ReplaceLibDir (const wxString &option, const wxString &new_option)
 
virtual void RemoveLibDir (const wxString &option)
 
virtual void SetCommandsBeforeBuild (const wxArrayString &commands)
 
virtual const wxArrayStringGetCommandsBeforeBuild () const
 
virtual void AddCommandsBeforeBuild (const wxString &command)
 
virtual void RemoveCommandsBeforeBuild (const wxString &command)
 
virtual void SetCommandsAfterBuild (const wxArrayString &commands)
 
virtual const wxArrayStringGetCommandsAfterBuild () const
 
virtual void AddCommandsAfterBuild (const wxString &command)
 
virtual void RemoveCommandsAfterBuild (const wxString &command)
 
virtual void SetBuildScripts (const wxArrayString &scripts)
 
virtual const wxArrayStringGetBuildScripts () const
 
virtual void AddBuildScript (const wxString &script)
 
virtual void RemoveBuildScript (const wxString &script)
 
virtual bool GetModified () const
 
virtual void SetModified (bool modified)
 
virtual bool GetAlwaysRunPostBuildSteps () const
 
virtual void SetAlwaysRunPostBuildSteps (bool always)
 
virtual bool SetVar (const wxString &key, const wxString &value, bool onlyIfExists=false)
 
virtual bool UnsetVar (const wxString &key)
 
virtual void UnsetAllVars ()
 
virtual bool HasVar (const wxString &key) const
 
virtual const wxStringGetVar (const wxString &key) const
 
virtual const StringHash & GetAllVars () const
 

Private Attributes

cbProjectm_Project
 
wxString m_ExternalDeps
 
wxString m_AdditionalOutputFiles
 
BuildTargets m_TargetDeps
 
FilesList m_Files
 
ProjectFileArray m_FileArray
 
bool m_BuildWithAll
 
bool m_CreateStaticLib
 
bool m_CreateDefFile
 
bool m_UseConsoleRunner
 

Friends

class ProjectFile
 

Additional Inherited Members

- Protected Attributes inherited from CompileTargetBase
wxString m_Filename
 
wxString m_Title
 
wxString m_OutputFilename
 
wxString m_ImportLibraryFilename
 
wxString m_DefinitionFileFilename
 
wxString m_WorkingDir
 
wxString m_ObjectOutput
 
wxString m_DepsOutput
 
wxString m_ExecutionParameters
 
wxString m_HostApplication
 
OptionsRelation m_OptionsRelation [ortLast]
 
TargetType m_TargetType
 
wxString m_CompilerId
 
wxString m_MakeCommands [mcLast]
 
bool m_MakeCommandsModified
 
bool m_RunHostApplicationInTerminal
 
TargetFilenameGenerationPolicy m_PrefixGenerationPolicy
 
TargetFilenameGenerationPolicy m_ExtensionGenerationPolicy
 
- Protected Attributes inherited from CompileOptionsBase
int m_Platform
 
wxArrayString m_LinkerOptions
 
wxArrayString m_LinkLibs
 
wxArrayString m_CompilerOptions
 
wxArrayString m_ResourceCompilerOptions
 
wxArrayString m_IncludeDirs
 
wxArrayString m_ResIncludeDirs
 
wxArrayString m_LibDirs
 
wxArrayString m_CmdsBefore
 
wxArrayString m_CmdsAfter
 
wxArrayString m_Scripts
 
bool m_Modified
 
bool m_AlwaysRunPostCmds
 
StringHash m_Vars
 

Detailed Description

Represents a Code::Blocks project build target.

Definition at line 24 of file projectbuildtarget.h.

Constructor & Destructor Documentation

◆ ProjectBuildTarget()

ProjectBuildTarget::ProjectBuildTarget ( cbProject parentProject)

Constructor.

Definition at line 24 of file projectbuildtarget.cpp.

References m_BuildWithAll, m_CreateDefFile, m_CreateStaticLib, m_FileArray, and m_UseConsoleRunner.

◆ ~ProjectBuildTarget()

ProjectBuildTarget::~ProjectBuildTarget ( )
override

Destructor.

Definition at line 36 of file projectbuildtarget.cpp.

Member Function Documentation

◆ AddTargetDep()

void ProjectBuildTarget::AddTargetDep ( ProjectBuildTarget target)
virtual

Targets to be compiled (if necessary) before this one.

Add a target to the list of dependencies of this target. Be careful not to add a target more than once.

Parameters
targetThe build target to add as a dependency.

Definition at line 146 of file projectbuildtarget.cpp.

References m_TargetDeps.

◆ GetAdditionalOutputFiles()

const wxString & ProjectBuildTarget::GetAdditionalOutputFiles ( ) const
virtual
Returns
A string containing a list of additional output files, besides the main output. If any of the files in this list is older than the list returned by GetExternalDeps(), the target is relinked.

Definition at line 64 of file projectbuildtarget.cpp.

References m_AdditionalOutputFiles.

Referenced by DirectCommands::AreExternalDepsOutdated(), ProjectLoader::ExportTargetAsProject(), ExternalDepsDlg::FillAdditional(), and ScriptBindings::RegisterBindings().

◆ GetCreateDefFile()

bool ProjectBuildTarget::GetCreateDefFile ( ) const
virtual

Valid only for targets generating dynamic libraries (DLLs or SOs).

Returns
True if the target creates a DEF imports file.

Definition at line 92 of file projectbuildtarget.cpp.

References m_CreateDefFile.

Referenced by ProjectOptionsDlg::DoTargetChange(), ProjectLoader::ExportTargetAsProject(), and ScriptBindings::RegisterBindings().

◆ GetCreateStaticLib()

bool ProjectBuildTarget::GetCreateStaticLib ( )
virtual

Valid only for targets generating dynamic libraries (DLLs or SOs).

Returns
True if an import library will be created, false if not.

Definition at line 106 of file projectbuildtarget.cpp.

References m_CreateStaticLib.

Referenced by ProjectOptionsDlg::DoTargetChange(), ProjectLoader::ExportTargetAsProject(), and ScriptBindings::RegisterBindings().

◆ GetExternalDeps()

const wxString & ProjectBuildTarget::GetExternalDeps ( ) const
virtual
Returns
A string containing a list of all the external files this target depends on. If any of the files in this list is newer than the target's output, the target is relinked.

Definition at line 50 of file projectbuildtarget.cpp.

References m_ExternalDeps.

Referenced by DirectCommands::AreExternalDepsOutdated(), ProjectLoader::ExportTargetAsProject(), ExternalDepsDlg::FillExternal(), and ScriptBindings::RegisterBindings().

◆ GetFile()

ProjectFile * ProjectBuildTarget::GetFile ( int  index)

Access a file of the target.

Parameters
indexThe index of the file. Must be greater or equal than zero and less than GetFilesCount().
Returns
A pointer to the file or NULL if not found.

Definition at line 157 of file projectbuildtarget.cpp.

References m_FileArray, m_Files, and NULL.

Referenced by ScriptBindings::RegisterBindings().

◆ GetFilesCount()

int ProjectBuildTarget::GetFilesCount ( )
inline
Returns
The number of files in the target.

Definition at line 120 of file projectbuildtarget.h.

References ScriptBindings::IOLib::RemoveFile().

Referenced by ScriptBindings::RegisterBindings().

◆ GetFilesList()

virtual FilesList& ProjectBuildTarget::GetFilesList ( )
inlinevirtual

Provides an easy way to iterate all the files belonging in this target.

Returns
A list of files belonging in this target.

Definition at line 117 of file projectbuildtarget.h.

Referenced by EditorManager::CollectDefines(), cbProject::DuplicateBuildTarget(), and ProjectLoader::ExportTargetAsProject().

◆ GetFullTitle()

wxString ProjectBuildTarget::GetFullTitle ( ) const
virtual
Returns
The full title, i.e. "projectname - targetname".

Definition at line 45 of file projectbuildtarget.cpp.

References _T, CompileTargetBase::GetTitle(), and m_Project.

Referenced by DirectCommands::GetTargetLinkCommands(), CompilerGCC::PrintInvalidCompiler(), and ScriptBindings::RegisterBindings().

◆ GetIncludeInTargetAll()

bool ProjectBuildTarget::GetIncludeInTargetAll ( ) const
virtual

Deprecated, do not use at all!

Returns
True if this target should be built when the virtual target "All" is selected, false if not.

Definition at line 78 of file projectbuildtarget.cpp.

References m_BuildWithAll.

Referenced by DirectCommands::GetCompileCommands(), DirectCommands::GetLinkCommands(), ProjectLoader::Open(), and ScriptBindings::RegisterBindings().

◆ GetParentProject()

cbProject * ProjectBuildTarget::GetParentProject ( )
virtual

◆ GetTargetDeps()

BuildTargets & ProjectBuildTarget::GetTargetDeps ( )
virtual
Returns
A list of dependency targets of this target.

Definition at line 152 of file projectbuildtarget.cpp.

References m_TargetDeps.

◆ GetUseConsoleRunner()

bool ProjectBuildTarget::GetUseConsoleRunner ( ) const
virtual

Valid only for targets generating a console executable.

ConsoleRunner is an external utility program that waits for a keypress after the target is executed.

Returns
True if ConsoleRunner should be used, false if not.

Definition at line 120 of file projectbuildtarget.cpp.

References CompileTargetBase::GetRunHostApplicationInTerminal(), CompileTargetBase::GetTargetType(), m_UseConsoleRunner, and ttConsoleOnly.

Referenced by DebuggerGDB::DoDebug(), ProjectOptionsDlg::DoTargetChange(), ProjectLoader::ExportTargetAsProject(), ScriptBindings::RegisterBindings(), and CompilerGCC::Run().

◆ RemoveFile()

bool ProjectBuildTarget::RemoveFile ( ProjectFile pf)

Remove a file from the target.

Parameters
pfThe pointer to ProjectFile.
Returns
True if pf was a valid project file, false if not.

Definition at line 175 of file projectbuildtarget.cpp.

References m_FileArray, and m_Files.

◆ SetAdditionalOutputFiles()

void ProjectBuildTarget::SetAdditionalOutputFiles ( const wxString files)
virtual

Set a list of all additional output files this targets creates, besides its main output.

If any of the files in this list is older than the list returned by GetExternalDeps(), the target is relinked.

Parameters
filesA string containing the list of additional files.

Definition at line 69 of file projectbuildtarget.cpp.

References m_AdditionalOutputFiles, and CompileOptionsBase::SetModified().

Referenced by ProjectLoader::DoBuildTargetOptions(), ExternalDepsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetCreateDefFile()

void ProjectBuildTarget::SetCreateDefFile ( bool  createIt)
virtual

Set if the target creates a DEF imports file.

Valid only for targets generating dynamic libraries (DLLs or SOs).

Parameters
createItIf true, a DEF file is generated else it is not.

Definition at line 97 of file projectbuildtarget.cpp.

References m_CreateDefFile, and CompileOptionsBase::SetModified().

Referenced by ProjectOptionsDlg::DoBeforeTargetChange(), ProjectLoader::DoBuildTargetOptions(), and ScriptBindings::RegisterBindings().

◆ SetCreateStaticLib()

void ProjectBuildTarget::SetCreateStaticLib ( bool  createIt)
virtual

Set if an import library should be created.

Valid only for targets generating dynamic libraries (DLLs or SOs).

Parameters
createItIf true, an import library will be created else it will not.

Definition at line 111 of file projectbuildtarget.cpp.

References m_CreateStaticLib, and CompileOptionsBase::SetModified().

Referenced by ProjectOptionsDlg::DoBeforeTargetChange(), ProjectLoader::DoBuildTargetOptions(), and ScriptBindings::RegisterBindings().

◆ SetExternalDeps()

void ProjectBuildTarget::SetExternalDeps ( const wxString deps)
virtual

Set a list of all the external files this targets depends on.

If any of the files in this list is newer than the target's output, the target is relinked.

Parameters
depsA string containing the list of files.

Definition at line 55 of file projectbuildtarget.cpp.

References m_ExternalDeps, and CompileOptionsBase::SetModified().

Referenced by ProjectLoader::DoBuildTargetOptions(), ExternalDepsDlg::EndModal(), and ScriptBindings::RegisterBindings().

◆ SetIncludeInTargetAll()

void ProjectBuildTarget::SetIncludeInTargetAll ( bool  buildIt)
virtual

Deprecated, do not use at all! Set if this target should be built when the virtual target "All" is selected.

Parameters
buildItIf true, the target will be built with "All" else it won't.

Definition at line 83 of file projectbuildtarget.cpp.

References m_BuildWithAll, and CompileOptionsBase::SetModified().

Referenced by ProjectLoader::DoBuildTargetOptions(), ScriptBindings::RegisterBindings(), Wiz::RunProjectWizard(), and Wiz::RunTargetWizard().

◆ SetTargetType()

void ProjectBuildTarget::SetTargetType ( TargetType  pt)
overridevirtual

◆ SetUseConsoleRunner()

void ProjectBuildTarget::SetUseConsoleRunner ( bool  useIt)
virtual

Set if ConsoleRunner should be used.

Valid only for targets generating a console executable. ConsoleRunner is an external utility program that waits for a keypress after the target is executed.

Parameters
useItIf true, ConsoleRunner is used else it is not.

Definition at line 128 of file projectbuildtarget.cpp.

References CompileTargetBase::GetTargetType(), m_UseConsoleRunner, CompileOptionsBase::SetModified(), and ttConsoleOnly.

Referenced by ProjectOptionsDlg::DoBeforeTargetChange(), ProjectLoader::DoBuildTargetOptions(), ScriptBindings::RegisterBindings(), and SetTargetType().

Friends And Related Function Documentation

◆ ProjectFile

friend class ProjectFile
friend

Definition at line 135 of file projectbuildtarget.h.

Member Data Documentation

◆ m_AdditionalOutputFiles

wxString ProjectBuildTarget::m_AdditionalOutputFiles
private

Definition at line 139 of file projectbuildtarget.h.

Referenced by GetAdditionalOutputFiles(), and SetAdditionalOutputFiles().

◆ m_BuildWithAll

bool ProjectBuildTarget::m_BuildWithAll
private

◆ m_CreateDefFile

bool ProjectBuildTarget::m_CreateDefFile
private

Definition at line 145 of file projectbuildtarget.h.

Referenced by GetCreateDefFile(), ProjectBuildTarget(), and SetCreateDefFile().

◆ m_CreateStaticLib

bool ProjectBuildTarget::m_CreateStaticLib
private

◆ m_ExternalDeps

wxString ProjectBuildTarget::m_ExternalDeps
private

Definition at line 138 of file projectbuildtarget.h.

Referenced by GetExternalDeps(), and SetExternalDeps().

◆ m_FileArray

ProjectFileArray ProjectBuildTarget::m_FileArray
private

◆ m_Files

FilesList ProjectBuildTarget::m_Files
private

◆ m_Project

cbProject* ProjectBuildTarget::m_Project
private

Definition at line 137 of file projectbuildtarget.h.

Referenced by GetFullTitle(), and GetParentProject().

◆ m_TargetDeps

BuildTargets ProjectBuildTarget::m_TargetDeps
private

Definition at line 140 of file projectbuildtarget.h.

Referenced by AddTargetDep(), and GetTargetDeps().

◆ m_UseConsoleRunner

bool ProjectBuildTarget::m_UseConsoleRunner
private

The documentation for this class was generated from the following files: