cbp2make
Makefile generation tool for Code::Blocks IDE
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CCodeBlocksProject Class Reference

Project description. More...

#include <cbproject.h>

Public Member Functions

void Clear (void)
 Resets the project to the initial state. More...
 
void Read (const TiXmlElement *ProjectRoot)
 Reads the project settings from an XML document. More...
 
bool LoadProject (const CString &FileName)
 Loads a project from a file specified by FileName. More...
 
void Show (void)
 Prints the project contents to standard output. More...
 
CString ToolChainSuffix (const int ToolChainIndex, CCodeBlocksBuildConfig &Config)
 
bool GenerateMakefile (const CString &FileName, CCodeBlocksBuildConfig &Config)
 Generates makefile text and writes it to the file specified by FileName. More...
 
 CCodeBlocksProject (void)
 Creates project. More...
 
 ~CCodeBlocksProject (void)
 Destroys project. More...
 

Static Public Member Functions

static CString DecorateVariableName (const CString &VariableName, const int Case=0)
 Makes a makefile-compatible macro variable name from the given name. More...
 
static CString DecorateTargetName (const CString &TargetName, const int Case=2)
 Makes a makefile-compatible build target name from the given name. More...
 

Protected Member Functions

void SortUnitsByWeight (void)
 Sorts project units by weight in ascending order. More...
 

Private Member Functions

void UpdatePlatformIndex (const size_t Platform, CCodeBlocksBuildConfig &Config)
 Updates lists of build targets, virtual build targets and toolchains. More...
 
void UpdateTargetIndex (const int Target, CCodeBlocksBuildConfig &Config)
 Updates list of build units. More...
 

Private Attributes

int m_VersionMajor
 Major version number. More...
 
int m_VersionMinor
 Minor version number. More...
 
CString m_Title
 Title of the project. More...
 
CString m_DefaultTarget
 Name of the default build target of the project. More...
 
CString m_Compiler
 Name (alias) of the default toolchain for the project. More...
 
bool m_ExtendedObjectNames
 Controls how object files are named. More...
 
CStringList m_CompilerOptions
 Project-wide list of compiler options. More...
 
CStringList m_CompilerDirectories
 Project-wide list of search directories for compiler(s). More...
 
CStringList m_LinkerOptions
 Project-wide list of linker options. More...
 
CStringList m_LinkerLibraries
 Project-wide list of libraries to link with the project. More...
 
CStringList m_LinkerDirectories
 Project-wide list of search directories for linker. More...
 
CStringList m_ResourceCompilerDirectories
 Project-wide list of search directories for resource compiler. More...
 
CStringList m_BeforeBuildCommands
 Project-wide list of commands that should be executed prior to starting the build process. More...
 
CStringList m_AfterBuildCommands
 Project-wide list of commands that should be executed after the build process is finished. More...
 
bool m_ForceBeforeBuildCommands
 Makes the execution of the project-wide before-build commands unconditional. More...
 
bool m_ForceAfterBuildCommands
 Makes the execution of the project-wide after-build commands unconditional. More...
 
std::vector< CBuildTarget * > m_BuildTargets
 List of build targets of the project. More...
 
std::vector< CVirtualTarget * > m_VirtualTargets
 List of virtual build targets of the project. More...
 
std::vector< CBuildUnit * > m_Units
 List of build units of the project. More...
 
CConfiguration m_Environment
 Symbol table for environment variables. More...
 
CStringList m_Platforms
 List of platforms used in the project. More...
 
bool m_SinglePlatform
 Indicates that makefile should be generated only for one platform. More...
 
std::vector< CBuildTarget * > m_BuildTargetIndex
 List of build targets valid for a platform. More...
 
std::vector< CVirtualTarget * > m_VirtualTargetIndex
 List of virtual build targets valid for a platform. More...
 
std::vector< CBuildUnit * > m_UnitIndex
 List of build units valid for a build target. More...
 
std::vector< CToolChain * > m_ToolChainIndex
 List of toolchains valid for a platform. More...
 
std::vector< int > m_TargetToolChainIndex
 
CDependencyInfo m_Dependencies
 Stores dependencies of build units. More...
 
CMakefile m_Makefile
 Contains object-based description of makefile for the project. More...
 

Detailed Description

Project description.

Contains properties of a project and generates makefiles.

Constructor & Destructor Documentation

◆ CCodeBlocksProject()

CCodeBlocksProject::CCodeBlocksProject ( void  )

