cbp2make
Makefile generation tool for Code::Blocks IDE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
toolchains.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 TOOLCHAINS_H
21 #define TOOLCHAINS_H
22 //------------------------------------------------------------------------------
23 #include "stlstrings.h"
24 #include "platforms.h"
25 #include "buildtools.h"
26 //------------------------------------------------------------------------------
27 
28 class TiXmlElement;
29 class CToolChainSet;
30 
32 {
33  private:
36  protected:
42  //CString m_;
43  protected:
44  std::vector<CBuildTool *> m_BuildTools;
45  std::vector<CPreprocessor *> m_Preprocessors;
46  std::vector<CAssembler *> m_Assemblers;
47  std::vector<CCompiler *> m_Compilers;
48  std::vector<CResourceCompiler *> m_ResourceCompilers;
49  std::vector<CStaticLinker *> m_StaticLinkers;
50  std::vector<CDynamicLinker *> m_DynamicLinkers;
51  std::vector<CExecutableLinker *> m_ExecutableLinkers;
52  protected:
53  void GatherBuildTools(std::vector<CBuildTool *>& Source,
54  std::vector<CBuildTool *>& Target);
55  void GatherBuildTools(void);
56  CBuildTool *FindBuildTool(const CString& FileExtension,
57  const std::vector<CBuildTool *>& Tools);
58  std::vector<CBuildTool *>& GetTools(const CBuildTool::ToolType Type = CBuildTool::btOther);
59  void RemoveTool(const CBuildTool* BuildTool, std::vector<CBuildTool *>& Tools);
60  void RemoveTool(const CBuildTool* BuildTool);
61  protected:
62  void Read(const TiXmlElement *Root, const CString& Name, CString& Value);
63  void Read(const TiXmlElement *Root, const CString& Name, bool& Value);
64  void Write(TiXmlElement *Root, const CString& Name, const CString& Value);
65  void Write(TiXmlElement *Root, const CString& Name, const bool Value);
66  public:
67  CPlatform::OS_Type OS(void) const { return m_Platform; }
68  CString Alias(void) const { return m_Alias; }
70  CString& DefineSwitch(void) { return m_DefineSwitch; }
74  CString sw(void) const { return m_GenericSwitch; }
75  CString sw(const CString& ASwitch) const;
76  //CString (void) const { return m_; }
78  public:
79  virtual void Assign(const CToolChain& ToolChain);
80  virtual CToolChain *CreateInstance(void) const;
81  virtual void Clear(void);
82  virtual void Reset(const CPlatform::OS_Type OS);
83  virtual bool Supports(const CPlatform::OS_Type OS) const;
84  virtual void Read(const TiXmlElement *ToolChainRoot);
85  virtual void Write(TiXmlElement *ToolChainRoot);
86  virtual void Show(void);
88  CBuildTool *GetBuildTool(const size_t index, const CBuildTool::ToolType Type = CBuildTool::btOther);
89  CBuildTool *FindBuildToolByName(const CString& ToolName);
90  CBuildTool *FindBuildTool(const CString& FileExtension);
91  CAssembler *FindAssembler(const CString& FileExtension);
92  CCompiler *FindCompiler(const CString& FileExtension);
93  //std::vector<CBuildTool *> FindTools(const CString& FileExtension);
94  bool RemoveToolByName(const CString& ToolName);
95  public:
96  explicit CToolChain(const CString& Alias);
97  CToolChain(const CToolChain& ToolChain);
98  virtual ~CToolChain(void);
99 };
100 
101 //------------------------------------------------------------------------------
102 
104 {
105  public:
106  virtual CToolChain *CreateInstance(void) const;
107  virtual void Reset(const CPlatform::OS_Type OS);
108  public:
109  CGNUToolChain(void);
110  virtual ~CGNUToolChain(void);
111 };
112 
114 {
115  public:
116  virtual CToolChain *CreateInstance(void) const;
117  virtual void Reset(const CPlatform::OS_Type OS);
118  public:
119  CBorlandToolChain(void);
120  virtual ~CBorlandToolChain(void);
121 };
122 
124 {
125  public:
126  virtual CToolChain *CreateInstance(void) const;
127  virtual void Reset(const CPlatform::OS_Type OS);
128  public:
129  CIntelToolChain(void);
130  virtual ~CIntelToolChain(void);
131 };
132 
134 {
135  public:
136  virtual CToolChain *CreateInstance(void) const;
137  virtual void Reset(const CPlatform::OS_Type OS);
138  bool Supports(const CPlatform::OS_Type OS) const;
139  public:
140  CMSVCToolChain(void);
141  virtual ~CMSVCToolChain(void);
142 };
143 
144 //------------------------------------------------------------------------------
145 
147 {
148  private:
149  std::vector<std::vector<CToolChain *> > m_ToolChains;
150  bool m_Locked;
152  protected:
153  void AddToolChain(const CToolChain *AToolChain);
154  public:
155  void Lock(void);
156  void Unlock(void);
157  void Clear(void);
158  size_t GetCount(const CPlatform::OS_Type OS) const;
159  CToolChain *ToolChain(const CPlatform::OS_Type OS, const size_t Index) const;
160  CToolChain *Find(const CPlatform::OS_Type OS, const CString& Alias);
161  void AddDefault(void);
162  CToolChain *Add(const CPlatform::OS_Type OS, const CString& Alias);
163  void Remove(const CPlatform::OS_Type OS, const CString& Alias);
164  void Read(const TiXmlElement *ConfigRoot);
165  void Write(TiXmlElement *ConfigRoot);
166  //bool Load(const CString& FileName);
167  //bool Save(const CString& FileName);
168  void Show(void);
169  public:
170  CToolChainSet(void);
171  ~CToolChainSet(void);
172 };
173 
174 #endif
175 //------------------------------------------------------------------------------