This commit is contained in:
parent
b8dc380c33
commit
e77d17ba46
1 changed files with 36 additions and 1 deletions
|
|
@ -255,7 +255,7 @@ BuildResult Crafter::Build(Configuration& config, std::unordered_map<fs::path, s
|
|||
fs::create_directories(outputDir);
|
||||
}
|
||||
|
||||
BuildResult buildResult;
|
||||
BuildResult buildResult{};
|
||||
|
||||
// glslang #include search paths for every shader compiled in this
|
||||
// configuration: each transitive (incl. self) buildFiles entry's parent
|
||||
|
|
@ -931,6 +931,41 @@ BuildResult Crafter::Build(Configuration& config, std::unordered_map<fs::path, s
|
|||
break;
|
||||
}
|
||||
}
|
||||
// Also relink if any .o this archive bundles is newer than the
|
||||
// archive itself. Covers a build that compiled the .o but never
|
||||
// reached the link step (interrupt, crash, or a source touched
|
||||
// after compile but before link): on the next run the .cpp is
|
||||
// already ≤ .o so Implementation/Module Check returns false and
|
||||
// nothing else would notice the archive is stale.
|
||||
if (!buildResult.repack) {
|
||||
auto objNewer = [&](const fs::path& obj) {
|
||||
std::error_code ec;
|
||||
auto t = fs::last_write_time(obj, ec);
|
||||
return !ec && t > consumerMtime;
|
||||
};
|
||||
for (const std::unique_ptr<Module>& iface : config.interfaces) {
|
||||
if (objNewer(buildDir / (iface->path.filename().string() + ".o"))) {
|
||||
buildResult.repack = true;
|
||||
break;
|
||||
}
|
||||
bool partHit = false;
|
||||
for (const std::unique_ptr<ModulePartition>& part : iface->partitions) {
|
||||
if (objNewer(buildDir / (part->path.filename().string() + ".o"))) {
|
||||
partHit = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (partHit) { buildResult.repack = true; break; }
|
||||
}
|
||||
if (!buildResult.repack) {
|
||||
for (const Implementation& impl : config.implementations) {
|
||||
if (objNewer(buildDir / (impl.path.filename().string() + "_impl.o"))) {
|
||||
buildResult.repack = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue