1 #ifndef DIRECTCOMMANDS_H
2 #define DIRECTCOMMANDS_H
3 
4 #include <wx/string.h>
5 #include <wx/hashmap.h>
6 
7 extern const wxString COMPILER_SIMPLE_LOG;
8 extern const wxString COMPILER_NOTE_LOG;
9 extern const wxString COMPILER_WARNING_LOG;
10 extern const wxString COMPILER_ERROR_LOG;
11 extern const wxString COMPILER_TARGET_CHANGE;
12 extern const wxString COMPILER_WAIT;
13 extern const wxString COMPILER_WAIT_LINK;
14 
15 extern const wxString COMPILER_NOTE_ID_LOG;
16 extern const wxString COMPILER_WARNING_ID_LOG;
17 extern const wxString COMPILER_ERROR_ID_LOG;
18 
19 
20 // forward decls
21 class CompilerCommandGenerator;
22 class CompilerGCC;
23 class Compiler;
24 class cbProject;
25 class ProjectBuildTarget;
26 class ProjectFile;
27 class pfDetails;
28 
29 WX_DEFINE_ARRAY(ProjectFile*, MyFilesArray); // keep our own copy, to sort it by file weight (priority)
30 
31 class DirectCommands
32 {
33         DirectCommands(DirectCommands &);
34         DirectCommands& operator=(DirectCommands &);
35     public:
36         DirectCommands(CompilerGCC* compilerPlugin,
37                        Compiler*    compiler,
38                        cbProject*   project,
39                        int          logPageIndex = 0);
40         ~DirectCommands();
41 
42         wxArrayString GetPreBuildCommands(ProjectBuildTarget* target) const;
43         wxArrayString GetPostBuildCommands(ProjectBuildTarget* target) const;
44         wxArrayString CompileFile(ProjectBuildTarget* target, ProjectFile* pf, bool force = false) const;
45         wxArrayString GetCompileFileCommand(ProjectBuildTarget* target, ProjectFile* pf) const;
46         wxArrayString GetCompileSingleFileCommand(const wxString& filename) const;
47         wxArrayString GetCompileCommands(ProjectBuildTarget* target, bool force = false) const;
48         wxArrayString GetTargetCompileCommands(ProjectBuildTarget* target, bool force = false) const;
49         wxArrayString GetLinkCommands(ProjectBuildTarget* target, bool force = false) const;
50         wxArrayString GetTargetLinkCommands(ProjectBuildTarget* target, bool force = false) const;
51         wxArrayString GetCleanCommands(ProjectBuildTarget* target, bool distclean = false) const;
52         wxArrayString GetCleanSingleFileCommand(const wxString& filename) const;
53         wxArrayString GetTargetCleanCommands(ProjectBuildTarget* target, bool distclean = false) const;
54 
55         bool m_doYield;
56     protected:
57         bool         AreExternalDepsOutdated(ProjectBuildTarget* target, const wxString& buildOutput, wxArrayString* filesMissing) const;
58         bool         IsObjectOutdated(ProjectBuildTarget* target, const pfDetails& pfd, wxString* errorStr = 0) const;
59         void         DepsSearchStart(ProjectBuildTarget* target) const;
60         MyFilesArray GetProjectFilesSortedByWeight(ProjectBuildTarget* target, bool compile, bool link) const;
61         void         AddCommandsToArray(const wxString& cmds, wxArrayString& array, bool isWaitCmd = false, bool isLinkCmd = false) const;
62 
63         int                       m_PageIndex;
64         CompilerGCC*              m_pCompilerPlugin;
65         Compiler*                 m_pCompiler;
66         cbProject*                m_pProject;
67         CompilerCommandGenerator* m_pGenerator;
68     private:
69 };
70 
71 #endif // DIRECTCOMMANDS_H
72