Creates project.

◆ ~CCodeBlocksProject()

CCodeBlocksProject::~CCodeBlocksProject ( void  )

Destroys project.

Member Function Documentation

◆ Clear()

CCodeBlocksProject::Clear ( void  )

Resets the project to the initial state.

◆ DecorateTargetName()

CCodeBlocksProject::DecorateTargetName ( const CString TargetName,
const int  Case = 2 
)
static

Makes a makefile-compatible build target name from the given name.

Parameters
TargetNamean unprepared build target name.
Casecasing of the variable name:
  • 0 - don't change existing case
  • 1 - make all characters lower case
  • 2 - make all characters upper case (default)
Returns
makefile-compatible build target name.

This function uses MakefileFriendly(const CString& AString) for the job.

◆ DecorateVariableName()

CCodeBlocksProject::DecorateVariableName ( const CString VariableName,
const int  Case = 0 
)
static

Makes a makefile-compatible macro variable name from the given name.

Parameters
VariableNamean unprepared macro variable name.
Casecasing of the variable name:
  • 0 - don't change existing case (default)
  • 1 - make all characters lower case
  • 2 - make all characters upper case
Returns
makefile-compatible macro variable name.

This function uses MakefileFriendly(const CString& AString) for the job.

◆ GenerateMakefile()

CCodeBlocksProject::GenerateMakefile ( const CString FileName,
CCodeBlocksBuildConfig Config 
)

Generates makefile text and writes it to the file specified by FileName.

Parameters
FileNamea file name for makefile of the project.
Configbuild configuration.
Returns
true if makefile was successfully generated, false otherwise.

This function uses intermediate object-based makefile description CCodeBlocksProject::m_Makefile to generate plain text makefile.

◆ LoadProject()

CCodeBlocksProject::LoadProject ( const CString FileName)

Loads a project from a file specified by FileName.

Parameters
FileNamename of Code::Blocks project file.
Returns
true if specified project is successfully loaded, false otherwise.

◆ Read()

CCodeBlocksProject::Read ( const TiXmlElement *  ProjectRoot)

Reads the project settings from an XML document.

Parameters
ProjectRootan element of XML document.

◆ Show()

CCodeBlocksProject::Show ( void  )

Prints the project contents to standard output.

◆ SortUnitsByWeight()

CCodeBlocksProject::SortUnitsByWeight ( void  )
protected

Sorts project units by weight in ascending order.

See also
CBuildUnit::m_Weight.

◆ ToolChainSuffix()

CString CCodeBlocksProject::ToolChainSuffix ( const int  ToolChainIndex,
CCodeBlocksBuildConfig Config 
)

◆ UpdatePlatformIndex()

CCodeBlocksProject::UpdatePlatformIndex ( const size_t  Platform,
CCodeBlocksBuildConfig Config 
)
private

Updates lists of build targets, virtual build targets and toolchains.

Parameters
Platformindex of a platform in the build configuration.
Configbuild configuration.

Refreshes CCodeBlocksProject::m_BuildTargetIndex, CCodeBlocksProject::m_VirtualTargetIndex and CCodeBlocksProject::m_ToolChainIndex by selecting only items valid for the specified platform.

◆ UpdateTargetIndex()

CCodeBlocksProject::UpdateTargetIndex ( const int  Target,
CCodeBlocksBuildConfig Config 
)
private

Updates list of build units.

Parameters
Targetindex of a target in the build configuration.
Configbuild configuration.

Refreshes CCodeBlocksProject::m_UnitIndex by selecting only units valid for the specified build target.

Member Data Documentation

◆ m_AfterBuildCommands

CCodeBlocksProject::m_AfterBuildCommands
private

Project-wide list of commands that should be executed after the build process is finished.

◆ m_BeforeBuildCommands

CCodeBlocksProject::m_BeforeBuildCommands
private

Project-wide list of commands that should be executed prior to starting the build process.

◆ m_BuildTargetIndex

CCodeBlocksProject::m_BuildTargetIndex
private

List of build targets valid for a platform.

Contains pointers to CBuildTarget objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config).

◆ m_BuildTargets

CCodeBlocksProject::m_BuildTargets
private

List of build targets of the project.

Contains pointers to CBuildTarget objects and owns them (i.e. objects sould be destroyed before the list is cleared).

◆ m_Compiler

CCodeBlocksProject::m_Compiler
private

Name (alias) of the default toolchain for the project.

