| 1993 | } |
| 1994 | |
| 1995 | void cmVisualStudio10TargetGenerator::WriteGroups() |
| 1996 | { |
| 1997 | if (this->ProjectType == VsProjectType::csproj) { |
| 1998 | return; |
| 1999 | } |
| 2000 | |
| 2001 | std::vector<cmGeneratorTarget::AllConfigSource> const& sources = |
| 2002 | this->GeneratorTarget->GetAllConfigSources(); |
| 2003 | |
| 2004 | std::set<cmSourceGroup const*> groupsUsed; |
| 2005 | for (cmGeneratorTarget::AllConfigSource const& si : sources) { |
| 2006 | std::string const& source = si.Source->GetFullPath(); |
| 2007 | cmSourceGroup const* sourceGroup = |
| 2008 | this->LocalGenerator->FindSourceGroup(source); |
| 2009 | groupsUsed.insert(sourceGroup); |
| 2010 | } |
| 2011 | |
| 2012 | if (cmSourceFile const* srcCMakeLists = |
| 2013 | this->LocalGenerator->CreateVCProjBuildRule()) { |
| 2014 | std::string const& source = srcCMakeLists->GetFullPath(); |
| 2015 | cmSourceGroup const* sourceGroup = |
| 2016 | this->LocalGenerator->FindSourceGroup(source); |
| 2017 | groupsUsed.insert(sourceGroup); |
| 2018 | } |
| 2019 | |
| 2020 | this->AddMissingSourceGroups(groupsUsed, this->Makefile->GetSourceGroups()); |
| 2021 | |
| 2022 | // Write out group file |
| 2023 | std::string path = cmStrCat( |
| 2024 | this->LocalGenerator->GetCurrentBinaryDirectory(), '/', this->Name, |
| 2025 | computeProjectFileExtension(this->GeneratorTarget), ".filters"); |
| 2026 | cmGeneratedFileStream fout(path); |
| 2027 | fout.SetCopyIfDifferent(true); |
| 2028 | char magic[] = { char(0xEF), char(0xBB), char(0xBF) }; |
| 2029 | fout.write(magic, 3); |
| 2030 | |
| 2031 | fout << R"(<?xml version="1.0" encoding=")" |
| 2032 | << this->GlobalGenerator->Encoding() << "\"?>"; |
| 2033 | { |
| 2034 | Elem e0(fout, "Project"); |
| 2035 | e0.Attribute("ToolsVersion", this->GlobalGenerator->GetToolsVersion()); |
| 2036 | e0.Attribute("xmlns", |
| 2037 | "http://schemas.microsoft.com/developer/msbuild/2003"); |
| 2038 | |
| 2039 | for (auto const& ti : this->Tools) { |
| 2040 | this->WriteGroupSources(e0, ti.first, ti.second); |
| 2041 | } |
| 2042 | |
| 2043 | // Added files are images and the manifest. |
| 2044 | if (!this->AddedFiles.empty()) { |
| 2045 | Elem e1(e0, "ItemGroup"); |
| 2046 | e1.SetHasElements(); |
| 2047 | for (std::string const& oi : this->AddedFiles) { |
| 2048 | std::string fileName = |
| 2049 | cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(oi)); |
| 2050 | if (fileName == "wmappmanifest.xml"_s) { |
| 2051 | Elem e2(e1, "XML"); |
| 2052 | e2.Attribute("Include", oi); |
no test coverage detected