1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 2002 Insight Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef cmMSDotNETGenerator_h
#define cmMSDotNETGenerator_h
#include "cmStandardIncludes.h"
#include "cmMakefileGenerator.h"
#include "cmTarget.h"
#include "cmSourceGroup.h"
/** \class cmMSDotNETGenerator
* \brief Write a Microsoft Visual C++ DSP (project) file.
*
* cmMSDotNETGenerator produces a Microsoft Visual C++ DSP (project) file.
*/
class cmMSDotNETGenerator : public cmMakefileGenerator
{
public:
///! Constructor sets the generation of SLN files on.
cmMSDotNETGenerator();
///! Destructor.
~cmMSDotNETGenerator();
///! Get the name for the generator.
virtual const char* GetName() {return "Visual Studio 7";}
///! virtual copy constructor
virtual cmMakefileGenerator* CreateObject()
{ return new cmMSDotNETGenerator;}
///! Produce the makefile (in this case a Microsoft Visual C++ project).
virtual void GenerateMakefile();
///! controls the SLN/DSP settings
virtual void SetLocal(bool);
/**
* Turn off the generation of a Microsoft Visual C++ SLN file.
* This causes only the dsp file to be created. This
* is used to run as a command line program from inside visual
* studio.
*/
void BuildSLNOff() {m_BuildSLN = false;}
///! Turn on the generation of a Microsoft Visual C++ SLN file.
void BuildProjOn() {m_BuildSLN = true;}
/**
* Try to determine system infomation such as shared library
* extension, pthreads, byte order etc.
*/
virtual void ComputeSystemInfo();
protected:
/**
* Return array of created VCProj names in a STL vector.
* Each executable must have its own dsp.
*/
std::vector<std::string> GetCreatedProjectNames()
{
return m_CreatedProjectNames;
}
/**
* Return the makefile.
*/
cmMakefile* GetMakefile()
{
return m_Makefile;
}
private:
void CreateSingleVCProj(const char *lname, cmTarget &tgt);
void WriteVCProjFile(std::ostream& fout, const char *libName,
cmTarget &tgt);
void WriteVCProjBeginGroup(std::ostream& fout,
const char* group,
const char* filter);
void WriteVCProjEndGroup(std::ostream& fout);
void WriteProjectStart(std::ostream& fout, const char *libName,
const cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
void WriteConfigurations(std::ostream& fout,
const char *libName,
const cmTarget &tgt);
void WriteConfiguration(std::ostream& fout,
const char* configName,
const char* libName,
const cmTarget &tgt);
void OutputDefineFlags(std::ostream& fout);
void WriteVCProjFooter(std::ostream& fout);
void AddVCProjBuildRule(cmSourceGroup&);
void WriteCustomRule(std::ostream& fout,
const char* source,
const char* command,
const std::set<std::string>& depends,
const std::set<std::string>& outputs);
void OutputTargetRules(std::ostream& fout,
const cmTarget &target,
const char *libName);
std::string CombineCommands(const cmSourceGroup::Commands &commands,
cmSourceGroup::CommandFiles &totalCommand,
const char *source);
virtual void OutputSLNFile();
void OutputVCProjFile();
std::string CreateGUID(const char* project);
void WriteSLNFile(std::ostream& fout);
void WriteSLNHeader(std::ostream& fout);
void WriteProject(std::ostream& fout,
const char* name, const char* path,
cmMSDotNETGenerator* project, const cmTarget &t);
void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path,
cmMSDotNETGenerator* project, const cmTarget &t);
void WriteProjectConfigurations(std::ostream& fout, const char* name);
void WriteExternalProject(std::ostream& fout,
const char* name, const char* path,
const std::vector<std::string>& dependencies);
void WriteSLNFooter(std::ostream& fout);
void OutputBuildTool(std::ostream& fout, const char* configName,
const char* libname, const cmTarget& t);
void OutputLibraryDirectories(std::ostream& fout,
const char* configName,
const char* libName,
const cmTarget &target);
void OutputLibraries(std::ostream& fout,
const char* configName,
const char* libName,
const cmTarget &target);
std::string ConvertToXMLOutputPath(const char* path);
private:
std::map<cmStdString, cmStdString> m_GUIDMap;
bool m_BuildSLN;
std::string m_LibraryOutputPath;
std::string m_ExecutableOutputPath;
std::vector<std::string> m_Configurations;
std::string m_VCProjHeaderTemplate;
std::string m_VCProjFooterTemplate;
std::vector<std::string> m_CreatedProjectNames;
};
#endif
|