1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 14:08:35 +08:00

FASTBuild: optimize generated file size

Two optimizations here:
1. Remove non-mandatory aliases (I only used them for debugging).
2. Make objects lists' name shorter

Both of those improvements contribute to the decrease of the FASTBuild DB file, since they are getting serialized.
This commit is contained in:
Eduard Voronkin
2025-09-12 23:08:47 -07:00
committed by Eduard Voronkin
parent 5e206e15c5
commit 914a9eea94
2 changed files with 10 additions and 7 deletions

View File

@@ -1307,8 +1307,7 @@ cmFastbuildNormalTargetGenerator::GenerateObjects()
objectListNode); objectListNode);
ComputePCH(*source, objectListNode, createdPCH); ComputePCH(*source, objectListNode, createdPCH);
objectListNode.Name = objectListNode.Name = cmStrCat(this->GetName(), '_', language, "_Objs");
cmStrCat(language, "_ObjectGroup_", GetTargetName());
// TODO: Ask cmake the output objects and group by extension instead // TODO: Ask cmake the output objects and group by extension instead
// of doing this // of doing this
if (language == "RC") { if (language == "RC") {
@@ -1325,13 +1324,12 @@ cmFastbuildNormalTargetGenerator::GenerateObjects()
} }
} }
int groupNameCount = 1; int groupNameCount = 0;
for (auto& val : nodesPermutations) { for (auto& val : nodesPermutations) {
auto& objectListNode = val.second; auto& objectListNode = val.second;
objectListNode.Name = objectListNode.Name =
cmStrCat(objectListNode.Name, "-", objectListNode.CompilerOutputPath, cmStrCat(objectListNode.Name, "_", std::to_string(++groupNameCount));
"-", std::to_string(groupNameCount++));
LogMessage(cmStrCat("ObjectList name: ", objectListNode.Name)); LogMessage(cmStrCat("ObjectList name: ", objectListNode.Name));
} }

View File

@@ -1078,8 +1078,13 @@ void cmGlobalFastbuildGenerator::WriteExec(FastbuildExecNode const& Exec,
} }
Indent(indent); Indent(indent);
*BuildFileStream << "}\n"; *BuildFileStream << "}\n";
WriteAlias(Exec.OutputsAlias); static bool const verbose = GlobalSettingIsOn(FASTBUILD_VERBOSE_GENERATOR) ||
WriteAlias(Exec.ByproductsAlias); cmSystemTools::HasEnv(FASTBUILD_VERBOSE_GENERATOR);
// Those aliases are only used for troubleshooting the generated file.
if (verbose) {
WriteAlias(Exec.OutputsAlias);
WriteAlias(Exec.ByproductsAlias);
}
} }
void cmGlobalFastbuildGenerator::WriteObjectList( void cmGlobalFastbuildGenerator::WriteObjectList(