◆ m_CompilerDirectories

CCodeBlocksProject::m_CompilerDirectories
private

Project-wide list of search directories for compiler(s).

◆ m_CompilerOptions

CCodeBlocksProject::m_CompilerOptions
private

Project-wide list of compiler options.

◆ m_DefaultTarget

CCodeBlocksProject::m_DefaultTarget
private

Name of the default build target of the project.

◆ m_Dependencies

CCodeBlocksProject::m_Dependencies
private

Stores dependencies of build units.

CDependencyInfo is used to store information about relationship between build units in order to generate makefule rules for unit dependencies.

See depsearch.h for additional information on gathering unit dependencies.

◆ m_Environment

CCodeBlocksProject::m_Environment
private

Symbol table for environment variables.

◆ m_ExtendedObjectNames

CCodeBlocksProject::m_ExtendedObjectNames
private

Controls how object files are named.

When set to true, an object file extension (e.g. ".o" or ".obj") is appended to a build unit file name (e.g. "unit.cpp" becomes "unit.cpp.o"), otherwise, when set to false, a build unit file extension is replaced by an object file extension (e.g. "unit.cpp" becomes "unit.o").

◆ m_ForceAfterBuildCommands

CCodeBlocksProject::m_ForceAfterBuildCommands
private

Makes the execution of the project-wide after-build commands unconditional.

See also
CCodeBlocksProject::m_AfterBuildCommands

◆ m_ForceBeforeBuildCommands

CCodeBlocksProject::m_ForceBeforeBuildCommands
private

Makes the execution of the project-wide before-build commands unconditional.

See also
CCodeBlocksProject::m_BeforeBuildCommands

◆ m_LinkerDirectories

CCodeBlocksProject::m_LinkerDirectories
private

Project-wide list of search directories for linker.

◆ m_LinkerLibraries

CCodeBlocksProject::m_LinkerLibraries
private

Project-wide list of libraries to link with the project.

◆ m_LinkerOptions

CCodeBlocksProject::m_LinkerOptions
private

Project-wide list of linker options.

◆ m_Makefile

CCodeBlocksProject::m_Makefile
private

Contains object-based description of makefile for the project.

Contents of makefile are generated by CCodeBlocksProject::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config) before saving to a file.

◆ m_Platforms

CCodeBlocksProject::m_Platforms
private

List of platforms used in the project.

Contains pointers to CPlatform objects and owns them (i.e. objects sould be destroyed before the list is cleared).

◆ m_ResourceCompilerDirectories

CCodeBlocksProject::m_ResourceCompilerDirectories
private

Project-wide list of search directories for resource compiler.

◆ m_SinglePlatform

CCodeBlocksProject::m_SinglePlatform
private

Indicates that makefile should be generated only for one platform.

This property is automatically refreshed by CCodeBlocksProject::GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config) or CCodeBlocksProject::GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config).

◆ m_TargetToolChainIndex

std::vector<int> CCodeBlocksProject::m_TargetToolChainIndex
private

◆ m_Title

CCodeBlocksProject::m_Title
private

Title of the project.

◆ m_ToolChainIndex

CCodeBlocksProject::m_ToolChainIndex
private

List of toolchains valid for a platform.

Contains pointers to CPlatform objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config).

◆ m_UnitIndex

CCodeBlocksProject::m_UnitIndex
private

List of build units valid for a build target.

Contains pointers to CBuildUnit objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdateTargetIndex(const int Target, CCodeBlocksBuildConfig& Config).

◆ m_Units

CCodeBlocksProject::m_Units
private

List of build units of the project.

Contains pointers to CBuildUnit objects and owns them (i.e. objects sould be destroyed before the list is cleared).

◆ m_VersionMajor

CCodeBlocksProject::m_VersionMajor
private

Major version number.

◆ m_VersionMinor

CCodeBlocksProject::m_VersionMinor
private

Minor version number.

◆ m_VirtualTargetIndex

CCodeBlocksProject::m_VirtualTargetIndex
private

List of virtual build targets valid for a platform.

Contains pointers to CVirtualTarget objects but does not own them (i.e. objects sould not be destroyed before the list is cleared). This property is automatically refreshed by CCodeBlocksProject::UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config).

◆ m_VirtualTargets

CCodeBlocksProject::m_VirtualTargets
private

List of virtual build targets of the project.

Contains pointers to CVirtualTarget objects and owns them (i.e. objects sould be destroyed before the list is cleared).


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