Skip to content

Commit

Permalink
Fix msvc languages. Improve -showIncludes handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
egorpugin committed Feb 18, 2019
1 parent c345fd7 commit 728c47b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
39 changes: 23 additions & 16 deletions src/driver/cpp/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,32 @@ void VSCommand::postProcess1(bool)
// filter out includes and file name
static const auto pattern = "Note: including file:"s;

std::deque<String> lines;
boost::split(lines, out.text, boost::is_any_of("\n"));
out.text.clear();
// remove filename
lines.pop_front();

for (auto &line : lines)
auto perform = [this](auto &text)
{
auto p = line.find(pattern);
if (p != 0)
std::deque<String> lines;
boost::split(lines, text, boost::is_any_of("\n"));
text.clear();
// remove filename
lines.pop_front();

for (auto &line : lines)
{
out.text += line + "\n";
continue;
auto p = line.find(pattern);
if (p != 0)
{
text += line + "\n";
continue;
}
auto include = line.substr(pattern.size());
boost::trim(include);
for (auto &f : outputs)
File(f, *fs).addImplicitDependency(include);
}
auto include = line.substr(pattern.size());
boost::trim(include);
for (auto &f : outputs)
File(f, *fs).addImplicitDependency(include);
}
};

// on errors msvc puts everything to stderr instead of stdout
perform(out.text);
perform(err.text);
}

std::shared_ptr<Command> GNUCommand::clone() const
Expand Down
13 changes: 12 additions & 1 deletion src/driver/cpp/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,18 +1093,29 @@ void VisualStudioCompiler::prepareCommand1(const TargetBase &t)
cmd->name_short = InputFile().filename().u8string();
//cmd->file = InputFile;
}

if (CSourceFile)
{
cmd->name = normalize_path(CSourceFile());
cmd->name_short = CSourceFile().filename().u8string();
//cmd->file = CSourceFile;
}
if (CPPSourceFile)
else if (CPPSourceFile)
{
cmd->name = normalize_path(CPPSourceFile());
cmd->name_short = CPPSourceFile().filename().u8string();
//cmd->file = CPPSourceFile;
}
else if (InputFile && !CompileAsC && !CompileAsCPP)
{
// .C extension is treated as C language by default (Wt library)
auto &exts = getCppSourceFileExtensions();
if (exts.find(InputFile().extension().string()) != exts.end())
{
CompileAsCPP = true;
}
}

if (Output)
cmd->working_directory = Output().parent_path();

Expand Down
13 changes: 10 additions & 3 deletions src/driver/cpp/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3029,15 +3029,22 @@ void Build::load_dll(const path &dll, bool usedll)
{
createSolutions(dll, usedll);

// add cc if needed
getHostSolution();

if (auto g = getGenerator())
{
LOG_INFO(logger, "Generating " << toString(g->type) << " project with " << solutions.size() << " configurations:");
for (auto &s : solutions)
LOG_INFO(logger, s.getConfig());
}

// add cc if needed
getHostSolution();
else
{
LOG_DEBUG(logger, (getGenerator() ? "Generating " + toString(getGenerator()->type) + " " : "Building ")
<< "project with " << solutions.size() << " configurations:");
for (auto &s : solutions)
LOG_DEBUG(logger, s.getConfig());
}

// detect and eliminate solution clones?

Expand Down

0 comments on commit 728c47b

Please sign in to comment.