cbp2make
Makefile generation tool for Code::Blocks IDE
cbproject.h
Go to the documentation of this file.
1 /*
2  cbp2make : Makefile generation tool for the Code::Blocks IDE
3  Copyright (C) 2010-2013 Mirai Computing (mirai.computing@gmail.com)
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 //------------------------------------------------------------------------------
20 #ifndef CBPROJECT_H
21 #define CBPROJECT_H
22 //------------------------------------------------------------------------------
23 #include "stlstrings.h"
24 #include "stlconfig.h"
25 //#include "cbptarget.h"
26 //#include "cbpunit.h"
27 #include "depsearch.h"
28 #include "makefile.h"
29 //------------------------------------------------------------------------------
30 
31 class CBuildTarget;
32 class CVirtualTarget;
33 class CBuildUnit;
34 class CToolChain;
36 
37 class TiXmlElement;
38 
40 {
41  private:
42  //bool m_ValidProject;
59  std::vector<CBuildTarget*> m_BuildTargets;
60  std::vector<CVirtualTarget*> m_VirtualTargets;
61  std::vector<CBuildUnit*> m_Units;
64  //
66  std::vector<CBuildTarget*> m_BuildTargetIndex;
67  std::vector<CVirtualTarget*> m_VirtualTargetIndex;
68  std::vector<CBuildUnit*> m_UnitIndex;
69  std::vector<CToolChain*> m_ToolChainIndex;
70  std::vector<int> m_TargetToolChainIndex;
71  //
73  //CStringList m_MakefileText;
75  protected:
76  //void DecorateTargetNames(void);
77  void SortUnitsByWeight(void);
78  public:
79  void Clear(void);
80  void Read(const TiXmlElement *ProjectRoot);
81  bool LoadProject(const CString& FileName);
82  void Show(void);
83  private:
84  void UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig& Config);
85  void UpdateTargetIndex(const int Target, CCodeBlocksBuildConfig& Config);
86  public:
87  static CString DecorateVariableName(const CString& VariableName, const int Case = 0);
88  static CString DecorateTargetName(const CString& TargetName, const int Case = 2);
89  CString ToolChainSuffix(const int ToolChainIndex, CCodeBlocksBuildConfig& Config);
90  //bool GenerateMakefileText(const CString& FileName, CCodeBlocksBuildConfig& Config);
91  bool GenerateMakefile(const CString& FileName, CCodeBlocksBuildConfig& Config);
92  public:
93  CCodeBlocksProject(void);
94  ~CCodeBlocksProject(void);
95 };
96 
97 #endif
98 //------------------------------------------------------------------------------
CStringList m_LinkerOptions
Project-wide list of linker options.
Definition: cbproject.h:51
CString m_Title
Title of the project.
Definition: cbproject.h:45
bool m_SinglePlatform
Indicates that makefile should be generated only for one platform.
Definition: cbproject.h:65
int m_VersionMinor
Minor version number.
Definition: cbproject.h:44
void Read(const TiXmlElement *ProjectRoot)
Reads the project settings from an XML document.
Definition: cbproject.cpp:81
CString ToolChainSuffix(const int ToolChainIndex, CCodeBlocksBuildConfig &Config)
Definition: cbproject.cpp:617
Dependency information for build units in a project.
Definition: depsearch.h:63
int m_VersionMajor
Major version number.
Definition: cbproject.h:43
std::vector< CToolChain * > m_ToolChainIndex
List of toolchains valid for a platform.
Definition: cbproject.h:69
Definition: cbptarget.h:31
CStringList m_CompilerDirectories
Project-wide list of search directories for compiler(s).
Definition: cbproject.h:50
CString m_DefaultTarget
Name of the default build target of the project.
Definition: cbproject.h:46
Build unit description.
Definition: cbpunit.h:32
void SortUnitsByWeight(void)
Sorts project units by weight in ascending order.
Definition: cbproject.cpp:379
CStringList m_LinkerLibraries
Project-wide list of libraries to link with the project.
Definition: cbproject.h:52
std::vector< CBuildTarget * > m_BuildTargetIndex
List of build targets valid for a platform.
Definition: cbproject.h:66
CStringList m_Platforms
List of platforms used in the project.
Definition: cbproject.h:63
std::vector< int > m_TargetToolChainIndex
Definition: cbproject.h:70
std::vector< CBuildTarget * > m_BuildTargets
List of build targets of the project.
Definition: cbproject.h:59
std::vector< CBuildUnit * > m_UnitIndex
List of build units valid for a build target.
Definition: cbproject.h:68
Definition: stlstrings.h:98
Toolchain description.
Definition: toolchains.h:31
void UpdatePlatformIndex(const size_t Platform, CCodeBlocksBuildConfig &Config)
Updates lists of build targets, virtual build targets and toolchains.
Definition: cbproject.cpp:457
CStringList m_LinkerDirectories
Project-wide list of search directories for linker.
Definition: cbproject.h:53
std::vector< CVirtualTarget * > m_VirtualTargetIndex
List of virtual build targets valid for a platform.
Definition: cbproject.h:67
static CString DecorateTargetName(const CString &TargetName, const int Case=2)
Makes a makefile-compatible build target name from the given name.
Definition: cbproject.cpp:593
Definition: stlstrings.h:32
void Show(void)
Prints the project contents to standard output.
Definition: cbproject.cpp:393
CStringList m_AfterBuildCommands
Project-wide list of commands that should be executed after the build process is finished.
Definition: cbproject.h:56
Definition: cbptarget.h:137
bool m_ExtendedObjectNames
Controls how object files are named.
Definition: cbproject.h:48
Build configuration.
Definition: cbbuildcfg.h:32
CString m_Compiler
Name (alias) of the default toolchain for the project.
Definition: cbproject.h:47
Makefile definition.
Definition: makefile.h:99
CMakefile m_Makefile
Contains object-based description of makefile for the project.
Definition: cbproject.h:74
CStringList m_BeforeBuildCommands
Project-wide list of commands that should be executed prior to starting the build process...
Definition: cbproject.h:55
bool GenerateMakefile(const CString &FileName, CCodeBlocksBuildConfig &Config)
Generates makefile text and writes it to the file specified by FileName.
Definition: cbproject.cpp:637
~CCodeBlocksProject(void)
Destroys project.
Definition: cbproject.cpp:40
Project description.
Definition: cbproject.h:39
bool LoadProject(const CString &FileName)
Loads a project from a file specified by FileName.
Definition: cbproject.cpp:332
std::vector< CBuildUnit * > m_Units
List of build units of the project.
Definition: cbproject.h:61
static CString DecorateVariableName(const CString &VariableName, const int Case=0)
Makes a makefile-compatible macro variable name from the given name.
Definition: cbproject.cpp:605
CConfiguration m_Environment
Symbol table for environment variables.
Definition: cbproject.h:62
bool m_ForceBeforeBuildCommands
Makes the execution of the project-wide before-build commands unconditional.
Definition: cbproject.h:57
void Clear(void)
Resets the project to the initial state.
Definition: cbproject.cpp:45
Unit dependency information gathering.
Object-based makefile generation.
Definition: stlconfig.h:26
void UpdateTargetIndex(const int Target, CCodeBlocksBuildConfig &Config)
Updates list of build units.
Definition: cbproject.cpp:566
CCodeBlocksProject(void)
Creates project.
Definition: cbproject.cpp:35
CStringList m_CompilerOptions
Project-wide list of compiler options.
Definition: cbproject.h:49
bool m_ForceAfterBuildCommands
Makes the execution of the project-wide after-build commands unconditional.
Definition: cbproject.h:58
std::vector< CVirtualTarget * > m_VirtualTargets
List of virtual build targets of the project.
Definition: cbproject.h:60
CDependencyInfo m_Dependencies
Stores dependencies of build units.
Definition: cbproject.h:72
CStringList m_ResourceCompilerDirectories
Project-wide list of search directories for resource compiler.
Definition: cbproject.h:54