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

Method GenerateModuleDefinitionInfo

Source/cmFastbuildNormalTargetGenerator.cxx:554–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554void cmFastbuildNormalTargetGenerator::GenerateModuleDefinitionInfo(
555 FastbuildTarget& target) const
556{
557 cmGeneratorTarget::ModuleDefinitionInfo const* mdi =
558 GeneratorTarget->GetModuleDefinitionInfo(Config);
559 if (mdi && mdi->DefFileGenerated) {
560 FastbuildExecNode execNode;
561 execNode.Name = target.Name + "-def-files";
562 execNode.ExecExecutable = cmSystemTools::GetCMakeCommand();
563 execNode.ExecArguments =
564 cmStrCat("-E __create_def ", FASTBUILD_2_INPUT_PLACEHOLDER, ' ',
565 FASTBUILD_1_INPUT_PLACEHOLDER);
566 std::string const obj_list_file = mdi->DefFile + ".objs";
567
568 auto const nm_executable = GetMakefile()->GetDefinition("CMAKE_NM");
569 if (!nm_executable.IsEmpty()) {
570 execNode.ExecArguments += " --nm=";
571 execNode.ExecArguments += ConvertToFastbuildPath(*nm_executable);
572 }
573 execNode.ExecOutput = ConvertToFastbuildPath(mdi->DefFile);
574 execNode.ExecInput.push_back(ConvertToFastbuildPath(obj_list_file));
575
576 // RunCMake.AutoExportDll
577 for (auto const& objList : target.ObjectListNodes) {
578 execNode.PreBuildDependencies.emplace(objList.Name);
579 }
580 // Tested in "RunCMake.AutoExportDll" / "ModuleDefinition" tests.
581 for (auto& linkerNode : target.LinkerNode) {
582 linkerNode.Libraries2.emplace_back(execNode.Name);
583 }
584
585 target.PreLinkExecNodes.Nodes.emplace_back(std::move(execNode));
586
587 // create a list of obj files for the -E __create_def to read
588 cmGeneratedFileStream fout(obj_list_file);
589 // Since we generate this file once during configuration, we should not
590 // remove it when "clean" is built.
591 // Tested in "RunCMake.AutoExportDll" / "ModuleDefinition" tests.
592 this->GetGlobalGenerator()->AllFilesToKeep.insert(obj_list_file);
593
594 if (mdi->WindowsExportAllSymbols) {
595 std::vector<cmSourceFile const*> objectSources;
596 GeneratorTarget->GetObjectSources(objectSources, Config);
597 std::map<cmSourceFile const*, cmObjectLocations> mapping;
598 for (cmSourceFile const* it : objectSources) {
599 mapping[it];
600 }
601 GeneratorTarget->LocalGenerator->ComputeObjectFilenames(mapping, Config,
602 GeneratorTarget);
603
604 std::vector<std::string> objs;
605 for (cmSourceFile const* it : objectSources) {
606 auto const& v = mapping[it];
607 LogMessage("Obj source : " + v.LongLoc.GetPath());
608 std::string objFile = this->ConvertToFastbuildPath(
609 GeneratorTarget->GetObjectDirectory(Config) + v.LongLoc.GetPath());
610 objFile = cmSystemTools::ConvertToOutputPath(objFile);
611 LogMessage("objFile path: " + objFile);

Callers

nothing calls this directly

Calls 15

moveFunction · 0.85
cmHasLiteralSuffixFunction · 0.85
push_backMethod · 0.80
emplaceMethod · 0.80
emplace_backMethod · 0.80
GetObjectSourcesMethod · 0.80
GetPathMethod · 0.80
GetObjectDirectoryMethod · 0.80
GetExternalObjectsMethod · 0.80
cmStrCatFunction · 0.70
GetDefinitionMethod · 0.45

Tested by

no test coverage detected