MCPcopy Create free account
hub / github.com/Kitware/CMake / GenerateObjects

Method GenerateObjects

Source/cmFastbuildNormalTargetGenerator.cxx:1356–1535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1354}
1355
1356void cmFastbuildNormalTargetGenerator::GenerateObjects(FastbuildTarget& target)
1357{
1358 this->GetGlobalGenerator()->AllFoldersToClean.insert(ObjectOutDir);
1359
1360 std::map<std::string, FastbuildObjectListNode> nodesPermutations;
1361
1362 cmCryptoHash hash(cmCryptoHash::AlgoSHA256);
1363
1364 std::vector<cmSourceFile const*> objectSources;
1365 GeneratorTarget->GetObjectSources(objectSources, Config);
1366
1367 std::set<std::string> createdPCH;
1368
1369 // Directory level.
1370 bool useUnity =
1371 GeneratorTarget->GetLocalGenerator()->GetMakefile()->IsDefinitionSet(
1372 CMAKE_UNITY_BUILD);
1373 // Check if explicitly disabled for this target.
1374 auto const targetProp = GeneratorTarget->GetProperty(UNITY_BUILD);
1375 if (targetProp.IsSet() && targetProp.IsOff()) {
1376 useUnity = false;
1377 }
1378
1379 // List of sources isolated from the unity build if enabled.
1380 std::set<std::string> isolatedFromUnity;
1381
1382 // Mapping from unity group (if any) to sources belonging to that group.
1383 std::map<std::string, std::vector<std::string>> sourcesWithGroups;
1384
1385 for (cmSourceFile const* source : objectSources) {
1386
1387 cmSourceFile const& srcFile = *source;
1388 std::string const pathToFile = srcFile.GetFullPath();
1389 bool fileUsesUnity = useUnity;
1390 if (useUnity) {
1391 // Check if the source should be added to "UnityInputIsolatedFiles".
1392 if (srcFile.GetPropertyAsBool(SKIP_UNITY_BUILD_INCLUSION)) {
1393 fileUsesUnity = false;
1394 isolatedFromUnity.emplace(pathToFile);
1395 }
1396 std::string const perFileUnityGroup =
1397 srcFile.GetSafeProperty(UNITY_GROUP);
1398 if (!perFileUnityGroup.empty()) {
1399 sourcesWithGroups[perFileUnityGroup].emplace_back(pathToFile);
1400 }
1401 }
1402
1403 this->GetGlobalGenerator()->AddFileToClean(cmStrCat(
1404 ObjectOutDir, '/', this->GeneratorTarget->GetObjectName(source)));
1405
1406 // Do not generate separate node for PCH source file.
1407 if (this->GeneratorTarget->GetPchSource(Config, srcFile.GetLanguage()) ==
1408 pathToFile) {
1409 continue;
1410 }
1411
1412 std::string const language = srcFile.GetLanguage();
1413 LogMessage(

Callers

nothing calls this directly

Calls 15

GetArchesMethod · 0.95
moveFunction · 0.85
GetObjectSourcesMethod · 0.80
IsDefinitionSetMethod · 0.80
emplaceMethod · 0.80
emplace_backMethod · 0.80
AddFileToCleanMethod · 0.80
GetPchSourceMethod · 0.80
GetLanguageMethod · 0.80
HashStringMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected