Merge from amd64 branch:
[reactos.git] / reactos / tools / rbuild / backend / codeblocks / codeblocks.h
1 /*
2 * Copyright (C) 2005 Trevor McCort
3 * Copyright (C) 2005 Casper S. Hornstrup
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 2 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, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 #ifndef __CODEBLOCKS_H__
20 #define __CODEBLOCKS_H__
21
22 #include <fstream>
23 #include <vector>
24 #include <string>
25
26 #include "../backend.h"
27
28 class FileUnit
29 {
30 public:
31 std::string filename;
32 std::string folder;
33 };
34
35 enum OptimizationType
36 {
37 Debug,
38 Release
39 };
40
41 class CBConfiguration
42 {
43 public:
44 CBConfiguration(const OptimizationType optimization,
45 const std::string &name = "");
46 virtual ~CBConfiguration() {}
47 std::string name;
48 OptimizationType optimization;
49 };
50
51 class CBBackend : public Backend
52 {
53 public:
54
55 CBBackend(Project &project,
56 Configuration& configuration);
57 virtual ~CBBackend() {}
58
59 virtual void Process();
60
61 private:
62
63 void ProcessModules();
64 void ProcessFile(std::string &filename);
65
66 bool CheckFolderAdded(std::string &folder);
67 void AddFolders(std::string &folder);
68
69 void OutputFolders();
70 void OutputFileUnits();
71
72 std::string CbpFileName ( const Module& module ) const;
73 std::string LayoutFileName ( const Module& module ) const;
74 std::string DependFileName ( const Module& module ) const;
75 std::string GenerateProjectLinkerFlags () const;
76 void MingwAddImplicitLibraries( Module &module );
77 bool IsSpecDefinitionFile ( const Module& module ) const;
78 std::vector<CBConfiguration*> m_configurations;
79
80 std::vector<FileUnit> m_fileUnits;
81 std::vector<std::string> m_folders;
82
83 int m_unitCount;
84
85 FILE* m_wrkspaceFile;
86
87 std::string _replace_str(
88 std::string string1,
89 const std::string &find_str,
90 const std::string &replace_str);
91
92 void _generate_workspace ( FILE* OUT );
93 void _generate_cbproj ( const Module& module );
94
95 void _clean_project_files ( void );
96 void _get_object_files ( const Module& module, std::vector<std::string>& out ) const;
97 void _install_files ( const std::string& vcdir, const std::string& config );
98 bool _copy_file ( const std::string& inputname, const std::string& targetname ) const;
99 const Property* _lookup_property ( const Module& module, const std::string& name ) const;
100 };
101
102
103 #endif // __MSVC_H__
104