Skip to content

Commit

Permalink
[vs] Ignore other projects' public commands (e.g. natvis).
Browse files Browse the repository at this point in the history
  • Loading branch information
egorpugin committed Apr 4, 2024
1 parent bca684e commit 3224dde
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/sw/client/common/generator/vs/vs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ void VSGenerator::generate(const SwBuild &b)
if (n == "struct sw::driver::cpp::InlineSpecInput"s) {
auto &&spec = input.getSpecification();
auto &&f = spec.getFiles();
if (f.size() == 1) {
visible_lnk_name = f.begin()->stem().string();
if (f.size() == 1) {
visible_lnk_name = f.begin()->stem().string();
}
}
}
}
if (!visible_lnk_name.empty()) {
sln_root /= visible_lnk_name;
}
Expand Down Expand Up @@ -485,6 +485,7 @@ void VSGenerator::generate(const SwBuild &b)
}
}

auto curdirr = fs::current_path();
for (auto &[pkg, tgts] : ttb)
{
// add project with settings
Expand Down Expand Up @@ -535,6 +536,12 @@ void VSGenerator::generate(const SwBuild &b)

auto cmds = d.target->getCommands();

// remove from commands generation of other project files
std::erase_if(cmds, [&](auto &&c) {
return std::ranges::any_of(c->outputs,
[&](auto &&o){return !is_under_root_by_prefix_path(o, curdirr);});
});

bool has_dll = false;
bool has_exe = false;
for (auto &c : cmds)
Expand Down Expand Up @@ -665,7 +672,7 @@ void VSGenerator::generate(const SwBuild &b)
{
if (f.p.extension() == ".natvis")
natvis.insert(f);
}
}
}

if (!natvis.empty())
Expand Down Expand Up @@ -1261,6 +1268,7 @@ void Project::emitProject(const VSGenerator &g) const
// usual files
for (auto &p : files)
{
// skip natvis
if (p.p.extension() == ".natvis")
continue;

Expand Down Expand Up @@ -1527,6 +1535,7 @@ void Project::emitFilters(const VSGenerator &g) const
ctx.beginBlock("ItemGroup");
for (auto &f : files)
{
// skip natvis
if (f.p.extension() == ".natvis")
continue;

Expand Down

0 comments on commit 3224dde

Please sign in to comment.