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