mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Merge topic 'vs-cleanup'
78d9564d50cmGlobalVisualStudio7Generator: Inline short method at only call site034cc29b89cmGlobalVisualStudio7Generator: Constify .sln write methods5004602715cmGlobalVisualStudio7Generator: Factor folder collection out of write method6ae4ed30d9cmGlobalVisualStudio7Generator: Factor target collection out of write method5582eb292ecmGlobalVisualStudio7Generator: Update outdated comment2297ba9399cmGlobalVisualStudio7Generator: Remove redundant C++ modules checkccbd61dd53cmGlobalVisualStudio7Generator: Remove unused member93e34a5e0ecmGlobalGenerator: Constify GetTargetDirectDepends ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !11130
This commit is contained in:
@@ -3436,9 +3436,12 @@ cmValue cmGlobalGenerator::GetDebuggerWorkingDirectory(
|
||||
}
|
||||
|
||||
cmGlobalGenerator::TargetDependSet const&
|
||||
cmGlobalGenerator::GetTargetDirectDepends(cmGeneratorTarget const* target)
|
||||
cmGlobalGenerator::GetTargetDirectDepends(
|
||||
cmGeneratorTarget const* target) const
|
||||
{
|
||||
return this->TargetDependencies[target];
|
||||
auto i = this->TargetDependencies.find(target);
|
||||
assert(i != this->TargetDependencies.end());
|
||||
return i->second;
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::TargetOrderIndexLess(cmGeneratorTarget const* l,
|
||||
|
||||
@@ -526,7 +526,7 @@ public:
|
||||
// what targets does the specified target depend on directly
|
||||
// via a target_link_libraries or add_dependencies
|
||||
TargetDependSet const& GetTargetDirectDepends(
|
||||
cmGeneratorTarget const* target);
|
||||
cmGeneratorTarget const* target) const;
|
||||
|
||||
// Return true if target 'l' occurs before 'r' in a global ordering
|
||||
// of targets that respects inter-target dependencies.
|
||||
|
||||
@@ -522,7 +522,8 @@ std::string cmGlobalVisualStudio14Generator::GetWindows10SDKVersion(
|
||||
return std::string();
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio14Generator::AddSolutionItems(cmLocalGenerator* root)
|
||||
void cmGlobalVisualStudio14Generator::AddSolutionItems(cmLocalGenerator* root,
|
||||
VSFolders& vsFolders)
|
||||
{
|
||||
cmValue n = root->GetMakefile()->GetProperty("VS_SOLUTION_ITEMS");
|
||||
if (cmNonempty(n)) {
|
||||
@@ -552,11 +553,11 @@ void cmGlobalVisualStudio14Generator::AddSolutionItems(cmLocalGenerator* root)
|
||||
std::string folderPath = sg->GetFullName();
|
||||
// Source groups use '\' while solution folders use '/'.
|
||||
cmSystemTools::ReplaceString(folderPath, "\\", "/");
|
||||
folder = this->CreateSolutionFolders(folderPath);
|
||||
folder = vsFolders.Create(folderPath);
|
||||
} else {
|
||||
// Lazily initialize the default solution items folder.
|
||||
if (defaultFolder == nullptr) {
|
||||
defaultFolder = this->CreateSolutionFolders("Solution Items");
|
||||
defaultFolder = vsFolders.Create("Solution Items");
|
||||
}
|
||||
folder = defaultFolder;
|
||||
}
|
||||
@@ -567,7 +568,7 @@ void cmGlobalVisualStudio14Generator::AddSolutionItems(cmLocalGenerator* root)
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio14Generator::WriteFolderSolutionItems(
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder)
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) const
|
||||
{
|
||||
fout << "\tProjectSection(SolutionItems) = preProject\n";
|
||||
|
||||
|
||||
@@ -66,10 +66,10 @@ protected:
|
||||
|
||||
std::string GetWindows10SDKVersion(cmMakefile* mf);
|
||||
|
||||
void AddSolutionItems(cmLocalGenerator* root) override;
|
||||
void AddSolutionItems(cmLocalGenerator* root, VSFolders& vsFolders) override;
|
||||
|
||||
void WriteFolderSolutionItems(std::ostream& fout,
|
||||
cmVisualStudioFolder const& folder) override;
|
||||
void WriteFolderSolutionItems(
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) const override;
|
||||
|
||||
private:
|
||||
class Factory;
|
||||
|
||||
@@ -25,7 +25,8 @@ cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator(cmake* cm)
|
||||
|
||||
void cmGlobalVisualStudio71Generator::WriteSLNFile(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators)
|
||||
OrderedTargetDependSet const& orderedProjectTargets,
|
||||
VSFolders const& vsFolders) const
|
||||
{
|
||||
std::vector<std::string> configs =
|
||||
root->GetMakefile()->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
@@ -33,29 +34,13 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(
|
||||
// Write out the header for a SLN file
|
||||
this->WriteSLNHeader(fout);
|
||||
|
||||
// Collect all targets under this root generator and the transitive
|
||||
// closure of their dependencies.
|
||||
TargetDependSet projectTargets;
|
||||
TargetDependSet originalTargets;
|
||||
this->GetTargetSets(projectTargets, originalTargets, root, generators);
|
||||
OrderedTargetDependSet orderedProjectTargets(
|
||||
projectTargets, this->GetStartupProjectName(root));
|
||||
|
||||
// Generate the targets specification to a string. We will put this in
|
||||
// the actual .sln file later. As a side effect, this method also
|
||||
// populates the set of folders.
|
||||
std::ostringstream targetsSlnString;
|
||||
this->WriteTargetsToSolution(targetsSlnString, root, orderedProjectTargets);
|
||||
|
||||
this->AddSolutionItems(root);
|
||||
|
||||
// Generate folder specification.
|
||||
if (!this->VisualStudioFolders.empty()) {
|
||||
this->WriteFolders(fout);
|
||||
if (!vsFolders.Folders.empty()) {
|
||||
this->WriteFolders(fout, vsFolders);
|
||||
}
|
||||
|
||||
// Now write the actual target specification content.
|
||||
fout << targetsSlnString.str();
|
||||
this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
|
||||
|
||||
// Write out the configurations information for the solution
|
||||
fout << "Global\n";
|
||||
@@ -67,10 +52,10 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(
|
||||
this->WriteTargetConfigurations(fout, configs, orderedProjectTargets);
|
||||
fout << "\tEndGlobalSection\n";
|
||||
|
||||
if (!this->VisualStudioFolders.empty()) {
|
||||
if (!vsFolders.Folders.empty()) {
|
||||
// Write out project folders
|
||||
fout << "\tGlobalSection(NestedProjects) = preSolution\n";
|
||||
this->WriteFoldersContent(fout);
|
||||
this->WriteFoldersContent(fout, vsFolders);
|
||||
fout << "\tEndGlobalSection\n";
|
||||
}
|
||||
|
||||
@@ -82,7 +67,7 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs)
|
||||
std::ostream& fout, std::vector<std::string> const& configs) const
|
||||
{
|
||||
fout << "\tGlobalSection(SolutionConfiguration) = preSolution\n";
|
||||
for (std::string const& i : configs) {
|
||||
@@ -94,10 +79,9 @@ void cmGlobalVisualStudio71Generator::WriteSolutionConfigurations(
|
||||
// Write a dsp file into the SLN file,
|
||||
// Note, that dependencies from executables to
|
||||
// the libraries it uses are also done here
|
||||
void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
||||
std::string const& dspname,
|
||||
std::string const& dir,
|
||||
cmGeneratorTarget const* t)
|
||||
void cmGlobalVisualStudio71Generator::WriteProject(
|
||||
std::ostream& fout, std::string const& dspname, std::string const& dir,
|
||||
cmGeneratorTarget const* t) const
|
||||
{
|
||||
// check to see if this is a fortran build
|
||||
std::string ext = ".vcproj";
|
||||
@@ -148,9 +132,11 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
||||
// the libraries it uses are also done here
|
||||
void cmGlobalVisualStudio71Generator::WriteProjectDepends(
|
||||
std::ostream& fout, std::string const&, std::string const&,
|
||||
cmGeneratorTarget const* target)
|
||||
cmGeneratorTarget const* target) const
|
||||
{
|
||||
VSDependSet const& depends = this->VSTargetDepends[target];
|
||||
auto i = this->VSTargetDepends.find(target);
|
||||
assert(i != this->VSTargetDepends.end());
|
||||
VSDependSet const& depends = i->second;
|
||||
for (std::string const& name : depends) {
|
||||
std::string guid = this->GetGUID(name);
|
||||
if (guid.empty()) {
|
||||
@@ -166,7 +152,8 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(
|
||||
// executables to the libraries it uses are also done here
|
||||
void cmGlobalVisualStudio71Generator::WriteExternalProject(
|
||||
std::ostream& fout, std::string const& name, std::string const& location,
|
||||
cmValue typeGuid, std::set<BT<std::pair<std::string, bool>>> const& depends)
|
||||
cmValue typeGuid,
|
||||
std::set<BT<std::pair<std::string, bool>>> const& depends) const
|
||||
{
|
||||
fout << "Project(\"{"
|
||||
<< (typeGuid ? *typeGuid
|
||||
@@ -200,7 +187,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name, cmGeneratorTarget const& target,
|
||||
std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping)
|
||||
std::string const& platformMapping) const
|
||||
{
|
||||
std::string const& platformName =
|
||||
!platformMapping.empty() ? platformMapping : this->GetPlatformName();
|
||||
|
||||
@@ -29,24 +29,25 @@ public:
|
||||
|
||||
protected:
|
||||
void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators) override;
|
||||
OrderedTargetDependSet const& orderedProjectTargets,
|
||||
VSFolders const& vsFolders) const override;
|
||||
virtual void WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs);
|
||||
std::ostream& fout, std::vector<std::string> const& configs) const;
|
||||
void WriteProject(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) override;
|
||||
cmGeneratorTarget const* t) const override;
|
||||
void WriteProjectDepends(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) override;
|
||||
cmGeneratorTarget const* t) const override;
|
||||
void WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name,
|
||||
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping = "") override;
|
||||
std::string const& platformMapping = "") const override;
|
||||
void WriteExternalProject(
|
||||
std::ostream& fout, std::string const& name, std::string const& path,
|
||||
cmValue typeGuid,
|
||||
std::set<BT<std::pair<std::string, bool>>> const& depends) override;
|
||||
std::set<BT<std::pair<std::string, bool>>> const& depends) const override;
|
||||
|
||||
// Folders are not supported by VS 7.1.
|
||||
bool UseFolderProperty() const override { return false; }
|
||||
|
||||
@@ -299,8 +299,11 @@ void cmGlobalVisualStudio7Generator::Generate()
|
||||
// first do the superclass method
|
||||
this->cmGlobalVisualStudioGenerator::Generate();
|
||||
|
||||
// Now write out the DSW
|
||||
this->OutputSLNFile();
|
||||
// Now write out the VS Solution files.
|
||||
for (auto& it : this->ProjectMap) {
|
||||
this->OutputSLNFile(it.second[0], it.second);
|
||||
}
|
||||
|
||||
// If any solution or project files changed during the generation,
|
||||
// tell Visual Studio to reload them...
|
||||
if (!cmSystemTools::GetErrorOccurredFlag() &&
|
||||
@@ -336,30 +339,33 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile(
|
||||
if (generators.empty()) {
|
||||
return;
|
||||
}
|
||||
this->CurrentProject = root->GetProjectName();
|
||||
|
||||
// Collect all targets under this root generator and the transitive
|
||||
// closure of their dependencies.
|
||||
TargetDependSet projectTargets;
|
||||
TargetDependSet originalTargets;
|
||||
this->GetTargetSets(projectTargets, originalTargets, root, generators);
|
||||
OrderedTargetDependSet orderedProjectTargets(
|
||||
projectTargets, this->GetStartupProjectName(root));
|
||||
|
||||
VSFolders vsFolders = this->CreateSolutionFolders(orderedProjectTargets);
|
||||
this->AddSolutionItems(root, vsFolders);
|
||||
|
||||
std::string fname = GetSLNFile(root);
|
||||
cmGeneratedFileStream fout(fname);
|
||||
fout.SetCopyIfDifferent(true);
|
||||
if (!fout) {
|
||||
return;
|
||||
}
|
||||
this->WriteSLNFile(fout, root, generators);
|
||||
this->WriteSLNFile(fout, root, orderedProjectTargets, vsFolders);
|
||||
if (fout.Close()) {
|
||||
this->FileReplacedDuringGenerate(fname);
|
||||
}
|
||||
}
|
||||
|
||||
// output the SLN file
|
||||
void cmGlobalVisualStudio7Generator::OutputSLNFile()
|
||||
{
|
||||
for (auto& it : this->ProjectMap) {
|
||||
this->OutputSLNFile(it.second[0], it.second);
|
||||
}
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets)
|
||||
OrderedTargetDependSet const& projectTargets) const
|
||||
{
|
||||
// loop over again and write out configurations for each target
|
||||
// in the solution
|
||||
@@ -394,7 +400,29 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
|
||||
}
|
||||
}
|
||||
|
||||
cmVisualStudioFolder* cmGlobalVisualStudio7Generator::CreateSolutionFolders(
|
||||
cmGlobalVisualStudio7Generator::VSFolders
|
||||
cmGlobalVisualStudio7Generator::CreateSolutionFolders(
|
||||
OrderedTargetDependSet const& orderedProjectTargets)
|
||||
{
|
||||
VSFolders vsFolders;
|
||||
if (!this->UseFolderProperty()) {
|
||||
return vsFolders;
|
||||
}
|
||||
for (cmGeneratorTarget const* target : orderedProjectTargets) {
|
||||
if (this->IsInSolution(target) &&
|
||||
(target->GetProperty("EXTERNAL_MSPROJECT") ||
|
||||
target->GetProperty("GENERATOR_FILE_NAME"))) {
|
||||
// Create "solution folder" information from FOLDER target property
|
||||
if (cmVisualStudioFolder* folder =
|
||||
vsFolders.Create(target->GetEffectiveFolderName())) {
|
||||
folder->Projects.insert(target->GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return vsFolders;
|
||||
}
|
||||
|
||||
cmVisualStudioFolder* cmGlobalVisualStudio7Generator::VSFolders::Create(
|
||||
std::string const& path)
|
||||
{
|
||||
if (path.empty()) {
|
||||
@@ -414,7 +442,7 @@ cmVisualStudioFolder* cmGlobalVisualStudio7Generator::CreateSolutionFolders(
|
||||
if (cumulativePath.empty()) {
|
||||
cumulativePath = cmStrCat("CMAKE_FOLDER_GUID_", iter);
|
||||
} else {
|
||||
this->VisualStudioFolders[cumulativePath].Projects.insert(
|
||||
this->Folders[cumulativePath].Projects.insert(
|
||||
cmStrCat(cumulativePath, '/', iter));
|
||||
|
||||
cumulativePath = cmStrCat(cumulativePath, '/', iter);
|
||||
@@ -425,15 +453,13 @@ cmVisualStudioFolder* cmGlobalVisualStudio7Generator::CreateSolutionFolders(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &this->VisualStudioFolders[cumulativePath];
|
||||
return &this->Folders[cumulativePath];
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& projectTargets)
|
||||
OrderedTargetDependSet const& projectTargets) const
|
||||
{
|
||||
VisualStudioFolders.clear();
|
||||
|
||||
std::vector<std::string> configs =
|
||||
root->GetMakefile()->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
|
||||
@@ -441,12 +467,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
||||
if (!this->IsInSolution(target)) {
|
||||
continue;
|
||||
}
|
||||
bool written = false;
|
||||
|
||||
for (auto const& c : configs) {
|
||||
target->CheckCxxModuleStatus(c);
|
||||
}
|
||||
|
||||
// handle external vc project files
|
||||
cmValue expath = target->GetProperty("EXTERNAL_MSPROJECT");
|
||||
if (expath) {
|
||||
@@ -456,7 +476,6 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
||||
this->WriteExternalProject(fout, project, location,
|
||||
target->GetProperty("VS_PROJECT_TYPE"),
|
||||
target->GetUtilities());
|
||||
written = true;
|
||||
} else {
|
||||
cmValue vcprojName = target->GetProperty("GENERATOR_FILE_NAME");
|
||||
if (vcprojName) {
|
||||
@@ -467,28 +486,17 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
||||
dir.clear(); // msbuild cannot handle ".\" prefix
|
||||
}
|
||||
this->WriteProject(fout, *vcprojName, dir, target);
|
||||
written = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Create "solution folder" information from FOLDER target property
|
||||
//
|
||||
if (written && this->UseFolderProperty()) {
|
||||
cmVisualStudioFolder* folder =
|
||||
this->CreateSolutionFolders(target->GetEffectiveFolderName());
|
||||
|
||||
if (folder != nullptr) {
|
||||
folder->Projects.insert(target->GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
|
||||
void cmGlobalVisualStudio7Generator::WriteFolders(
|
||||
std::ostream& fout, VSFolders const& vsFolders) const
|
||||
{
|
||||
cm::string_view const prefix = "CMAKE_FOLDER_GUID_";
|
||||
std::string guidProjectTypeFolder = "2150E333-8FDC-42A3-9474-1A3956D46DE8";
|
||||
for (auto const& iter : VisualStudioFolders) {
|
||||
for (auto const& iter : vsFolders.Folders) {
|
||||
std::string fullName = iter.first;
|
||||
std::string guid = this->GetGUID(fullName);
|
||||
|
||||
@@ -510,9 +518,10 @@ void cmGlobalVisualStudio7Generator::WriteFolders(std::ostream& fout)
|
||||
}
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
|
||||
void cmGlobalVisualStudio7Generator::WriteFoldersContent(
|
||||
std::ostream& fout, VSFolders const& vsFolders) const
|
||||
{
|
||||
for (auto const& iter : VisualStudioFolders) {
|
||||
for (auto const& iter : vsFolders.Folders) {
|
||||
std::string key(iter.first);
|
||||
std::string guidParent(this->GetGUID(key));
|
||||
|
||||
@@ -526,7 +535,7 @@ void cmGlobalVisualStudio7Generator::WriteFoldersContent(std::ostream& fout)
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
|
||||
std::string const& path)
|
||||
std::string const& path) const
|
||||
{
|
||||
// Convert to backslashes. Do not use ConvertToOutputPath because
|
||||
// we will add quoting ourselves, and we know these projects always
|
||||
@@ -540,7 +549,7 @@ std::string cmGlobalVisualStudio7Generator::ConvertToSolutionPath(
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
|
||||
std::ostream& fout, cmLocalGenerator* root)
|
||||
std::ostream& fout, cmLocalGenerator* root) const
|
||||
{
|
||||
std::string const guid =
|
||||
this->GetGUID(cmStrCat(root->GetProjectName(), ".sln"));
|
||||
@@ -606,7 +615,7 @@ void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
|
||||
}
|
||||
|
||||
// Standard end of dsw file
|
||||
void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout)
|
||||
void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout) const
|
||||
{
|
||||
fout << "EndGlobal\n";
|
||||
}
|
||||
@@ -674,7 +683,8 @@ std::string cmGlobalVisualStudio7Generator::WriteUtilityDepend(
|
||||
return pname;
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudio7Generator::GetGUID(std::string const& name)
|
||||
std::string cmGlobalVisualStudio7Generator::GetGUID(
|
||||
std::string const& name) const
|
||||
{
|
||||
std::string const& guidStoreName = cmStrCat(name, "_GUID_CMAKE");
|
||||
if (cmValue storedGUID =
|
||||
@@ -708,7 +718,7 @@ void cmGlobalVisualStudio7Generator::AppendDirectoryForConfig(
|
||||
std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||
std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* target)
|
||||
cmGeneratorTarget const* target) const
|
||||
{
|
||||
std::set<std::string> activeConfigs;
|
||||
// if it is a utility target then only make it part of the
|
||||
@@ -751,7 +761,8 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
|
||||
}
|
||||
|
||||
bool cmGlobalVisualStudio7Generator::IsDependedOn(
|
||||
OrderedTargetDependSet const& projectTargets, cmGeneratorTarget const* gtIn)
|
||||
OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* gtIn) const
|
||||
{
|
||||
return std::any_of(projectTargets.begin(), projectTargets.end(),
|
||||
[this, gtIn](cmTargetDepend const& l) {
|
||||
|
||||
@@ -82,13 +82,8 @@ public:
|
||||
std::vector<std::string> const& makeOptions =
|
||||
std::vector<std::string>()) override;
|
||||
|
||||
/**
|
||||
* Generate the DSW workspace file.
|
||||
*/
|
||||
virtual void OutputSLNFile();
|
||||
|
||||
//! Lookup a stored GUID or compute one deterministically.
|
||||
std::string GetGUID(std::string const& name);
|
||||
std::string GetGUID(std::string const& name) const;
|
||||
|
||||
/** Append the subdirectory for the given configuration. */
|
||||
void AppendDirectoryForConfig(std::string const& prefix,
|
||||
@@ -134,6 +129,12 @@ protected:
|
||||
|
||||
void Generate() override;
|
||||
|
||||
struct VSFolders
|
||||
{
|
||||
std::map<std::string, cmVisualStudioFolder> Folders;
|
||||
cmVisualStudioFolder* Create(std::string const& path);
|
||||
};
|
||||
|
||||
std::string const& GetDevEnvCommand();
|
||||
virtual std::string FindDevEnvCommand();
|
||||
|
||||
@@ -141,60 +142,61 @@ protected:
|
||||
|
||||
virtual void OutputSLNFile(cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators);
|
||||
virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root,
|
||||
std::vector<cmLocalGenerator*>& generators) = 0;
|
||||
virtual void WriteSLNFile(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& orderedProjectTargets,
|
||||
VSFolders const& vsFolders) const = 0;
|
||||
virtual void WriteProject(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) = 0;
|
||||
cmGeneratorTarget const* t) const = 0;
|
||||
virtual void WriteProjectDepends(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) = 0;
|
||||
cmGeneratorTarget const* t) const = 0;
|
||||
virtual void WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name,
|
||||
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping = "") = 0;
|
||||
std::string const& platformMapping = "") const = 0;
|
||||
virtual void WriteSLNGlobalSections(std::ostream& fout,
|
||||
cmLocalGenerator* root);
|
||||
virtual void WriteSLNFooter(std::ostream& fout);
|
||||
cmLocalGenerator* root) const;
|
||||
virtual void WriteSLNFooter(std::ostream& fout) const;
|
||||
std::string WriteUtilityDepend(cmGeneratorTarget const* target) override;
|
||||
|
||||
cmVisualStudioFolder* CreateSolutionFolders(std::string const& path);
|
||||
VSFolders CreateSolutionFolders(
|
||||
OrderedTargetDependSet const& orderedProjectTargets);
|
||||
|
||||
virtual void WriteTargetsToSolution(
|
||||
std::ostream& fout, cmLocalGenerator* root,
|
||||
OrderedTargetDependSet const& projectTargets);
|
||||
OrderedTargetDependSet const& projectTargets) const;
|
||||
virtual void WriteTargetConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets);
|
||||
OrderedTargetDependSet const& projectTargets) const;
|
||||
|
||||
virtual void WriteExternalProject(
|
||||
std::ostream& fout, std::string const& name, std::string const& path,
|
||||
cmValue typeGuid,
|
||||
std::set<BT<std::pair<std::string, bool>>> const& dependencies) = 0;
|
||||
std::set<BT<std::pair<std::string, bool>>> const& dependencies) const = 0;
|
||||
|
||||
std::string ConvertToSolutionPath(std::string const& path);
|
||||
std::string ConvertToSolutionPath(std::string const& path) const;
|
||||
|
||||
std::set<std::string> IsPartOfDefaultBuild(
|
||||
std::vector<std::string> const& configs,
|
||||
OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* target);
|
||||
cmGeneratorTarget const* target) const;
|
||||
bool IsDependedOn(OrderedTargetDependSet const& projectTargets,
|
||||
cmGeneratorTarget const* target);
|
||||
cmGeneratorTarget const* target) const;
|
||||
std::map<std::string, std::string> GUIDMap;
|
||||
|
||||
virtual void WriteFolders(std::ostream& fout);
|
||||
virtual void WriteFoldersContent(std::ostream& fout);
|
||||
virtual void WriteFolders(std::ostream& fout,
|
||||
VSFolders const& vsFolders) const;
|
||||
virtual void WriteFoldersContent(std::ostream& fout,
|
||||
VSFolders const& vsFolders) const;
|
||||
|
||||
virtual void AddSolutionItems(cmLocalGenerator* root) = 0;
|
||||
virtual void AddSolutionItems(cmLocalGenerator* root,
|
||||
VSFolders& vsFolders) = 0;
|
||||
virtual void WriteFolderSolutionItems(
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) = 0;
|
||||
std::ostream& fout, cmVisualStudioFolder const& folder) const = 0;
|
||||
|
||||
std::map<std::string, cmVisualStudioFolder> VisualStudioFolders;
|
||||
|
||||
// Set during OutputSLNFile with the name of the current project.
|
||||
// There is one SLN file per project.
|
||||
std::string CurrentProject;
|
||||
bool MarmasmEnabled;
|
||||
bool MasmEnabled;
|
||||
bool NasmEnabled;
|
||||
|
||||
@@ -363,7 +363,7 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudio8Generator::WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs)
|
||||
std::ostream& fout, std::vector<std::string> const& configs) const
|
||||
{
|
||||
fout << "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n";
|
||||
for (std::string const& i : configs) {
|
||||
@@ -377,7 +377,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name, cmGeneratorTarget const& target,
|
||||
std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping)
|
||||
std::string const& platformMapping) const
|
||||
{
|
||||
std::string guid = this->GetGUID(name);
|
||||
for (std::string const& i : configs) {
|
||||
@@ -460,7 +460,7 @@ bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
|
||||
|
||||
void cmGlobalVisualStudio8Generator::WriteProjectDepends(
|
||||
std::ostream& fout, std::string const&, std::string const&,
|
||||
cmGeneratorTarget const* gt)
|
||||
cmGeneratorTarget const* gt) const
|
||||
{
|
||||
TargetDependSet const& unordered = this->GetTargetDirectDepends(gt);
|
||||
OrderedTargetDependSet depends(unordered, std::string());
|
||||
|
||||
@@ -73,16 +73,17 @@ protected:
|
||||
|
||||
static cmIDEFlagTable const* GetExtraFlagTableVS8();
|
||||
void WriteSolutionConfigurations(
|
||||
std::ostream& fout, std::vector<std::string> const& configs) override;
|
||||
std::ostream& fout,
|
||||
std::vector<std::string> const& configs) const override;
|
||||
void WriteProjectConfigurations(
|
||||
std::ostream& fout, std::string const& name,
|
||||
cmGeneratorTarget const& target, std::vector<std::string> const& configs,
|
||||
std::set<std::string> const& configsPartOfDefaultBuild,
|
||||
std::string const& platformMapping = "") override;
|
||||
std::string const& platformMapping = "") const override;
|
||||
bool ComputeTargetDepends() override;
|
||||
void WriteProjectDepends(std::ostream& fout, std::string const& name,
|
||||
std::string const& path,
|
||||
cmGeneratorTarget const* t) override;
|
||||
cmGeneratorTarget const* t) const override;
|
||||
|
||||
bool UseFolderProperty() const override;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ char const* cmGlobalVisualStudioGenerator::GetIDEVersion() const
|
||||
return "";
|
||||
}
|
||||
|
||||
void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout)
|
||||
void cmGlobalVisualStudioGenerator::WriteSLNHeader(std::ostream& fout) const
|
||||
{
|
||||
char utf8bom[] = { char(0xEF), char(0xBB), char(0xBF) };
|
||||
fout.write(utf8bom, 3);
|
||||
@@ -780,7 +780,7 @@ void RegisterVisualStudioMacros(std::string const& macrosFile,
|
||||
}
|
||||
}
|
||||
bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
|
||||
cmGeneratorTarget const* gt)
|
||||
cmGeneratorTarget const* gt) const
|
||||
{
|
||||
// If there's only one source language, Fortran has to be used
|
||||
// in order for the sources to compile.
|
||||
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
void CallVisualStudioMacro(MacroName m, std::string const& vsSolutionFile);
|
||||
|
||||
// return true if target is fortran only
|
||||
bool TargetIsFortranOnly(cmGeneratorTarget const* gt);
|
||||
bool TargetIsFortranOnly(cmGeneratorTarget const* gt) const;
|
||||
|
||||
// return true if target should be included in solution.
|
||||
virtual bool IsInSolution(cmGeneratorTarget const* gt) const;
|
||||
@@ -172,7 +172,7 @@ protected:
|
||||
|
||||
char const* GetIDEVersion() const;
|
||||
|
||||
void WriteSLNHeader(std::ostream& fout);
|
||||
void WriteSLNHeader(std::ostream& fout) const;
|
||||
|
||||
bool ComputeTargetDepends() override;
|
||||
class VSDependSet : public std::set<std::string>
|
||||
|
||||
@@ -18,6 +18,7 @@ run_cmake(ExplicitCMakeLists)
|
||||
run_cmake(InterfaceLibSources)
|
||||
run_cmake(NoImpLib)
|
||||
run_cmake(RuntimeLibrary)
|
||||
run_cmake(SolutionItems)
|
||||
run_cmake(SourceGroupCMakeLists)
|
||||
run_cmake(SourceGroupTreeCMakeLists)
|
||||
run_cmake(SourceGroupFileSet)
|
||||
|
||||
Reference in New Issue
Block a user