1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
13 #include <cm/optional>
15 #include <cm3p/json/value.h>
17 #include "cmGlobalVisualStudioGenerator.h"
20 class cmGeneratorTarget
;
21 struct cmIDEFlagTable
;
22 class cmLocalGenerator
;
28 /** \class cmGlobalVisualStudio7Generator
29 * \brief Write a Unix makefiles.
31 * cmGlobalVisualStudio7Generator manages UNIX build process for a tree
33 class cmGlobalVisualStudio7Generator
: public cmGlobalVisualStudioGenerator
36 ~cmGlobalVisualStudio7Generator() override
;
38 //! Create a local generator appropriate to this Global Generator
39 std::unique_ptr
<cmLocalGenerator
> CreateLocalGenerator(
40 cmMakefile
* mf
) override
;
42 #if !defined(CMAKE_BOOTSTRAP)
43 Json::Value
GetJson() const override
;
46 bool SetSystemName(std::string
const& s
, cmMakefile
* mf
) override
;
49 * Utilized by the generator factory to determine if this generator
52 static bool SupportsToolset() { return false; }
55 * Utilized by the generator factory to determine if this generator
58 static bool SupportsPlatform() { return false; }
61 * Try to determine system information such as shared library
62 * extension, pthreads, byte order etc.
64 void EnableLanguage(std::vector
<std::string
> const& languages
, cmMakefile
*,
65 bool optional
) override
;
68 * Try running cmake and building a file. This is used for dynamically
69 * loaded commands, not as part of the usual build process.
71 std::vector
<GeneratedMakeCommand
> GenerateBuildCommand(
72 const std::string
& makeProgram
, const std::string
& projectName
,
73 const std::string
& projectDir
, std::vector
<std::string
> const& targetNames
,
74 const std::string
& config
, int jobs
, bool verbose
,
75 const cmBuildOptions
& buildOptions
= cmBuildOptions(),
76 std::vector
<std::string
> const& makeOptions
=
77 std::vector
<std::string
>()) override
;
80 * Generate the DSW workspace file.
82 virtual void OutputSLNFile();
84 //! Lookup a stored GUID or compute one deterministically.
85 std::string
GetGUID(std::string
const& name
);
87 /** Append the subdirectory for the given configuration. */
88 void AppendDirectoryForConfig(const std::string
& prefix
,
89 const std::string
& config
,
90 const std::string
& suffix
,
91 std::string
& dir
) override
;
93 //! What is the configurations directory variable called?
94 const char* GetCMakeCFGIntDir() const override
96 return "$(ConfigurationName)";
99 /** Return true if the target project file should have the option
100 LinkLibraryDependencies and link to .sln dependencies. */
101 virtual bool NeedLinkLibraryDependencies(cmGeneratorTarget
*)
106 const std::string
& GetIntelProjectVersion();
107 virtual cm::optional
<std::string
> GetPlatformToolsetFortran() const
112 bool FindMakeProgram(cmMakefile
* mf
) override
;
114 /** Is the Microsoft Assembler enabled? */
115 bool IsMarmasmEnabled() const { return this->MarmasmEnabled
; }
116 bool IsMasmEnabled() const { return this->MasmEnabled
; }
117 bool IsNasmEnabled() const { return this->NasmEnabled
; }
119 // Encoding for Visual Studio files
120 virtual std::string
Encoding();
122 cmIDEFlagTable
const* ExtraFlagTable
;
124 virtual bool SupportsCxxModuleDyndep() const { return false; }
127 cmGlobalVisualStudio7Generator(cmake
* cm
,
128 std::string
const& platformInGeneratorName
);
130 void Generate() override
;
132 std::string
const& GetDevEnvCommand();
133 virtual std::string
FindDevEnvCommand();
135 static const char* ExternalProjectType(const std::string
& location
);
137 virtual void OutputSLNFile(cmLocalGenerator
* root
,
138 std::vector
<cmLocalGenerator
*>& generators
);
139 virtual void WriteSLNFile(std::ostream
& fout
, cmLocalGenerator
* root
,
140 std::vector
<cmLocalGenerator
*>& generators
) = 0;
141 virtual void WriteProject(std::ostream
& fout
, const std::string
& name
,
142 const std::string
& path
,
143 const cmGeneratorTarget
* t
) = 0;
144 virtual void WriteProjectDepends(std::ostream
& fout
, const std::string
& name
,
145 const std::string
& path
,
146 cmGeneratorTarget
const* t
) = 0;
147 virtual void WriteProjectConfigurations(
148 std::ostream
& fout
, const std::string
& name
,
149 cmGeneratorTarget
const& target
, std::vector
<std::string
> const& configs
,
150 const std::set
<std::string
>& configsPartOfDefaultBuild
,
151 const std::string
& platformMapping
= "") = 0;
152 virtual void WriteSLNGlobalSections(std::ostream
& fout
,
153 cmLocalGenerator
* root
);
154 virtual void WriteSLNFooter(std::ostream
& fout
);
155 std::string
WriteUtilityDepend(const cmGeneratorTarget
* target
) override
;
157 virtual void WriteTargetsToSolution(
158 std::ostream
& fout
, cmLocalGenerator
* root
,
159 OrderedTargetDependSet
const& projectTargets
);
160 virtual void WriteTargetConfigurations(
161 std::ostream
& fout
, std::vector
<std::string
> const& configs
,
162 OrderedTargetDependSet
const& projectTargets
);
164 virtual void WriteExternalProject(
165 std::ostream
& fout
, const std::string
& name
, const std::string
& path
,
167 const std::set
<BT
<std::pair
<std::string
, bool>>>& dependencies
) = 0;
169 std::string
ConvertToSolutionPath(const std::string
& path
);
171 std::set
<std::string
> IsPartOfDefaultBuild(
172 std::vector
<std::string
> const& configs
,
173 OrderedTargetDependSet
const& projectTargets
,
174 cmGeneratorTarget
const* target
);
175 bool IsDependedOn(OrderedTargetDependSet
const& projectTargets
,
176 cmGeneratorTarget
const* target
);
177 std::map
<std::string
, std::string
> GUIDMap
;
179 virtual void WriteFolders(std::ostream
& fout
);
180 virtual void WriteFoldersContent(std::ostream
& fout
);
181 std::map
<std::string
, std::set
<std::string
>> VisualStudioFolders
;
183 // Set during OutputSLNFile with the name of the current project.
184 // There is one SLN file per project.
185 std::string CurrentProject
;
191 std::string IntelProjectVersion
;
192 std::string DevEnvCommand
;
193 bool DevEnvCommandInitialized
;
194 std::string
GetVSMakeProgram() override
{ return this->GetDevEnvCommand(); }
197 #define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"