Code::Blocks  SVN r11506
compilercommandgenerator.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  */
5 
6 #ifndef COMPILERCOMMANDGENERATOR_H
7 #define COMPILERCOMMANDGENERATOR_H
8 
9 #include <map>
10 
11 #include <wx/string.h>
12 #include <wx/dynarray.h>
13 #include "settings.h"
14 #include "compiletargetbase.h"
15 
16 class cbProject;
17 class ProjectBuildTarget;
18 class ProjectFile;
19 class Compiler;
20 
21 typedef std::map<ProjectBuildTarget*, wxString> OptionsMap;
22 typedef std::map<ProjectBuildTarget*, wxArrayString> SearchDirsMap;
23 
31 {
32  public:
34  virtual ~CompilerCommandGenerator();
35 
37  virtual void Init(cbProject* project);
38 
40  virtual void GenerateCommandLine(wxString& macro,
41  ProjectBuildTarget* target,
42  ProjectFile* pf,
43  const wxString& file,
44  const wxString& object,
45  const wxString& flat_object,
46  const wxString& deps);
47 
56  virtual const wxArrayString& GetCompilerSearchDirs(ProjectBuildTarget* target);
57 
66  virtual const wxArrayString& GetLinkerSearchDirs(ProjectBuildTarget* target);
67  protected:
68  virtual void DoBuildScripts(cbProject* project, CompileTargetBase* target, const wxString& funcName);
69  virtual wxString GetOrderedOptions(const ProjectBuildTarget* target, OptionsRelationType rel, const wxString& project_options, const wxString& target_options);
70  virtual wxArrayString GetOrderedOptions(const ProjectBuildTarget* target, OptionsRelationType rel, const wxArrayString& project_options, const wxArrayString& target_options);
71  virtual wxArrayString GetOrderedIncludeDirs(Compiler* compiler, ProjectBuildTarget* target);
72  virtual wxArrayString GetOrderedLibrariesDirs(Compiler* compiler, ProjectBuildTarget* target);
73  virtual wxArrayString GetOrderedResourceIncludeDirs(Compiler* compiler, ProjectBuildTarget* target);
74  static wxString MakeOptString(const wxArrayString& arr, const wxString& opt, wxChar separator = _T(' '));
75  static wxString PathSearch(const wxArrayString& arr, const wxString& filename);
76  virtual wxString SetupOutputFilenames(Compiler* compiler, ProjectBuildTarget* target);
77  virtual wxString SetupIncludeDirs(Compiler* compiler, ProjectBuildTarget* target);
78  virtual wxString SetupLibrariesDirs(Compiler* compiler, ProjectBuildTarget* target);
79  virtual wxString SetupResourceIncludeDirs(Compiler* compiler, ProjectBuildTarget* target);
80  virtual wxString SetupCompilerOptions(Compiler* compiler, ProjectBuildTarget* target);
81  virtual wxString SetupLinkerOptions(Compiler* compiler, ProjectBuildTarget* target);
82  virtual wxString SetupLinkLibraries(Compiler* compiler, ProjectBuildTarget* target);
83  virtual wxString SetupResourceCompilerOptions(Compiler* compiler, ProjectBuildTarget* target);
84  virtual wxString FixupLinkLibraries(Compiler* compiler, const wxString& lib);
85  virtual void FixPathSeparators(Compiler* compiler, wxString& inAndOut);
86 
97 
99 
102  private:
103  wxString GetProcessedIncludeDir(Compiler* compiler, ProjectBuildTarget* target,
104  const wxArrayString& inc_dirs, const wxString& inc_switch);
105  void SearchDirsFromBackticks(Compiler* compiler, ProjectBuildTarget* target, const wxString& btOutput);
108 };
109 
110 #endif // COMPILERCOMMANDGENERATOR_H
OptionsMap m_DefOutput
def output filenames, per-target
Generate command-lines needed to produce a build.
OptionsMap m_Inc
compiler &#39;include&#39; dirs, per-target
SearchDirsMap m_LinkerSearchDirs
array of final linker search dirs, per-target
#define _T(string)
OptionsMap m_RC
resource compiler &#39;include&#39; dirs, per-target
OptionsMap m_Lib
linker &#39;include&#39; dirs, per-target
wxString m_PrjIncPath
directive to add the project&#39;s top-level path in compiler search dirs (ready for the command line) ...
Represents a file in a Code::Blocks project.
Definition: projectfile.h:39
std::map< ProjectBuildTarget *, wxString > OptionsMap
#define DLLIMPORT
Definition: settings.h:16
wxUSE_UNICODE_dependent wxChar
Represents a Code::Blocks project.
Definition: cbproject.h:96
std::map< ProjectBuildTarget *, wxArrayString > SearchDirsMap
OptionsMap m_LDAdd
link libraries, per-target
OptionsMap m_CFlags
compiler flags, per-target
Abstract base class for compilers.
Definition: compiler.h:274
SearchDirsMap m_CompilerSearchDirs
array of final compiler search dirs, per-target
OptionsMap m_RCFlags
resource compiler flags, per-target
OptionsMap m_StaticOutput
static output filenames, per-target
Represents a Code::Blocks project build target.
OptionsMap m_LDFlags
linker flags, per-target
OptionsRelationType
Enum that defines the option&#39;s relation types.
OptionsMap m_Output
output filenames, per-target
Base class for build target classes Each Code::Blocks project consists of at least one target...