MCPcopy Create free account
hub / github.com/Kitware/CMake / WriteSolution

Method WriteSolution

Source/cmGlobalFastbuildGenerator.cxx:1620–1701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1618 }
1619}
1620void cmGlobalFastbuildGenerator::WriteSolution()
1621{
1622 std::string const solutionName = LocalGenerators[0]->GetProjectName();
1623 std::unordered_map<std::string /*folder*/, std::vector<std::string>>
1624 VSProjectFolders;
1625 std::unordered_map<std::string /*project*/,
1626 std::vector<std::string> /*deps*/>
1627 VSProjectDeps;
1628 std::vector<std::string> VSProjectsWithoutFolder;
1629
1630 for (auto const& IDEProj : IDEProjects) {
1631 auto const VSProj = IDEProj.second.first;
1632 VSProjectFolders[VSProj.folder].emplace_back(VSProj.Alias);
1633 auto& deps = VSProjectDeps[VSProj.Alias];
1634 deps.reserve(VSProj.deps.size());
1635 for (auto const& dep : VSProj.deps) {
1636 if (dep.Type == FastbuildTargetDepType::REGULAR) {
1637 deps.push_back(cmStrCat(dep.Name, FASTBUILD_VS_PROJECT_SUFFIX));
1638 }
1639 }
1640 }
1641
1642 WriteCommand("VSSolution", Quote("solution"));
1643 *this->BuildFileStream << "{\n";
1644
1645 WriteVariable("SolutionOutput",
1646 Quote(cmJoin({ "VisualStudio", solutionName + ".sln" }, "/")),
1647 1);
1648
1649 auto const& configs = IDEProjects.begin()->second.first.ProjectConfigs;
1650 WriteIDEProjectConfig(configs, "SolutionConfigs");
1651 int folderNumber = 0;
1652 std::vector<std::string> folders;
1653 for (auto& item : VSProjectFolders) {
1654 auto const& pathToFolder = item.first;
1655 auto& projectsInFolder = item.second;
1656 if (pathToFolder.empty()) {
1657 std::move(projectsInFolder.begin(), projectsInFolder.end(),
1658 std::back_inserter(VSProjectsWithoutFolder));
1659 } else {
1660 std::string folderName = cmStrCat("Folder_", ++folderNumber);
1661 WriteStruct(
1662 folderName,
1663 { { "Path", Quote(pathToFolder) },
1664 { "Projects",
1665 cmStrCat('{', cmJoin(Wrap(projectsInFolder), ","), '}') } },
1666 1);
1667 folders.emplace_back(std::move(folderName));
1668 }
1669 }
1670 if (!folders.empty()) {
1671 WriteArray("SolutionFolders ", Wrap(folders, ".", ""), 1);
1672 }
1673
1674 int depNumber = 0;
1675 std::vector<std::string> dependencies;
1676 for (auto const& dep : VSProjectDeps) {
1677 std::string const& projectName = dep.first;

Callers 1

WriteIDEProjectsMethod · 0.95

Calls 11

moveFunction · 0.85
emplace_backMethod · 0.80
reserveMethod · 0.80
push_backMethod · 0.80
cmStrCatFunction · 0.70
cmJoinFunction · 0.70
GetProjectNameMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
emptyMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected