459fcee930997acee08f7cc3c9e779b8b3326ffe
[reactos.git] / reactos / tools / rbuild / backend / msvc / msvc.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 __MSVC_H__
20 #define __MSVC_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 class MSVCBackend : public Backend
36 {
37 public:
38
39 MSVCBackend(Project &project,
40 Configuration& configuration);
41 virtual ~MSVCBackend() {}
42
43 virtual void Process();
44
45 private:
46
47 void ProcessModules();
48 void ProcessFile(std::string &filename);
49
50 bool CheckFolderAdded(std::string &folder);
51 void AddFolders(std::string &folder);
52
53 void OutputFolders();
54 void OutputFileUnits();
55
56 std::string DspFileName ( const Module& module ) const;
57 std::string VcprojFileName ( const Module& module ) const;
58 std::string DswFileName ( const Module& module ) const;
59 std::string SlnFileName ( const Module& module ) const;
60 std::string OptFileName ( const Module& module ) const;
61 std::string SuoFileName ( const Module& module ) const;
62 std::string NcbFileName ( const Module& module ) const;
63
64
65
66 std::vector<FileUnit> m_fileUnits;
67 std::vector<std::string> m_folders;
68
69 int m_unitCount;
70
71 FILE* m_dswFile;
72 FILE* m_slnFile;
73 FILE* m_rulesFile;
74
75 // functions in msvcmaker.cpp:
76
77 void _generate_dsp ( const Module& module );
78 void _generate_dsw_header ( FILE* OUT );
79 void _generate_dsw_project (
80 FILE* OUT,
81 const Module& module,
82 std::string dsp_file,
83 const std::vector<Dependency*>& dependencies );
84
85 void _generate_dsw_footer ( FILE* OUT );
86 void _generate_wine_dsw ( FILE* OUT );
87
88 // functions in vcprojmaker.cpp:
89
90 std::string _get_solution_verion ( void );
91 std::string _gen_guid();
92 std::string _replace_str(
93 std::string string1,
94 const std::string &find_str,
95 const std::string &replace_str);
96
97 std::string _get_vc_dir ( void ) const;
98
99 void _generate_vcproj ( const Module& module );
100
101 void _generate_sln_header ( FILE* OUT );
102 void _generate_sln_footer ( FILE* OUT );
103 void _generate_sln ( FILE* OUT );
104 //void _generate_rules_file ( FILE* OUT );
105 void _generate_sln_project (
106 FILE* OUT,
107 const Module& module,
108 std::string vcproj_file,
109 std::string sln_guid,
110 std::string vcproj_guid,
111 const std::vector<Dependency*>& dependencies );
112 void _generate_sln_configurations (
113 FILE* OUT,
114 std::string vcproj_guid );
115 void _clean_project_files ( void );
116 void _get_object_files ( const Module& module, std::vector<std::string>& out ) const;
117 };
118
119 #endif // __MSVC_H__
120